コード例 #1
0
ファイル: whenqa.py プロジェクト: lethain/mahou
def parse_year(s):
  years = filter(lambda t: len(t) == 4 and typechecks.is_int(t), text.uniques(s))
  if len(years) > 0: return text.norm(years[0])
コード例 #2
0
ファイル: whenqa.py プロジェクト: lethain/mahou
def parse_month(s):
  months = filter(lambda m: m is not None, map(month_lookup, text.uniques(s)))
  if len(months) > 0:
    return text.norm(months[0]).capitalize()