Beispiel #1
0
def load_adjs(file):
    items = []

    with open(file, 'r') as fp:
        for line in fp:
            if line[0] == '#': continue
            fs = line.rstrip().split()
            if len(fs) == 5:
                args = (fs[0],
                        fs[1].decode('utf-8'),
                        fs[2].decode('utf-8'),
                        fs[3].decode('utf-8'),
                        fs[4])
            elif len(fs) == 3:
                nom_sg_m = fs[1].decode('utf-8')
                stem = nom_sg_m[:-2]
                args = (fs[0],
                        stem + u'us',
                        stem + u'a',
                        stem + u'um',
                        fs[2])
            else:
                continue

            table = decline_adj(*args)
            if table is not None and len(table) > 0:
                items += util.aggregate_cases(table)

    return items
Beispiel #2
0
def pronominal_adjectives():
    items = []
    items += decline_pronominal_adjective((u'alius', u'alia', u'aliud'), '他の')
    items += decline_pronominal_adjective((u'tōtus', u'tōta', u'tōtum'), '全体の')
    items += decline_pronominal_adjective((u'ūnus', u'ūna', u'ūnum'), 'ひとつの') #数詞でもある
    items += decline_pronominal_adjective((u'sōlus', u'sōla', u'sōlum'), '唯一の')
    items += decline_pronominal_adjective((u'ūllus', u'ūlla', u'ūllum'), 'どれかひとつの') #any
    items += decline_pronominal_adjective((u'nūllus', u'nūlla', u'nūllum'), 'ひとつも...ない')
    items += decline_pronominal_adjective((u'alter', u'altera', u'alterum'), '(2つのうち)どれか一方の')
    items += decline_pronominal_adjective((u'uter', u'utra', u'utrum'), '(2つのうち)どちらの?,(2つのうち)どちらかの')
    items += decline_pronominal_adjective((u'neuter', u'neutra', u'neutrum'), '(2つのうち)どちらも...ない')

    items += decline(u'', {},
                     [u'nihil', u'nihil', (u'nūllīus reī', u'nihilī'), u'nūllī reī', (u'nūllā rē', u'nihilō')],
                     latin_noun.case_tags_5x2[:5],
                     {'pos':'pronoun', 'gender':'n', 'ja':'なにも...ない'}) # nothing
    items += decline(u'', {},
                     [u'nēmō', u'nēminem', u'nūllīus', u'nēminī', u'nūllō'],
                     latin_noun.case_tags_5x2[:5],
                     {'pos':'pronoun', 'gender':'m', 'ja':'だれも...ない'}) # no one, nobody
    items += decline(u'', {},
                     [u'nēmō', u'nēminem', u'nūllīus', u'nēminī', u'nūllō'],
                     latin_noun.case_tags_5x2[:5],
                     {'pos':'pronoun', 'gender':'f', 'ja':'だれも...ない'}) # no one, nobody
    # util.pp(items)
    return util.aggregate_cases(items)
Beispiel #3
0
def load_nouns(file):
    items = []

    with open(file, 'r') as fp:
        for line in fp:
            # print line[0],
            if len(line) == 0: continue
            if line[0] == '#': continue

            fs = line.rstrip().split()
            if len(fs) == 4:
                args = (fs[0], # type
                        fs[1].decode('utf-8'), # nom_sg
                        None, # gen_sg
                        fs[2], # gender,
                        fs[3]) # ja
            elif len(fs) == 5:
                args = (fs[0], # type
                        fs[1].decode('utf-8'), # nom_sg
                        fs[2].decode('utf-8'), # gen_sg
                        fs[3], # gender
                        fs[4]) # ja
            else:
                continue

            table = decline_noun(*args)
            if table is not None and len(table) > 0:
                items += util.aggregate_cases(table)

    return items
