Skip to content

Commit

Permalink
Merge pull request #78 from kengz/master
Browse files Browse the repository at this point in the history
NLP fix #2: arithmetics support, complete CFG features (suppressed now)
  • Loading branch information
matthewmueller committed Mar 13, 2016
2 parents b7590ef + 5e24d94 commit a495343
Show file tree
Hide file tree
Showing 10 changed files with 2,267 additions and 410 deletions.
5 changes: 2 additions & 3 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
### Issues currently under work:
- 71: "3.99" is interpreted as 4.39am: justified
- 66, 64, 28, 21, 18, 16, 15, 11, 5, 4: normalization: natural language for numbers and time
- 70, 66, 63, 62, 21, 18, 15: support arithmetic, in <n><T>, with <op=and> etc.
- 70, 66, 63, 18: full CFG and unit-specific arithmetics
- 27, 26, 13: default, e.g. tonight, tomorrow at 11 -> at 11am, at midnight etc
- 55, 52, 25, 2: causality, before, after, ago, from now, <bar> ops
- 32: ranges
- fix decimal number parsing
- CFG pending takeover: month-specific carry into days, defaults (tomorrow = 9am), leap year

0.3.1 / 2016-03-02
==================
Expand Down
70 changes: 50 additions & 20 deletions lib/maps.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
{
"op": {
"plus": ["plus", "+", "add", "and"],
"plus": ["and", "plus", "+", "add", "on"],
"minus": ["minus", "subtract"],
"times": ["times", "multiply"],
"divide": ["divide"]
},
"c": {
"c": ["every", "per", "repeat"]
},
"r": {
"to": ["to", "thru", "through", "til", "till", "until", "-", "~"]
"o": {
"plus": ["at", "in", "past", "late", "later", "after", "next", "from", "start", "starting", "since", "coming"],
"minus": ["last", "minus", "subtract", "ago", "before", "from"]
},
"n": {
"0.25": ["quarter"],
"0.5": ["half", "1/2", "half a", "half an"],
"0.5": ["half", "1/2", "half an"],
"0": ["zero"],
"1": ["one", "a", "an", "first"],
"2": ["two"],
"2": ["two", "second"],
"3": ["three", "third"],
"4": ["four", "fourth"],
"5": ["five", "fifth"],
Expand Down Expand Up @@ -46,20 +44,52 @@
"1000": ["thousand", "thousands", "thousandth", "k", "K"]
},
"t": {
"th": ["st", "nd", "rd", "th", "st day", "nd day", "rd day", "th day"],
"2 week": ["fortnight", "next fortnight", "a fortnight"]
},
"dt": {
"ms": ["ms", "millisecond", "milliseconds"],
"second": ["s", "sec", "secs", "second", "seconds"],
"minute": ["m", "min", "mins", "minute", "minutes"],
"hour": ["h", "hr", "hrs", "hour", "hours"],
"day": ["d", "day", "days", "dai"],
"week": ["w", "wk", "wks", "week", "weeks"],
"month": ["M", "MM", "mo", "moon", "moons", "month", "months"],
"year": ["y", "yr", "yrs", "year", "years"],
"tomorrow": ["tmr", "tom", "tomorrow"],
"yesterday": ["ytd", "yesterday"]
"s": ["second", "seconds", "s", "sec", "secs"],
"m": ["minute", "minutes", "m", "min", "mins"],
"h": ["hour", "hours", "h", "hr", "hrs"],
"d": ["day", "days", "d", "dai"],
"w": ["week", "weeks", "w", "wk", "wks"],
"M": ["month", "months", "monthes", "M", "mo", "moon", "moons"],
"y": ["year", "years", "y", "yr", "yrs"]
},
"T": {
"t:,dt:=3h": ["later", "soon"],
"t:=1d,dt:": ["st", "nd", "rd", "th", "st day", "nd day", "rd day", "th day"],
"t:,dt:1w": ["st week", "nd week", "rd week", "th week"],
"t:,dt:14d": ["day", "fortnight"],
"t:=0h=0m=0s1mer,dt:": ["pm", "p.m", "p.m.", "noon"],
"t:,dt:1d": ["tomorrow", "tmr"],
"t:,dt:-1d": ["yesterday", "ytd"],
"t:,0dt:": ["today"],
"t:=2h=0m=0s1mer,dt:": ["afternoon"],
"t:=6h=0m=0s0mer,dt:": ["dawn"],
"t:=7h=0m=0s0mer,dt:": ["am", "a.m", "a.m."],
"t:=7h=0m=0s1mer,dt:": ["evening"],
"t:=8h=0m=0s0mer,dt:": ["morning"],
"t:=9h=0m=0s1mer,dt:": ["tonight", "night"],
"t:=0h=0m=0s0mer,dt:1d": ["midnight"],
"t:,dt:=0w0wd": ["sunday", "sun"],
"t:,dt:=0w1wd": ["monday", "mon"],
"t:,dt:=0w2wd": ["tuesday", "tue", "tues"],
"t:,dt:=0w3wd": ["wednesday", "wed"],
"t:,dt:=0w4wd": ["thursday", "thu", "thur", "thurs"],
"t:,dt:=0w5wd": ["friday", "fri"],
"t:,dt:=0w6wd": ["saturday", "sat"],
"t:1M=1d,dt:": ["january", "jan"],
"t:2M=1d,dt:": ["february", "feb"],
"t:3M=1d,dt:": ["march", "mar"],
"t:4M=1d,dt:": ["april", "apr"],
"t:5M=1d,dt:": ["may"],
"t:6M=1d,dt:": ["june", "jun"],
"t:7M=1d,dt:": ["july", "jul"],
"t:8M=1d,dt:": ["august", "aug"],
"t:9M=1d,dt:": ["september", "sept", "sep"],
"t:10M=1d,dt:": ["october", "oct"],
"t:11M=1d,dt:": ["november", "nov"],
"t:12M=1d,dt:": ["december", "dec"],
"t:12M25d,dt:": ["christmas"]
},
"f": {
"1": ["once"],
Expand Down

0 comments on commit a495343

Please sign in to comment.