Fuzzy time / time management library for .NET.

I am looking for a .NET library that can store and manage fuzzy (i.e., vague) dates / times, i.e. temporary expressions that do not follow the usual exact pattern of day, month, year, hour, minute, second, I need something, which can handle date / time values, for example:

  • The second quarter of 1985.
  • Early 1930s
  • The second third of the XVII century

The library will probably implement the FuzzyDateTime type or something like that and allow several ways to create instances of it from text and / or regular DateTime values. Comparison and sorting functions are also required.

So my question is: do you know about any available products that fit this description? I am pleased to consider all types of products, that is, commercial, open source, free software, etc.

Any ideas? Many thanks.

+7
source share
2 answers

Most likely you will have to encode this from scratch. There may be a Java library that you can convert, but it seems that this type of functionality is now the subject of academic research, and not what happens in different places. In the end, you can use something academic, but you may have to program your own based on your needs.

To provide maximum flexibility, I would save each part of the date in separate fields with a null value with a value indicating the uncertainty of the first null field.

class UncertainDate { public byte? Millennium { get; set; } public byte? Century { get; set; } public byte? Decade { get; set; } public byte? Year { get; set; } public byte? Month { get; set; } public byte? Day { get; set; } // more as you see fit public decimal Uncertainty { get; set; } } 

As an example, the “first quarter of 2000” will be presented as:

 var d = new UncertainDate() { Millennium = 2, Century = 0, Decade = 0, Year = 0, Uncertainty = 0.25m }; 

This gives you a long route to move to line input and output string output, but simplifies the comparison (compare each field in order, the first or lowest uncertainty is lost).

You can also use an enumeration for uncertainty, maybe values ​​like FirstQuarter, FirstHalf, Early, Late, ThirdQuarter , etc. A decimal makes relative comparisons easy, but is it harder to get back to things like the “second half” (ie, will 0.75 be “second half” or “third quarter”?)

For reference, similar questions were asked.

+6
source

I do not know any library / product, although I can imagine that this moment, at least, thought about it in any of the “semantic” fields (for example, in the semantic network, etc.).

IF I don’t know what you need (especially if you want to sort, etc.), then these “fuzzy” things are “intervals” between two specific points in time ...

You can create a class containing 2 DateTimes ... Start and end ... alternatively, the duration of the run plus ...
Add to that any representation you can imagine ... Some designers to interpret what you want to throw at them (for example, something that “knows”, which means “early” or “quarter”), and builds the corresponding beginning and end. <br />

Since you have a DateTime start and end (DateTime or duration), they are perfectly comparable and sorted ...

As for storage, you can make it serializable ...

+3
source

All Articles