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])
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()