Beispiel #4
0
def meus():
    items = []
    # 所有形容詞
    items += latin_adj.decline_adj_type1(u'meus', u'mea', \
                                             {'ja':'私の', 'base':u'meus', 'desc':'所有形容詞'}, False)
    items += latin_adj.decline_adj_type1(u'noster', u'nostra', \
                                             {'ja':'私たちの', 'base':u'noster', 'desc':'所有形容詞'}, False)
    items += latin_adj.decline_adj_type1(u'tuus', u'tua', \
                                             {'ja':'あなたの', 'base':u'tuus', 'desc':'所有形容詞'}, False)
    items += latin_adj.decline_adj_type1(u'vester', u'vestra', \
                                             {'ja':'あなたたちの', 'base':u'vester', 'desc':'所有形容詞'}, False)

    items = util.remove_matched_items(items, {'surface':u'mee'})
    items += [{'case':'Voc', 'number':'sg', 'gender':'m', 'base':u'meus', 'surface':u'mī', 'ja':'私の', 'desc':'所有形容詞'}]

    return util.aggregate_cases(items)
Beispiel #5
0
def quidam():
    items = []
    # pronoun.
    common_tags = {'pos':'pronoun', 'ja':'或る(人,物)', 'desc':'不定代名詞', 'base':u'quīdam'}
    forms = [u'quīdam', u'quendam', u'cūjusdam', u'cuīdam', u'quōdam',
             u'quīdam', u'quōsdam', u'quōrundam', u'quibusdam', u'quibusdam']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'m'})
    forms = [u'quaedam', u'quandam', u'cūjusdam', u'cuīdam', u'quādam',
             u'quaedam', u'quāsdam', u'quārundam', u'quibusdam', u'quibusdam']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'f'})
    forms = [u'quiddam', u'quiddam', u'cūjusdam', u'cuīdam', u'quōdam',
             u'quīdam', u'quōsdam', u'quōrundam', u'quibusdam', u'quibusdam']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'n'})
    # quiddam<代名詞> -> quoddam<形容詞>

    return util.aggregate_cases(items)
Beispiel #6
0
def qui():
    items = []

    # 名詞とともに関係形容詞 (which) or 疑問形容詞 (what, which, what kind of) としても用いられる
    common_tags = {'pos':'pronoun', 'ja':'各人(の)', 'desc':'関係代名詞', 'base':u'quī'}
    forms = [u'quī', u'quem', u'cūjus', u'cuī', u'quō',
             u'quī', u'quōs', u'quōrum', u'quibus', u'quibus']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'m'})
    forms = [u'quae', u'quam', u'cūjus', u'cuī', u'quā',
             u'quae', u'quās', u'quārum', u'quibus', u'quibus']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'f'})
    forms = [u'quod', u'quod', u'cūjus', u'cuī', u'quō',
             u'quae', u'quae', u'quōrum', u'quibus', u'quibus']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'n'})

    return util.aggregate_cases(items)
Beispiel #7
0
def quis():
    items = []
    # 疑問形容詞は関係代名詞と同じであるが、quisが疑問形容詞として用いられることもある
    common_tags = {'pos':'pronoun', 'ja':'誰が', 'desc':'疑問代名詞', 'base':u'quis'}
    forms = [u'quis', u'quem', u'cūjus', u'cuī', u'quō',
             u'quī', u'quōs', u'quōrum', u'quibus', u'quibus']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'m'})
    forms = [u'quis', u'quem', u'cūjus', u'cuī', u'quā',
             u'quae', u'quās', u'quārum', u'quibus', u'quibus']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2, {'gender':'f'})

    common_tags = {'pos':'pronoun', 'ja':'何が', 'desc':'疑問代名詞', 'base':u'quid', 'gender':'n'}
    forms = [u'quid', u'quid', u'cūjus', u'cuī', u'quō',
             u'quae', u'quae', u'quōrum', u'quibus', u'quibus']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    return util.aggregate_cases(items)
Beispiel #8
0
def quisque():
    items = []
    # pronoun.
    common_tags = {'pos':'pronoun', 'ja':'各人(の)', 'desc':'不定代名詞', 'base':u'quisque'}
    forms = [u'quisque', u'quemque', u'cūjusque', u'cuīque', u'quōque'] # m,f
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5sg, {'gender':'m'})
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5sg, {'gender':'f'})
    forms = [u'quidque', u'quidque', u'cūjusque', u'cuīque', u'quōque'] # n
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5sg, {'gender':'n'})
    # adj.
    common_tags = {'pos':'adj', 'ja':'各人(の)', 'desc':'不定形容詞', 'base':u'quisque'}
    forms = [u'quīque', u'quemque', u'cūjusque', u'cuīque', u'quōque']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5sg, {'gender':'m'})
    forms = [u'quaeque', u'quamque', u'cūjusque', u'cuīque', u'quāque']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5sg, {'gender':'f'})
    forms = [u'quodque', u'quodque', u'cūjusque', u'cuīque', u'quōque']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5sg, {'gender':'n'})

    return util.aggregate_cases(items)
