Module: Datte
- Defined in:
- lib/datte/train.rb,
lib/datte/parser.rb,
lib/datte/version.rb,
lib/datte/dattetime.rb,
lib/datte/date_parser.rb,
lib/datte/datetime_table.rb,
lib/datte/text_converter.rb
Defined Under Namespace
Classes: DateParser, DatetimeTable, Dattetime, Parser, TextConverter, Train
Constant Summary collapse
- VERSION =
"0.5.1"
- MATCHER =
[ /(?<year>\d{1,4})\/(?<month>\d{1,2})\/(?<day>\d{1,2})/, /(?<month>\d{1,2})\/(?<day>\d{1,2})/ ].freeze
- ABSOLUTE_DATES =
[ # <year>-<month>-<day> '(?<year>\d{1,4})-(?<month>\d{1,2})-(?<day>\d{1,2})', # <year>/<month>/<day> '(?<year>\d{1,4})\/(?<month>\d{1,2})\/(?<day>\d{1,2})', # <year>年<month>月<day>日 '(?<year>\d{1,4})年(?<month>\d{1,2})月(?<day>\d{1,2})日', # <month>-<day> '(?<month>\d{1,2})-(?<day>\d{1,2})', # <month>/<day> '(?<month>\d{1,2})\/(?<day>\d{1,2})', # <month>月<day>日 '(?<month>\d{1,2})月(?<day>\d{1,2})日', # <month>月 '(?<month>\d{1,2})月', # <day>日 '(?<day>\d{1,2})日' ].map { |pattern| Regexp.compile(pattern) }.freeze
- ABSOLUTE_TIMES =
[ # <hour>-<min> '(?<hour>\d{1,2})-(?<min>\d{1,2})', # <hour>:<min> '(?<hour>\d{1,2}):(?<min>\d{1,2})', # <hour>時<min>分, '(?<hour>\d{1,2})時(?<min>\d{1,2})分', # <hour>時 '(?<hour>\d{1,2})時', # <min>分 '(?<min>\d{1,2})分' ].map { |pattern| Regexp.compile(pattern) }.freeze
- NOUNS =
{ '明日|あした|あす': 'send(:next_day, 1)', '明後日|あさって': 'send(:next_day, 2)', '明々後日|しあさって': 'send(:next_day, 3)', '今日|きょう': 'send(:next_day, 0)' }
- AFTERS =
[ # 何年後 '(?<year>\d{1)年後', # 何ヶ月後 '(?<month>\d{1,2}ヶ月後)', # 何日後 '(?<day>\d{1,2})日後', # 何時間後 '(?<hour>\d{1,2})時間後', # 何分後 '(?<min>\d{1,2})分後' ].map { |pattern| Regexp.compile(pattern) }.freeze