event_nlp 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -1
- data/lib/event_nlp.rb +18 -11
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b9b45e77e53d8fb10a418d7a49797ca09779286
|
4
|
+
data.tar.gz: 64cc7e8b8aac9b1dad55cf0842b1b0058762bcc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c25e6b6dd98e1dc4eba2255e21774cc4a91205e60decfac70d7232da1e4f39664b32d66fff8a687b82e61d3f301c97c42d70417e2cf2fde63f90c55393a060ef
|
7
|
+
data.tar.gz: 542f480ab1ff23cf5c3642cfeb30a876e621ab72fe9797cd8dea2eadd143966f0df77cd559797a1e71d3eefb47991e82d25feefd63e9d9a27d0f6e436038ccba
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
c�Թ2�'����ޅ��jpl���`�x��O[D�o�1�h�:�z;V���٘e]C}f�U��S�u���R\Wf��D���r�ꨚ��t��ϰ����G"Z��⭝>�H�уfm�[��T���̎�Ɠ�+/��2�c�X��F��b�Os<@�i��;TE�I4\$q�JT�ߡR}��S~HQ���X�F�u,);9OVL���~���c^�"�����tgdb-��_��Tnd�!�"���<�y��$r_��'wE�
|
data/lib/event_nlp.rb
CHANGED
@@ -38,6 +38,7 @@ class EventNlp
|
|
38
38
|
|
39
39
|
def parse(s)
|
40
40
|
|
41
|
+
@params[:input] = s
|
41
42
|
r = run_route(s)
|
42
43
|
|
43
44
|
return unless r.is_a? Hash
|
@@ -67,6 +68,7 @@ class EventNlp
|
|
67
68
|
get /^(.*)\s+(every \d\w+ \w+#{time})\s*#{starting}/ do \
|
68
69
|
|title, recurring, time, raw_date, end_date|
|
69
70
|
|
71
|
+
input = params[:input].clone
|
70
72
|
d = Chronic.parse(raw_date + ' ' + time.to_s)
|
71
73
|
|
72
74
|
if recurring =~ /day|week/ then
|
@@ -75,14 +77,19 @@ class EventNlp
|
|
75
77
|
|
76
78
|
new_date = CronFormat.new(ChronicCron.new(recurring)\
|
77
79
|
.to_expression, d).to_time
|
80
|
+
input.gsub!(raw_date, new_date\
|
81
|
+
.strftime("#{new_date.day.ordinal} %b %Y"))
|
78
82
|
d = new_date
|
79
83
|
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
83
|
-
|
84
|
-
|
85
|
-
|
87
|
+
if @debug then
|
88
|
+
puts [0, input, title, recurring, time, raw_date, end_date].inspect
|
89
|
+
end
|
90
|
+
|
91
|
+
{input: input, title: title, recurring: recurring, date: d,
|
92
|
+
end_date: end_date}
|
86
93
|
|
87
94
|
end
|
88
95
|
|
@@ -91,8 +98,7 @@ class EventNlp
|
|
91
98
|
get /^(.*)\s+(\d(?:st|nd|rd|th) \w+ of every \w+(?: at (\d+[ap]m) )?)\s*#{starting}/ do \
|
92
99
|
|title, recurring, time, raw_date, end_date|
|
93
100
|
|
94
|
-
input = params[:input]
|
95
|
-
|
101
|
+
input = params[:input].clone
|
96
102
|
d = Chronic.parse(raw_date)
|
97
103
|
|
98
104
|
if recurring =~ /day|week|month/ then
|
@@ -110,20 +116,19 @@ class EventNlp
|
|
110
116
|
end
|
111
117
|
|
112
118
|
puts [0.3, title, recurring, time, raw_date, end_date].inspect if @debug
|
113
|
-
{input: input, title: title, recurring: recurring, date: d,
|
114
|
-
|
119
|
+
{input: input, title: title, recurring: recurring, date: d, end_date:
|
120
|
+
end_date}
|
115
121
|
|
116
122
|
end
|
117
123
|
|
118
124
|
get /^(.*)(every .*)/ do |title, recurring|
|
119
125
|
|
120
|
-
input = params[:input]
|
121
126
|
exp = ChronicCron.new(recurring).to_expression
|
122
127
|
|
123
128
|
d = CronFormat.new(exp).to_time
|
124
129
|
|
125
130
|
puts [0.5, title, recurring, d].inspect if @debug
|
126
|
-
{
|
131
|
+
{title: title, recurring: recurring, date: d }
|
127
132
|
|
128
133
|
end
|
129
134
|
|
@@ -210,7 +215,8 @@ class EventNlp
|
|
210
215
|
get /(\d[^\s]+)\s*(\d+(?:\:\d+)?[ap]m)?\s+([^\*]+)(\*)?/ do |raw_date,
|
211
216
|
time, title, annualar|
|
212
217
|
|
213
|
-
d = Chronic.parse(raw_date + ' ' + time.to_s,
|
218
|
+
d = Chronic.parse(raw_date + ' ' + time.to_s,
|
219
|
+
:endian_precedence => :little)
|
214
220
|
recurring = nil
|
215
221
|
|
216
222
|
if annualar then
|
@@ -230,7 +236,8 @@ class EventNlp
|
|
230
236
|
# some event Wednesday 11am
|
231
237
|
|
232
238
|
relative_day = '|today|tomorrow|tonight'
|
233
|
-
get /^(.*)\s+((?:#{weekday+relative_day})(?: \d{1,2}(?::\d{2})?[ap]m)?)/i
|
239
|
+
get /^(.*)\s+((?:#{weekday+relative_day})(?: \d{1,2}(?::\d{2})?[ap]m)?)/i \
|
240
|
+
do |title, raw_date|
|
234
241
|
|
235
242
|
d = Chronic.parse(raw_date)
|
236
243
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_nlp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
/WtgKLMzCAKTHZ2OpN3OTs6j+vsUBIwCb/Ki17Z4YULtRaGg7I8nTjTrHIIJ0yNm
|
32
32
|
kbRihMTezaC+4A==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-
|
34
|
+
date: 2017-09-17 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: chronic_cron
|
metadata.gz.sig
CHANGED
Binary file
|