nickel 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
 
5
5
  desc 'Default: run unit tests.'
6
6
  task :default => :test
@@ -17,6 +17,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
17
17
  rdoc.rdoc_dir = 'rdoc'
18
18
  rdoc.title = 'Nlp'
19
19
  rdoc.options << '--line-numbers' << '--inline-source'
20
- rdoc.rdoc_files.include('README')
20
+ rdoc.rdoc_files.include('README.rdoc')
21
21
  rdoc.rdoc_files.include('lib/**/*.rb')
22
22
  end
@@ -277,7 +277,7 @@ module Nickel
277
277
  day_array << ZDate.days_of_week.index(@components[@pos+j])
278
278
  j += 1
279
279
  end
280
- @constructs << RecurrenceConstruct.new(:repeats => :threeweekly, :repeats_on => day_array, :comp_start => @pos, :comp_end => @pos += (j - i), :found_in => method_name)
280
+ @constructs << RecurrenceConstruct.new(:repeats => :threeweekly, :repeats_on => day_array, :comp_start => @pos, :comp_end => @pos += (j - 1), :found_in => method_name)
281
281
  end
282
282
 
283
283
  def match_every_3rd_day
data/lib/nickel/query.rb CHANGED
@@ -120,7 +120,7 @@ module Nickel
120
120
  nsub!(/next\s+occ?urr?[ae]nce(\s+is)?/,'start')
121
121
  nsub!(/next\s+date(\s+it)?(\s+occ?urr?s)?(\s+is)?/,'start')
122
122
  nsub!(/forever/,'repeats daily')
123
- nsub!(/\bany(?:\s+)?day\b/,'every day')
123
+ nsub!(/\bany(?:\s*)day\b/,'every day')
124
124
  nsub!(/^anytime$/,'every day') # user entered anytime by itself, not 'dayname anytime', caught next
125
125
  nsub!(/any(\s)?time|whenever/,'all day')
126
126
  end
@@ -141,7 +141,7 @@ module Nickel
141
141
  nsub!(/thurdsay/,'thu')
142
142
  nsub!(/thursady/,'thu')
143
143
  nsub!(/\bthurd?\b/,'thu')
144
- nsub!(/\bthurd?\b/,'thu')
144
+ nsub!(/\bthurs?d?\b/,'thu')
145
145
  nsub!(/fridays/,'every fri')
146
146
  nsub!(/firdays/,'every fri')
147
147
  nsub!(/friday/,'fri')
@@ -377,8 +377,8 @@ module Nickel
377
377
  end
378
378
 
379
379
  def standardize_am_pm
380
- nsub!(/([0-9])(?:\s+)?a\b/,'\1am') # allows 5a as 5am
381
- nsub!(/([0-9])(?:\s+)?p\b/,'\1pm') # allows 5p as 5pm
380
+ nsub!(/([0-9])(?:\s*)a\b/,'\1am') # allows 5a as 5am
381
+ nsub!(/([0-9])(?:\s*)p\b/,'\1pm') # allows 5p as 5pm
382
382
  nsub!(/\s+am\b/,'am') # removes any spaces before am, shouldn't I check for preceeding digits?
383
383
  nsub!(/\s+pm\b/,'pm') # removes any spaces before pm, shouldn't I check for preceeding digits?
384
384
  end
@@ -631,7 +631,7 @@ module Nickel
631
631
  nsub!(/^(through|until)/,'today through') # ^through => today through
632
632
  nsub!(/every\s*(night|morning)/,'every day')
633
633
  nsub!(/tonight/,'today')
634
- nsub!(/this(?:\s+)?morning/,'today')
634
+ nsub!(/this(?:\s*)morning/,'today')
635
635
  nsub!(/before\s+12pm/,'6am to 12pm') # arbitrary
636
636
 
637
637
  # Handle 'THE' Cases
