Package DateHandler :: Module _Date_pt :: Class DateParserPT
[frames] | no frames]

Class DateParserPT

source code


Instance Methods
 
init_strings(self)
This method compiles regular expression strings for matching dates.
source code

Inherited from _DateParser.DateParser: __init__, invert_year, match_bce, match_calendar, match_modifier, match_quality, match_range, match_span, parse, re_longest_first, set_date

Class Variables
  modifier_to_int = {u'ant': 1, u'ant.': 1, u'antes': 1, u'antes...
  calendar_to_int = {u'g': 0, u'gregoriano': 0, u'h': 2, u'hebre...
  quality_to_int = {u'calc': 2, u'calc.': 2, u'calculado': 2, u'...

Inherited from _DateParser.DateParser: bce, french_to_int, hebrew_to_int, islamic_to_int, modifier_after_to_int, month_to_int, persian_to_int

Method Details

init_strings(self)

source code 

This method compiles regular expression strings for matching dates.

Most of the re's in most languages can stay as is. span and range most likely will need to change. Whatever change is done, this method may be called first as DateParser.init_strings(self) so that the invariant expresions don't need to be repeteadly coded. All differences can be coded after DateParser.init_strings(self) call, that way they override stuff from this method. See DateParserRU() as an example.

Overrides: _DateParser.DateParser.init_strings
(inherited documentation)

Class Variable Details

modifier_to_int

Value:
{u'ant': 1,
 u'ant.': 1,
 u'antes': 1,
 u'antes de': 1,
 u'apr': 3,
 u'apr.': 3,
 u'aprox': 3,
 u'aprox.': 3,
...

calendar_to_int

Value:
{u'g': 0,
 u'gregoriano': 0,
 u'h': 2,
 u'hebreu': 2,
 u'i': 5,
 u'islâmico': 5,
 u'j': 1,
 u'juliano': 1,
...

quality_to_int

Value:
{u'calc': 2,
 u'calc.': 2,
 u'calculado': 2,
 u'est': 1,
 u'est.': 1,
 u'estimado': 1}