public abstract class AbstractDateCheckWithSuggestionsFilter extends RuleFilter
Monday, 8 November 2003
isn't actually a Monday. Replaces {realDay} with the real day of the date in the rule's message,
and {day} with the claimed day from the text (might be useful in case the text uses an abbreviation).| Modifier and Type | Field and Description |
|---|---|
protected static Pattern |
DAY_OF_MONTH_PATTERN |
| Constructor and Description |
|---|
AbstractDateCheckWithSuggestionsFilter() |
| Modifier and Type | Method and Description |
|---|---|
RuleMatch |
acceptRuleMatch(RuleMatch match,
Map<String,String> args,
int patternTokenPos,
AnalyzedTokenReadings[] patternTokens,
List<Integer> tokenPositions)
Returns the original rule match or a modified one, or
null
if the rule match is filtered out. |
protected String |
adjustSuggestion(String sugg) |
protected abstract Calendar |
getCalendar() |
protected Calendar |
getDate(int dayOfMonth,
int month,
int year) |
protected int |
getDayOfMonth(String localizedDayOfMonth)
Implement so that "first" returns
1, second returns 2 etc. |
protected abstract String |
getDayOfWeek(Calendar date)
Get the localized name of the day of week for the given date.
|
protected abstract int |
getDayOfWeek(String localizedWeekDayString)
Implement so that Sunday returns
1, Monday 2 etc. |
protected String |
getDayStrLikeOriginal(String day,
String original) |
protected abstract String |
getErrorMessageWrongYear() |
protected abstract int |
getMonth(String localizedMonth)
Implement so that January returns
1, February 2 etc. |
getLanguageFromRuleMatch, getOptional, getOptional, getPosition, getRequired, getSkipCorrectedReference, getSynthesizerFromRuleMatch, isMatchAtSentenceStart, matchesprotected static final Pattern DAY_OF_MONTH_PATTERN
public AbstractDateCheckWithSuggestionsFilter()
protected abstract int getDayOfWeek(String localizedWeekDayString)
1, Monday 2 etc.localizedWeekDayString - a week day name or abbreviation thereofprotected abstract String getDayOfWeek(Calendar date)
protected int getDayOfMonth(String localizedDayOfMonth)
1, second returns 2 etc.localizedDayOfMonth - name of day of the month or abbreviation thereofprotected abstract int getMonth(String localizedMonth)
1, February 2 etc.localizedMonth - name of a month or abbreviation thereofprotected abstract Calendar getCalendar()
protected abstract String getErrorMessageWrongYear()
public RuleMatch acceptRuleMatch(RuleMatch match, Map<String,String> args, int patternTokenPos, AnalyzedTokenReadings[] patternTokens, List<Integer> tokenPositions)
RuleFilternull
if the rule match is filtered out.acceptRuleMatch in class RuleFilterargs - a map with values for year, month, day (day of month), weekDaypatternTokens - those tokens of the text that correspond the matched patternnull if this rule match should be removed, or any other RuleMatch (e.g. the one from
the arguments) that properly describes the detected errorprotected Calendar getDate(int dayOfMonth, int month, int year)