Ejemplo n.º 1
0
    def __init__(self):
        # Correlative -> count restriction, grammatical number override.
        C = Correlative
        R = CountRestriction
        self.cor2res_gno = {
            C.INDEF: (R.SOME, None),
            C.DEF: (R.ALL, None),
            C.INTR: (R.ANY, None),
            C.PROX: (R.ALL, None),
            C.DIST: (R.ALL, None),
            C.EXIST: (R.ONE_OF_PLURAL, None),
            C.ELECT_ANY: (R.SOME, None),
            C.ELECT_EVER: (R.ANY, None),
            C.UNIV_EVERY: (R.ALL, N2.SING),
            C.UNIV_ALL: (R.ALL, N2.PLUR),
            C.NEG: (R.NONE, None),
            C.ALT: (R.ONE_OF_PLURAL, None),
        }

        # (Correlative, is pronoun, is plural, out of N5) -> word.
        self.cor_pro_plur_of2s = make_det_pronoun_table()

        # Word -> list of Selectors.
        self.determiner2selectors = defaultdict(list)
        self.pronoun2selectors = defaultdict(list)
        s2cors_pros_plurs_ofs = v2kk_from_k2v(self.cor_pro_plur_of2s)
        for s, aaa in s2cors_pros_plurs_ofs.iteritems():
            dets, pros = combine_entries(aaa, self.cor2res_gno)
            self.determiner2selectors[s] = dets
            self.pronoun2selectors[s] = pros
Ejemplo n.º 2
0
    def __init__(self):
        # Correlative, ProAdverbColumn -> tokens, is_archaic.
        self.cor_pac2ss_archaic = make_pro_adverb_table()

        # Tokens, is_archaic -> list of (Correlative, ProAdverbColumn).
        self.ss_archaic2cors_pacs = v2kk_from_k2v(self.cor_pac2ss_archaic)

        # Noun -> preposition to hallucinate.
        self.noun2hallucinate_prep = {
            'place': (PLACE_PREP, ),
            'reason': (REASON_PREP, ),
            'time': (TIME_PREP, ),
            'way': (WAY_PREP, ),
        }

        # Correlative -> (count restriction if possible, grammatical number
        # override if any).
        C = Correlative
        R = CountRestriction
        self.cor2res_gno = {
            C.INDEF: (None, None),
            C.DEF: (None, None),
            C.INTR: (R.ALL_ONE, None),
            C.PROX: (R.ALL_ONE, None),
            C.DIST: (R.ALL_ONE, None),
            C.EXIST: (R.ONE_OF_PLURAL, None),
            C.ELECT_ANY: (R.ONE_OF_PLURAL, None),
            C.ELECT_EVER: (R.ALL_ONE, None),
            C.UNIV_EVERY: (R.ALL, N2.SING),
            C.UNIV_ALL: (R.ALL, N2.SING),
            C.NEG: (R.NONE, N2.SING),
            C.ALT: (R.ONE_OF_PLURAL, None),
        }

        # Noun -> pro-adverb columns.
        C = ProAdverbColumn
        self.noun2pro_adverb_cols = defaultdict(
            list, {
                'person': [C.ONE, C.BODY],
                'thing': [C.THING],
                'place': [C.PLACE],
                'source': [C.SOURCE, C.SOURCE_FROM],
                'goal': [C.GOAL],
                'time': [C.TIME],
                'way': [C.WAY, C.WAY_BY],
                'reason': [C.REASON, C.REASON_FORE, C.REASON_LATIN],
            })

        # Pro-adverb column -> noun.
        self.pro_adverb_col2noun = v2k_from_k2vv(self.noun2pro_adverb_cols)
Ejemplo n.º 3
0
    def __init__(self):
        # Correlative, ProAdverbColumn -> tokens, is_archaic.
        self.cor_pac2ss_archaic = make_pro_adverb_table()

        # Tokens, is_archaic -> list of (Correlative, ProAdverbColumn).
        self.ss_archaic2cors_pacs = v2kk_from_k2v(self.cor_pac2ss_archaic)

        # Noun -> preposition to hallucinate.
        self.noun2hallucinate_prep = {
            'place': (PLACE_PREP,),
            'reason': (REASON_PREP,),
            'time':  (TIME_PREP,),
            'way': (WAY_PREP,),
        }

        # Correlative -> (count restriction if possible, grammatical number
        # override if any).
        C = Correlative
        R = CountRestriction
        self.cor2res_gno = {
            C.INDEF:      (None,            None),
            C.DEF:        (None,            None),
            C.INTR:       (R.ALL_ONE,       None),
            C.PROX:       (R.ALL_ONE,       None),
            C.DIST:       (R.ALL_ONE,       None),
            C.EXIST:      (R.ONE_OF_PLURAL, None),
            C.ELECT_ANY:  (R.ONE_OF_PLURAL, None),
            C.ELECT_EVER: (R.ALL_ONE,       None),
            C.UNIV_EVERY: (R.ALL,           N2.SING),
            C.UNIV_ALL:   (R.ALL,           N2.SING),
            C.NEG:        (R.NONE,          N2.SING),
            C.ALT:        (R.ONE_OF_PLURAL, None),
        }

        # Noun -> pro-adverb columns.
        C = ProAdverbColumn
        self.noun2pro_adverb_cols = defaultdict(list, {
            'person': [C.ONE, C.BODY],
            'thing':  [C.THING],
            'place':  [C.PLACE],
            'source': [C.SOURCE, C.SOURCE_FROM],
            'goal':   [C.GOAL],
            'time':   [C.TIME],
            'way':    [C.WAY, C.WAY_BY],
            'reason': [C.REASON, C.REASON_FORE, C.REASON_LATIN],
        })

        # Pro-adverb column -> noun.
        self.pro_adverb_col2noun = v2k_from_k2vv(self.noun2pro_adverb_cols)
Ejemplo n.º 4
0
    def __init__(self, dec_pc2ss):
        # (Declension, PersonalColumn) -> tokens.
        self.dec_pc2ss = dec_pc2ss

        # Tokens -> list of (Declension, PersonalColumn).
        self.ss2decs_pcs = v2kk_from_k2v(dec_pc2ss)
Ejemplo n.º 5
0
    def __init__(self, dec_pc2ss):
        # (Declension, PersonalColumn) -> tokens.
        self.dec_pc2ss = dec_pc2ss

        # Tokens -> list of (Declension, PersonalColumn).
        self.ss2decs_pcs = v2kk_from_k2v(dec_pc2ss)