示例#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()