Skip to content

Commit

Permalink
Match both centuries in "19th and early 20th century".
Browse files Browse the repository at this point in the history
  • Loading branch information
kno10 committed Apr 23, 2018
1 parent 7a4f56b commit 650651d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/english/rules/resources_rules_daterules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ RULENAME="date_r14d",EXTRACTION="(?:[Tt]he )?%rePartWords\s?%reNumWordTeen %reDe
//// EXAMPLE r15a_2: the seventh century
RULENAME="date_r15a",EXTRACTION="(?:[Tt]he )?%(reDayNumberTh|reDayWordTh) [Cc]entur(?:y|ies)",NORM_VALUE="%normDay(%SUM%(%normDay(group(1)),-1))"
RULENAME="date_r15b",EXTRACTION="%rePartWords(?: the)? %(reDayNumberTh|reDayWordTh) [Cc]entur(?:y|ies)",NORM_VALUE="%normDay(%SUM%(%normDay(group(2)),-1))",NORM_MOD="%normPartWords(group(1))"
RULENAME="date_r15c",EXTRACTION="(?:[Tt]he )?%(reDayNumberTh|reDayWordTh)%reAndOrTo(?:the )?%(reDayNumberTh|reDayWordTh) [Cc]entur(?:y|ies)",NORM_VALUE="%normDay(%SUM%(%normDay(group(1)),-1))",OFFSET="group(0)-group(1)"
RULENAME="date_r15c",EXTRACTION="(?:[Tt]he )?%(reDayNumberTh|reDayWordTh)%reAndOrTo(?:the )?(?:%rePartWords )?%(reDayNumberTh|reDayWordTh) [Cc]entur(?:y|ies)",NORM_VALUE="%normDay(%SUM%(%normDay(group(1)),-1))",OFFSET="group(0)-group(1)"
RULENAME="date_r15d",EXTRACTION="%rePartWords(?: the)? %(reDayNumberTh|reDayWordTh)%reAndOrTo(?:the )?%(reDayNumberTh|reDayWordTh) [Cc]entur(?:y|ies)?",NORM_VALUE="%normDay(%SUM%(%normDay(group(2)),-1))",OFFSET="group(0)-group(2)",NORM_MOD="%normPartWords(group(1))"

///////////////////////////////////
Expand Down
14 changes: 14 additions & 0 deletions test/de/unihd/dbs/heideltime/test/english/EnglishDateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,20 @@ public void testdate_r15a() {
new String[] { "date_r15a", "the seventh century", "06" });
}

@Test
public void testdate_r15c() {
testSingleCase("19th and 20th century", //
new String[] { "date_r15c", "19th", "18" }, //
new String[] { "date_r15a", "20th century", "19" });
}

@Test
public void testdate_r15b() {
testSingleCase("19th and early 20th century", //
new String[] { "date_r15c", "19th", "18" }, //
new String[] { "date_r15b", "early 20th century", "19" });
}

@Test
public void testdate_r16a() {
testSingleCase("March", //
Expand Down

0 comments on commit 650651d

Please sign in to comment.