Beispiel #9
0
def ego():
    items = []

    # 一人称
    common_tags = {'pos':'pronoun', 'person':1, 'gender':'m', 'ja':'私', 'desc':'人称代名詞'} # genderは仮
    forms = [u'ego', u'mē', u'meī', u'mihi', u'mē',
             u'nōs', u'nōs', u'nostrī', u'nōbīs', u'nōbīs']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)
    items += [util.aggregate_dicts({'surface':u'mihī'}, common_tags, latin_noun.case_tags_5x2[3])]
    items += [util.aggregate_dicts({'surface':u'nostrum'}, common_tags, latin_noun.case_tags_5x2[7])]

    # 二人称
    common_tags = {'pos':'pronoun', 'person':2, 'gender':'m', 'ja':'あなた', 'desc':'人称代名詞'}
    forms = [u'tū', u'tē', u'tuī', u'tibi', u'tē',
             u'vōs', u'vōs', u'vestrī', u'vōbīs', u'vōbīs']
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)
    items += [util.aggregate_dicts({'surface':u'tibī'}, common_tags, latin_noun.case_tags_5x2[3])]
    items += [util.aggregate_dicts({'surface':u'vestrum'}, common_tags, latin_noun.case_tags_5x2[7])]

    return util.aggregate_cases(items)
Beispiel #10
0
def is_ea_id():
    items = []

    common_tags = {'pos':'pronoun', 'person':3, 'ja':'その,それ', 'desc':'指示代名詞'}

    forms = [u'is', u'eum', u'ējus', u'eī', u'eō',
             (u'eī',u'iī',u'ī'), u'eōs', u'eōrum', (u'eīs',u'iīs',u'īs'), (u'eīs',u'iīs',u'īs')]
    common_tags['gender'] = 'm'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'ea', u'eam', u'ējus', u'eī', u'eā',
             u'eae', u'eās', u'eārum', (u'eīs',u'iīs',u'īs'), (u'eīs',u'iīs',u'īs')]
    common_tags['gender'] = 'f'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'id', u'id', u'ējus', u'eī', u'eō',
             u'ea', u'ea', u'eōrum', (u'eīs',u'iīs',u'īs'), (u'eīs',u'iīs',u'īs')]
    common_tags['gender'] = 'n'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    return util.aggregate_cases(items)
Beispiel #11
0
def ipse():
    items = []

    common_tags = {'pos':'pronoun', 'person':3, 'ja':'(それ)自身', 'desc':'強意代名詞'}

    forms = [u'ipse', u'ipsum', u'ipsīus', u'ipsī', u'ipsō',
             u'ipsī', u'ipsōs', u'ipsōrum', u'ipsīs', u'ipsīs']
    common_tags['gender'] = 'm'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'ipsa', u'ipsam', u'ipsīus', u'ipsī', u'ipsā',
             u'ipsae', u'ipsās', u'ipsārum', u'ipsīs', u'ipsīs']
    common_tags['gender'] = 'f'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'ipsum', u'ipsum', u'ipsīus', u'ipsī', u'ipsō',
             u'ipsa', u'ipsa', u'ipsōrum', u'ipsīs', u'ipsīs']
    common_tags['gender'] = 'n'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    return util.aggregate_cases(items)