@@ -646,7 +646,7 @@ module Nickel
646
646
  # Every first sunday of the month and the last tuesday => repeats monthly first sunday xxxxxxxxx repeats monthly last tuesday xxxxxxx
647
647
  nsub!(/every\s+#{WEEK_OF_MONTH}\s+#{DAY_OF_WEEK}\s+of\s+(?:the\s+)?month((?:.*)and\s+(?:the\s+)?#{WEEK_OF_MONTH}\s+#{DAY_OF_WEEK}(?:.*))/) do |m1,m2,m3|
648
648
  ret_str = " repeats monthly " + m1 + " " + m2 + " "
649
- ret_str << m3.gsub(/and\s+(?:the\s+)?#{WEEK_OF_MONTH}\s+#{DAY_OF_WEEK}(?:\s+)?(?:of\s+)?(?:the\s+)?(?:month\s+)?/, ' repeats monthly \1 \2 ')
649
+ ret_str << m3.gsub(/and\s+(?:the\s+)?#{WEEK_OF_MONTH}\s+#{DAY_OF_WEEK}(?:\s*)(?:of\s+)?(?:the\s+)?(?:month\s+)?/, ' repeats monthly \1 \2 ')
650
650
  end
651
651
 
652
652
  # The x through the y of oct z => 10/x/z through 10/y/z
@@ -746,7 +746,7 @@ module Nickel
746
746
  # we are not going to do date calculations here anymore, so instead:
747
747
  # next friday to|until|through the following tuesday" --> next friday through tuesday
748
748
  # next friday and the following sunday --> next friday and sunday
749
- nsub!(/next\s+#{DAY_OF_WEEK}\s+(to|until|through|and)\s+(?:the\s+)?(?:following|next)?(?:\s+)?#{DAY_OF_WEEK}/) do |m1,m2,m3|
749
+ nsub!(/next\s+#{DAY_OF_WEEK}\s+(to|until|through|and)\s+(?:the\s+)?(?:following|next)?(?:\s*)#{DAY_OF_WEEK}/) do |m1,m2,m3|
750
750
  connector = (m2 =~ /and/ ? ' ' : ' through ')
751
751
  "next " + m1 + connector + m3
752
752
  end
@@ -757,7 +757,7 @@ module Nickel
757
757
  # No longer performing date calculation
758
758
  # this friday and the following monday --> fri mon
759
759
  # this friday through the following tuesday --> fri through tues
760
- nsub!(/(?:this\s+)?#{DAY_OF_WEEK}\s+(to|until|through|and)\s+(?:the\s+)?(?:this|following)(?:\s+)?#{DAY_OF_WEEK}/) do |m1,m2,m3|
760
+ nsub!(/(?:this\s+)?#{DAY_OF_WEEK}\s+(to|until|through|and)\s+(?:the\s+)?(?:this|following)(?:\s*)#{DAY_OF_WEEK}/) do |m1,m2,m3|
761
761
  connector = (m2 =~ /and/ ? ' ' : ' through ')
762
762
  m1 + connector + m3
763
763
  end
@@ -769,7 +769,7 @@ module Nickel
769
769
  nsub!(/(#{DAY_OF_WEEK}\s+and\s+#{DAY_OF_WEEK})(?:\s+and)?/,'\2 \3')
770
770
 
771
771
  # "mon wed every week" --> every mon wed
772
- nsub!(/((#{DAY_OF_WEEK}(?:\s+)?){1,7})(?:of\s+)?(?:every|each)(\s+other)?\s+week/,'every \4 \1')
772
+ nsub!(/((#{DAY_OF_WEEK}(?:\s*)){1,7})(?:of\s+)?(?:every|each)(\s+other)?\s+week/,'every \4 \1')
773
773
 
774
774
  # "every 2|3 weeks" --> every 2nd|3rd week
775
775
  nsub!(/(?:repeats\s+)?every\s+(2|3)\s+weeks/) {|m1| "every " + m1.to_i.ordinalize + " week"}
@@ -998,7 +998,7 @@ module Nickel
998
998
  nsub!(/in\s+(an?|[0-9]+)\s+(hour|minute)s?/, '\1 \2 from now')
999
999
 
1000
1000
  # Now only
1001
- nsub!(/^(?:\s+)?(?:right\s+)?now(?:\s+)?$/, '0 minutes from now')
1001
+ nsub!(/^(?:\s*)(?:right\s+)?now(?:\s*)$/, '0 minutes from now')
1002
1002
 
1003
1003
  # "a week/month from yesterday|tomorrow" --> 1 week from yesterday|tomorrow
1004
1004
  nsub!(/(?:(?:a|1)\s+)?(week|month)\s+from\s+(yesterday|tomorrow)/,'1 \1 from \2')
@@ -1047,7 +1047,7 @@ module Nickel
1047
1047
  # "on the last day of nov" --> "last day nov"
1048
1048
  nsub!(/(?:\bon\s+)?(?:the\s+)?last\s+day\s+(?:of\s+)?(?:in\s+)?#{MONTH_OF_YEAR}/,'last day \1')
1049
1049
  # "on the 1st|last day of this|the month" --> "1st|last day this month"
1050
- nsub!(/(?:\bon\s+)?(?:the\s+)?(1st|last)\s+day\s+(?:of\s+)?(?:this|the)?(?:\s+)?month/,'\1 day this month')
1050
+ nsub!(/(?:\bon\s+)?(?:the\s+)?(1st|last)\s+day\s+(?:of\s+)?(?:this|the)?(?:\s*)month/,'\1 day this month')
1051
1051
  # "on the 1st|last day of next month" --> "1st|last day next month"
1052
1052
  nsub!(/(?:\bon\s+)?(?:the\s+)?(1st|last)\s+day\s+(?:of\s+)?next\s+month/,'\1 day next month')
1053
1053
 
data/nickel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "nickel"
3
- s.version = "0.0.5"
3
+ s.version = "0.0.6"
4
4
  s.summary = "Natural language date, time, and message parsing."
5
5
  s.email = "lzell11@gmail.com"
6
6
  s.homepage = "http://github.com/lzell/nickel"
metadata CHANGED
@@ -1,33 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: nickel
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 5
10
- version: 0.0.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Lou Zell
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-03-18 00:00:00 -07:00
19
- default_executable:
12
+ date: 2012-11-20 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
14
  description: Extracts date, time, and message information from naturally worded text.
23
15
  email: lzell11@gmail.com
24
16
  executables: []
25
-
26
17
  extensions: []
27
-
28
- extra_rdoc_files:
18
+ extra_rdoc_files:
29
19
  - README.rdoc
30
- files:
20
+ files:
31
21
  - History.txt
32
22
  - License.txt
33
23
  - README.rdoc
@@ -52,42 +42,32 @@ files:
52
42
  - test/zdate_test.rb
53
43
  - test/ztime_test.rb
54
44
  - spec/nickel_spec.rb
55
- has_rdoc: true
56
45
  homepage: http://github.com/lzell/nickel
57
46
  licenses: []
58
-
59
47
  post_install_message:
60
- rdoc_options:
48
+ rdoc_options:
61
49
  - --main
62
50
  - README.rdoc
63
51
  - --title
64
52
  - Nickel
65
- require_paths:
53
+ require_paths:
66
54
  - lib
67
- required_ruby_version: !ruby/object:Gem::Requirement
55
+ required_ruby_version: !ruby/object:Gem::Requirement
68
56
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
76
- required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
62
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
- - 0
84
- version: "0"
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
85
67
  requirements: []
86
-
87
68
  rubyforge_project:
88
- rubygems_version: 1.5.2
69
+ rubygems_version: 1.8.23
89
70
  signing_key:
90
71
  specification_version: 3
91
72
  summary: Natural language date, time, and message parsing.
92
73
  test_files: []
93
-