event_nlp 0.6.8 → 0.7.0

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
  SHA256:
3
- metadata.gz: 1200231cc34b803c923b8b4f83b03a7f9d4f97e5459b8ad0b28d90a8140bd024
4
- data.tar.gz: af0a750f75290c985454611f61004df0e31b73be38f58857af60d8ef7ba62e25
3
+ metadata.gz: 8cdc8db5361075d76541559dda4b9541afbef4af1f530fb1076d1a2e73b2bb2a
4
+ data.tar.gz: ab4558673af5119af70185d2b19f75d4d8757cd4afec2d0b5495935b4ce8d26b
5
5
  SHA512:
6
- metadata.gz: aa698ae6633855f0dbc21244c57283aa9bb0155aba6f2e43fc17d9d76a1aa0bbf520e1edf4cee2940738bdedee4ec1f01a52b61b98257e9ab974319e4ad36192
7
- data.tar.gz: 83d534cda5ab96200952401ebde246701b30ce40fa8133f8badcb948f5edf9dbd7bdf6d209e718c32aa893cfcd227788a39c05163c0232492c6e261fa0142b35
6
+ metadata.gz: a72a9209568969b91a85cb019440d8704ba34a6e5b3cf531353c60106f18fdbd4715d0beb5cd1f10023e1e379698631377287fca70471af25a5b9c2c7c7e3ce4
7
+ data.tar.gz: 5f581d752bd427cc347cde61e5776be7c47ac7f19440c2609d1721688af7d1f8aeebd8df0e5c8be88cdcf82a3f9b367680de2972ada5ea9e0bcb38a801e41734
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/event_nlp.rb CHANGED
@@ -2,10 +2,18 @@
2
2
 
3
3
  # file: event_nlp.rb
4
4
 
5
- require 'chronic_cron'
5
+
6
+ #require 'chronic_cron'
6
7
  require 'ostruct'
7
- require 'app-routes'
8
+ require 'requestor'
9
+
10
+ code = Requestor.read('http://a0.jamesrobertson.me.uk/rorb/r/ruby') do |x|
11
+ x.require 'app-routes'
12
+ x.require 'chronic_cron'
13
+ end
8
14
 
15
+ eval code
16
+ #require 'app-routes'
9
17
 
10
18
  module Ordinals
11
19
 
@@ -150,6 +158,8 @@ class EventNlp
150
158
  weekdays = "(%s)" % weekdays2
151
159
  months = "(%s)" % (Date::MONTHNAMES[1..-1] + Date::ABBR_MONTHNAMES[1..-1])\
152
160
  .join('|').downcase
161
+ years = /(20[0-9]{2})/
162
+
153
163
  times = /(?: *(?:at |@ |from )?(\d+(?::\d+)?(?:[ap]m|\b)) *)/
154
164
  times2 = /\d+(?::\d+)?[ap]m-\d+(?::\d+)?[ap]m|\d+(?::\d+)?-\d+(?::\d+)?/
155
165
  times3 = /(\d+(?::\d+)?[ap]m-\d+(?::\d+)?[ap]m|\d+(?::\d+)?-\d+(?::\d+)?)/
@@ -536,12 +546,40 @@ class EventNlp
536
546
  { title: title, date: d1 }
537
547
  end
538
548
 
549
+ # Some event (10 Woodhouse Lane) 30th Nov at 9:15-10:00
550
+
551
+ get /^(.*) #{days} #{months} #{years}(?: at)? (#{times2})/i do \
552
+ |title, day, month, years, xtimes|
553
+
554
+ t1, t2 = xtimes.split(/-/,2)
555
+ puts '[title, years, day, month, t1] ' + [title, years, day, month, t1].inspect if @debug
556
+ d1 = Chronic.parse([month, day, years, t1].join(' '), now: @now)
557
+ d2 = Chronic.parse([month, day, years, t2].join(' '), now: @now)
558
+
559
+ puts [4.655, title, d1].inspect.debug if @debug
560
+
561
+ { title: title.sub(/ on$/,''), date: d1, end_date: d2 }
562
+ end
563
+
564
+ # Some event (10 Woodhouse Lane) 30th Nov at 9:15
565
+
566
+ get /^(.*) #{days} #{months} #{years}(?: at)? (#{times})/i do \
567
+ |title, day, month, years, t1|
568
+
569
+ puts '[title, years, day, month, t1] ' + [title, years, day, month, t1].inspect if @debug
570
+ d1 = Chronic.parse([month, day, years, t1].join(' '), now: @now)
571
+
572
+ puts [4.66, title, d1].inspect.debug if @debug
573
+
574
+ { title: title.sub(/ on$/,''), date: d1 }
575
+ end
576
+
539
577
  # Some event (10 Woodhouse Lane) 30th Nov at 9:15-
540
578
 
541
579
  get /^(.*) #{days} #{months}(?: at)? (#{times})/i do \
542
580
  |title, day, month, t1|
543
581
 
544
-
582
+ puts '[title, day, month, t1] ' + [title, day, month, t1].inspect if @debug
545
583
  d1 = Chronic.parse([month, day, t1].join(' '), now: @now)
546
584
 
547
585
  puts [4.7, title, d1].inspect.debug if @debug
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.6.8
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  w8lJ+I6Lqqr5GpsweOnEHW4w200sMRD40u8qmGHrqirihL2KrwTD6A9UObvA5AxZ
36
36
  4Z4EPvKg+3jsK9Gv3GGSLdrD
37
37
  -----END CERTIFICATE-----
38
- date: 2022-05-04 00:00:00.000000000 Z
38
+ date: 2022-08-10 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: chronic_cron
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.2.22
106
+ rubygems_version: 3.3.7
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: 'Parses a calendar event for date, time, and description e.g. hall 2 friday
metadata.gz.sig CHANGED
Binary file