-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.NET] Integration of new mode termed "TasksMode" in DatetimeOption.cs #2972
Changes from 13 commits
2b2983b
e0310ea
32b3458
6d12c6d
721f3ab
1f75b68
327b60a
eebb8ce
e26d28a
341638f
3c934a3
e4d7d20
de29e6f
77a6a5d
c291775
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,14 @@ private void AddTo(List<ExtractResult> dst, List<ExtractResult> src, string text | |
} | ||
} | ||
|
||
if ((config.Options & DateTimeOptions.TasksMode) != 0) | ||
{ | ||
if (ShouldSkipOnlyYear(result)) | ||
{ | ||
continue; | ||
} | ||
} | ||
|
||
var isFound = false; | ||
var overlapIndexes = new List<int>(); | ||
var firstIndex = -1; | ||
|
@@ -270,6 +278,15 @@ private bool ShouldSkipFromToMerge(ExtractResult er) | |
return config.FromToRegex.IsMatch(er.Text); | ||
} | ||
|
||
/*Under TasksMode: Should not treat a four-digit number as a daterange if the input text does not include a month or year reference. | ||
It should not treat 2005 as a daterange in statements like "Milk 2005." | ||
(The year 2005 should be treated as a number only.) | ||
*/ | ||
private bool ShouldSkipOnlyYear(ExtractResult er) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to do this in this PR, but it would be interesting if this mode-specific behaviours/code is isolated into it's own module/strategy. |
||
{ | ||
return config.YearRegex.Match(er.Text).Value == er.Text; | ||
tellarin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
private List<ExtractResult> FilterUnspecificDatePeriod(List<ExtractResult> ers) | ||
{ | ||
ers.RemoveAll(o => this.config.UnspecificDatePeriodRegex.IsMatch(o.Text)); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also personally prefer to use 2^20 as the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason for using 2^20 value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the highest available value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file doesn't seem updated here.