Package DateHandler :: Module _Date_nb :: Class DateParserNb
[frames] | no frames]

Class DateParserNb

source code


Convert a text string into a Date object, expecting a date notation in the Norwegian language. If the date cannot be converted, the text string is assigned.

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'ca': 3, u'etter': 2, u'før': 1, u'innen':...
  bce = ['f Kr']
  calendar_to_int = {u'f': 3, u'fransk': 3, u'fransk republikans...
  quality_to_int = {u'beregnet': 2, u'estimert': 1}

Inherited from _DateParser.DateParser: 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'ca': 3, u'etter': 2, u'før': 1, u'innen': 1, u'omkring': 3}

calendar_to_int

Value:
{u'f': 3,
 u'fransk': 3,
 u'fransk republikansk': 3,
 u'g': 0,
 u'gregoriansk   ': 0,
 u'h': 2,
 u'hebraisk': 2,
 u'i': 5,
...