File tree Expand file tree Collapse file tree 3 files changed +40
-35
lines changed
Expand file tree Collapse file tree 3 files changed +40
-35
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,7 @@ export const WEEKDAY_DICTIONARY: { [word: string]: number } = {
2020 "sab" : 6 ,
2121} ;
2222
23- export const FULL_MONTH_NAME_DICTIONARY : { [ word : string ] : number } = {
24-
25- } ;
23+ export const FULL_MONTH_NAME_DICTIONARY : { [ word : string ] : number } = { } ;
2624
2725export const MONTH_DICTIONARY : { [ word : string ] : number } = {
2826 ...FULL_MONTH_NAME_DICTIONARY ,
@@ -69,41 +67,41 @@ export const MONTH_DICTIONARY: { [word: string]: number } = {
6967} ;
7068
7169export const INTEGER_WORD_DICTIONARY : { [ word : string ] : number } = {
72- ' uno' : 1 ,
73- ' due' : 2 ,
74- ' tre' : 3 ,
75- ' quattro' : 4 ,
76- ' cinque' : 5 ,
77- ' sei' : 6 ,
78- ' sette' : 7 ,
79- ' otto' : 8 ,
80- ' nove' : 9 ,
81- ' dieci' : 10 ,
82- ' undici' : 11 ,
83- ' dodici' : 12 ,
70+ " uno" : 1 ,
71+ " due" : 2 ,
72+ " tre" : 3 ,
73+ " quattro" : 4 ,
74+ " cinque" : 5 ,
75+ " sei" : 6 ,
76+ " sette" : 7 ,
77+ " otto" : 8 ,
78+ " nove" : 9 ,
79+ " dieci" : 10 ,
80+ " undici" : 11 ,
81+ " dodici" : 12 ,
8482} ;
8583
8684export const ORDINAL_WORD_DICTIONARY : { [ word : string ] : number } = {
8785 "primo" : 1 ,
8886 "secondo" : 2 ,
8987 "terzo" : 3 ,
90- ' quarto' : 4 ,
91- ' quinto' : 5 ,
92- ' sesto' : 6 ,
93- ' settimo' : 7 ,
94- ' ottavo' : 8 ,
95- ' nono' : 9 ,
96- ' decimo' : 10 ,
97- ' undicesimo' : 11 ,
98- ' dodicesimo' : 12 ,
99- ' tredicesimo' : 13 ,
100- ' quattordicesimo' : 14 ,
101- ' quindicesimo' : 15 ,
102- ' sedicesimo' : 16 ,
103- ' diciassettesimo' : 17 ,
104- ' diciottesimo' : 18 ,
105- ' diciannovesimo' : 19 ,
106- ' ventesimo' : 20 ,
88+ " quarto" : 4 ,
89+ " quinto" : 5 ,
90+ " sesto" : 6 ,
91+ " settimo" : 7 ,
92+ " ottavo" : 8 ,
93+ " nono" : 9 ,
94+ " decimo" : 10 ,
95+ " undicesimo" : 11 ,
96+ " dodicesimo" : 12 ,
97+ " tredicesimo" : 13 ,
98+ " quattordicesimo" : 14 ,
99+ " quindicesimo" : 15 ,
100+ " sedicesimo" : 16 ,
101+ " diciassettesimo" : 17 ,
102+ " diciottesimo" : 18 ,
103+ " diciannovesimo" : 19 ,
104+ " ventesimo" : 20 ,
107105 "ventunesimo" : 21 ,
108106 "ventiduesimo" : 22 ,
109107 "ventitreesimo" : 23 ,
@@ -167,7 +165,9 @@ export function parseNumberPattern(match: string): number {
167165
168166//-----------------------------
169167
170- export const ORDINAL_NUMBER_PATTERN = `(?:${ matchAnyPattern ( ORDINAL_WORD_DICTIONARY ) } |[0-9]{1,2}(?:mo|ndo|rzo|simo|esimo)?)` ;
168+ export const ORDINAL_NUMBER_PATTERN = `(?:${ matchAnyPattern (
169+ ORDINAL_WORD_DICTIONARY
170+ ) } |[0-9]{1,2}(?:mo|ndo|rzo|simo|esimo)?)`;
171171export function parseOrdinalNumberPattern ( match : string ) : number {
172172 let num = match . toLowerCase ( ) ;
173173 if ( ORDINAL_WORD_DICTIONARY [ num ] !== undefined ) {
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/
66import { matchAnyPattern } from "../../../utils/pattern" ;
77
88const PATTERN = new RegExp (
9- `(questo|ultimo|scorso|prossimo|dopo\\s*questo|questa|ultima|scorsa|prossima\\s*questa)\\s*(${ matchAnyPattern ( TIME_UNIT_DICTIONARY ) } )(?=\\s*)` + "(?=\\W|$)" ,
9+ `(questo|ultimo|scorso|prossimo|dopo\\s*questo|questa|ultima|scorsa|prossima\\s*questa)\\s*(${ matchAnyPattern (
10+ TIME_UNIT_DICTIONARY
11+ ) } )(?=\\s*)` + "(?=\\W|$)" ,
1012 "i"
1113) ;
1214
Original file line number Diff line number Diff line change @@ -4,7 +4,10 @@ import { ParsingComponents } from "../../../results";
44import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary" ;
55import { reverseTimeUnits } from "../../../utils/timeunits" ;
66
7- const PATTERN = new RegExp ( `(questo|ultimo|passato|prossimo|dopo|questa|ultima|passata|prossima|\\+|-)\\s*(${ TIME_UNITS_PATTERN } )(?=\\W|$)` , "i" ) ;
7+ const PATTERN = new RegExp (
8+ `(questo|ultimo|passato|prossimo|dopo|questa|ultima|passata|prossima|\\+|-)\\s*(${ TIME_UNITS_PATTERN } )(?=\\W|$)` ,
9+ "i"
10+ ) ;
811
912export default class ENTimeUnitCasualRelativeFormatParser extends AbstractParserWithWordBoundaryChecking {
1013 innerPattern ( ) : RegExp {
You can’t perform that action at this time.
0 commit comments