def annotated_as_aux(self): """ Tell auxiliary 'have' apart from regular 'have' because one of them forms contractions and the other doens't. """ lemma = annotate_as_aux(self.lemma) nonpast = map(annotate_as_aux, self.nonpast) past = map(annotate_as_aux, self.past) return Verb(lemma, self.pres_part, self.past_part, nonpast, past)
def maybe_annotate_as_aux(self, s): if s in ['have', 'has', 'had']: return annotate_as_aux(s) else: return s
def default(): p = ContractionTableParser() pairs = set() pairs.update(p.parse_table(""" am are is I x - - you - x - he - - x she - - x it - - x we - x - they - x - """)) pairs.update(p.parse_table(""" AUX_HAVE AUX_HAS AUX_HAD I x - x you x - x he - x x she - x x it - x x we x - x they x - x """)) pairs.update(p.parse_table(""" will would I x x you x x he x x she x x it x x we x x they x x """)) pairs.update(p.parse_table(""" is AUX_HAVE did this - - - that x - - here x - - there x - - what x x - where x x x when x - - why x - x how x x x """)) pairs.update(p.parse_table(""" not am - are x is x was x were x AUX_HAVE x AUX_HAS x AUX_HAD x do x does x did x """)) pairs.update(p.parse_table(""" AUX_HAVE not can - x could x x may - - might x - must x x should x x would x x will - ! """)) bigrams_to_contract = pairs bigram2exception = { ('will', 'not'): "won't", ('it', POSSESSIVE_MARK): 'its', } last2contract = { annotate_as_aux('has'): Contract.IF_NOT_S_SOUND, 'is': Contract.IF_NOT_S_SOUND, 'will': Contract.ALWAYS, 'would': Contract.ALWAYS, } last2contraction = p.parse_dict(""" am 'm are 're is 's AUX_HAVE 've AUX_HAS 's AUX_HAD 'd did 'd not n't will 'll would 'd """) return BigramContractionManager( bigram2exception, bigrams_to_contract, last2contract, last2contraction)
def __init__(self): self.fake2real = { 'AUX_HAVE': annotate_as_aux('have'), 'AUX_HAS': annotate_as_aux('has'), 'AUX_HAD': annotate_as_aux('had'), }
def default(): p = ContractionTableParser() pairs = set() pairs.update( p.parse_table(""" am are is I x - - you - x - he - - x she - - x it - - x we - x - they - x - """)) pairs.update( p.parse_table(""" AUX_HAVE AUX_HAS AUX_HAD I x - x you x - x he - x x she - x x it - x x we x - x they x - x """)) pairs.update( p.parse_table(""" will would I x x you x x he x x she x x it x x we x x they x x """)) pairs.update( p.parse_table(""" is AUX_HAVE did this - - - that x - - here x - - there x - - what x x - where x x x when x - - why x - x how x x x """)) pairs.update( p.parse_table(""" not am - are x is x was x were x AUX_HAVE x AUX_HAS x AUX_HAD x do x does x did x """)) pairs.update( p.parse_table(""" AUX_HAVE not can - x could x x may - - might x - must x x should x x would x x will - ! """)) bigrams_to_contract = pairs bigram2exception = { ('will', 'not'): "won't", ('it', POSSESSIVE_MARK): 'its', } last2contract = { annotate_as_aux('has'): Contract.IF_NOT_S_SOUND, 'is': Contract.IF_NOT_S_SOUND, 'will': Contract.ALWAYS, 'would': Contract.ALWAYS, } last2contraction = p.parse_dict(""" am 'm are 're is 's AUX_HAVE 've AUX_HAS 's AUX_HAD 'd did 'd not n't will 'll would 'd """) return BigramContractionManager(bigram2exception, bigrams_to_contract, last2contract, last2contraction)