event_nlp 0.2.11 → 0.2.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d394e7eb9da0f8a92e3966819fec1288936260a9
4
- data.tar.gz: a85d522b2208ef9a9cd6aff61adde643d1963b35
3
+ metadata.gz: b6bd12bdaa5603fec5552ea339467cdabce44a47
4
+ data.tar.gz: aa8534ac2c9cbaa2caaeb5cb8711a011a4fc9f54
5
5
  SHA512:
6
- metadata.gz: 8661e5a81643dc94cd6ceeb18ec6dd54b10ebcdbbd083ae60b56b7dd12bd4914c958bdd665a80ed577ef6b585bb916e92d9cf2e32833a0842a4fbc62dbd956d7
7
- data.tar.gz: e10c87e9c4a1f1c410d0e1408540f6c4b546642f73555bb2d2d18e30f0893b38a5bf7a7f9f2d9137424cf53239acda33481128058792741c1dd64224d7b12a95
6
+ metadata.gz: e9483586440445991c2e6745ea364702636e1a16c123bd122ae7a393a33405d0164f7345d53bb4dc930b6338536a16684c46fceb8c16bbb6c2da1ee25f0899e1
7
+ data.tar.gz: cb980603815f2da3409446e34fa56beb03f06dc508533058b38db2f0a03938c643402c30248e0c55cfe8b35c5be7e2f7eeb18df8ad8fd3c72d48bc21706905ad
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/event_nlp.rb CHANGED
@@ -65,12 +65,28 @@ class EventNlp
65
65
  times = /(?: *(?:at |@ |from )?(\d+(?::\d+)?[ap]m) *)/
66
66
  times2 = /\d+(?::\d+)?[ap]m-\d+(?::\d+)?[ap]m|\d+(?::\d+)?-\d+(?::\d+)?/
67
67
  days = /\d+(?:st|nd|rd|th)/
68
+ periods = /day|week|month/
68
69
 
69
70
  #weekdays = Date::DAYNAMES.join('|').downcase
70
71
  #
71
72
  #times = /(?: *at )?\d[ap]m/
72
-
73
73
 
74
+ # e.g. electricity bill on the 28th of every month
75
+
76
+ get /(.*) on the (#{days}) of every (#{periods})/ do |title, day, recurring|
77
+
78
+
79
+ d = Chronic.parse(day)
80
+
81
+
82
+ if @debug then
83
+ puts [0.1, title, recurring, d].inspect
84
+ end
85
+
86
+ {title: title, recurring: recurring, date: d}
87
+
88
+ end
89
+
74
90
 
75
91
  get /^(.*)\s+(every \d\w+ \w+#{times})\s*#{starting}/ do \
76
92
  |title, recurring, time, raw_date, end_date|
@@ -92,7 +108,7 @@ class EventNlp
92
108
  end
93
109
 
94
110
  if @debug then
95
- puts [0, input, title, recurring, time, raw_date, end_date].inspect
111
+ puts [0.2, input, title, recurring, time, raw_date, end_date].inspect
96
112
  end
97
113
 
98
114
  {input: input, title: title, recurring: recurring, date: d,
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.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- ��\����+�;o�q9�e���H%�s��;#.�ǹ
2
- ר�acNν7)9We.U#D��ߡ���D%�V"�ð��x��ƨ�'w{�G�����-�GU ����� dV��L1����1x��r���!�>�� �����#�e����@r��U��f\�$��/�>�X*�pףS�����R��kz���, K jF���A�� _���m}���G�@ ����4��h�Ɠ����Z7$��U�
1
+ X`-�����&�� t�Fv)u��vя���B�&��D������b�|�F/6��O
2
+ y�.��p�ҝ/�Ϩ���FCpɆ���l�G�l��dN�i��nT��NҚ�Y�}��|]e�*��j�r� Ԝ�X�@ u0zC�6=��2��a$h�] ���˖2�3���ax�U�M e=��}�<�8��8Pt0x��F0-}TuF�\����Y�Y�$[I�� � ^�Ļ8?'�%����Ν