Beispiel #12
0
def idem():
    items = []

    common_tags = {'pos':'pronoun', 'person':3, 'ja':'同じ', 'desc':'指示代名詞'}

    forms = [u'īdem', u'eundem', u'ējusdem', u'eīdem', u'eōdem',
             u'iīdem', u'eōsdem', u'eōrundem', u'iīsdem', u'iīsdem']
    common_tags['gender'] = 'm'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'eadem', u'eandem', u'ējusdem', u'eīdem', u'eādem',
             u'eaedem', u'eāsdem', u'eārundem', u'iīsdem', u'iīsdem']
    common_tags['gender'] = 'f'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'idem', u'idem', u'ējusdem', u'eīdem', u'eōdem',
             u'eadem', u'eadem', u'eōrundem', u'iīsdem', u'iīsdem']
    common_tags['gender'] = 'n'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    return util.aggregate_cases(items)
Beispiel #13
0
def ille():
    items = []

    common_tags = {'pos':'pronoun', 'person':3, 'ja':'あの,あれ', 'desc':'指示代名詞'}

    forms = [u'ille', u'illum', u'illīus', u'illī', u'illō',
             u'illī', u'illōs', u'illōrum', u'illīs', u'illīs']
    common_tags['gender'] = 'm'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'illa', u'illam', u'illīus', u'illī', u'illā',
             u'illae', u'illās', u'illārum', u'illīs', u'illīs']
    common_tags['gender'] = 'f'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'illud', u'illud', u'illīus', u'illī', u'illō',
             u'illa', u'illa', u'illōrum', u'illīs', u'illīs']
    common_tags['gender'] = 'n'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    return util.aggregate_cases(items)
Beispiel #14
0
def hic():
    items = []

    common_tags = {'pos':'pronoun', 'person':3, 'ja':'この,これ', 'desc':'指示代名詞'}

    forms = [u'hīc', u'hunc', u'hūjus', u'huīc', u'hōc',
             u'hī', u'hōs', u'hōrum', u'hīs', u'hīs']
    common_tags['gender'] = 'm'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'haec', u'hanc', u'hūjus', u'huīc', u'hāc',
             u'hae', u'hās', u'hārum', u'hīs', u'hīs']
    common_tags['gender'] = 'f'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    forms = [u'hoc', u'hoc', u'hūjus', u'huīc', u'hōc',
             u'haec', u'haec', u'hōrum', u'hīs', u'hīs']
    common_tags['gender'] = 'n'
    items += decline(u'', common_tags, forms, latin_noun.case_tags_5x2)

    return util.aggregate_cases(items)
Beispiel #15
0
def conjugate_participle(pres_stem, supinum, tags={}):
    items = []

    jas = tags.get('ja', '').split(',')
    javs = map(JaVerb, jas)
    def forms(flag):
        return ','.join([jav.form(flag) for jav in javs])

    # 現在分詞
    # prūdēns型; 〜しつつある
    nom_sg_m = pres_stem + u'ns'
    if pres_stem[-1] == u'ā':
        gen_sg = pres_stem[:-1] + u'antis'
    elif pres_stem == u'iē':
        gen_sg = u'euntis'
    else: # pres_stem[-1] = 'ē'
        gen_sg = pres_stem[:-1] + u'entis'
    items += latin_adj.decline_adj_type2(nom_sg_m, gen_sg, '-',
                                         util.aggregate_dicts(tags, {'pos':'participle', 'tense':'present',
                                                                     'ja':forms(Verb.PARTICIPLE_PRESENT)}))
    # 未来分詞
    if supinum == 'es##':
        nom_sg_m = supinum[:-2] + u'urus'
    else:
        nom_sg_m = supinum[:-2] + u'ūrus'
    nom_sg_f = nom_sg_m[:-2] + u'a'
    items += latin_adj.decline_adj_type1(nom_sg_m, nom_sg_f,
                                         util.aggregate_dicts(tags, {'pos':'participle', 'tense':'future',
                                                                     'ja':forms(Verb.PARTICIPLE_FUTURE)}))

    # 完了分詞
    nom_sg_m = supinum[:-2] + u'us'
    nom_sg_f = nom_sg_m[:-2] + u'a'
    items += latin_adj.decline_adj_type1(nom_sg_m, nom_sg_f,
                                         util.aggregate_dicts(tags, {'pos':'participle', 'tense':'past',
                                                                     'ja':forms(Verb.PARTICIPLE_PERFECT)}))

    return util.aggregate_cases(items)