コード例 #1
0
    INFINITIVE, \
    PRESENT_1ST_PERSON_SINGULAR, \
    PRESENT_2ND_PERSON_SINGULAR, \
    PRESENT_3RD_PERSON_SINGULAR, \
    PRESENT_PLURAL, \
    PRESENT_PARTICIPLE, \
    PAST, \
    PAST_1ST_PERSON_SINGULAR, \
    PAST_2ND_PERSON_SINGULAR, \
    PAST_3RD_PERSON_SINGULAR, \
    PAST_PLURAL, \
    PAST_PARTICIPLE

# Load the pattern.en.Verbs class, with a Dutch lexicon instead.
# Lexicon was trained on CELEX and contains the top 2000 most frequent verbs.
_verbs = VERBS = Verbs(os.path.join(MODULE, "verbs.txt"), language="nl")

conjugate, lemma, lexeme, tenses = \
    _verbs.conjugate, _verbs.lemma, _verbs.lexeme, _verbs.tenses


def _parse_lemma(verb):
    """ Returns the base form of the given inflected verb, using a rule-based approach.
    """
    v = verb.lower()
    # Common prefixes: op-bouwen and ver-bouwen inflect like bouwen.
    for prefix in ("aan", "be", "her", "in", "mee", "ont", "op", "over", "uit",
                   "ver"):
        if v.startswith(prefix) and v[len(prefix):] in _verbs._lemmas:
            return prefix + _verbs._lemmas[v[len(prefix):]]
    # Present participle -end: hengelend, knippend.
コード例 #2
0
ファイル: __init__.py プロジェクト: borborygmi/pattern
    30,
    31,
    32,
    33,
    34,
    35  # subjuntivo imperfecto
]

DEFAULT = {}

# Load the pattern.en.Verbs class, with a Spanish lexicon instead.
# Lexicon was mined from the Web and contains 570 frequent verbs (290 regular -ar, -er, -ir):
# Spanish Verb Forms, F. F. Jehle (2012).
# http://users.ipfw.edu/jehle/verblist.htm
_verbs = VERBS = Verbs(os.path.join(MODULE, "verbs.txt"),
                       FORMAT,
                       DEFAULT,
                       language="es")

conjugate, lemma, lexeme, tenses = \
    _verbs.conjugate, _verbs.lemma, _verbs.lexeme, _verbs.tenses

verb_irregular_inflections = [
    (u"yéramos", "ir"),
    (u"cisteis", "cer"),
    (u"tuviera", "tener"),
    (u"ndieron", "nder"),
    (u"ndiendo", "nder"),
    (u"tándose", "tarse"),
    (u"ndieran", "nder"),
    (u"ndieras", "nder"),
    (u"izaréis", "izar"),
コード例 #3
0
ファイル: __init__.py プロジェクト: sp00/pattern
    INFINITIVE, \
    PRESENT_1ST_PERSON_SINGULAR, \
    PRESENT_2ND_PERSON_SINGULAR, \
    PRESENT_3RD_PERSON_SINGULAR, \
    PRESENT_PLURAL, \
    PRESENT_PARTICIPLE, \
    PAST, \
    PAST_1ST_PERSON_SINGULAR, \
    PAST_2ND_PERSON_SINGULAR, \
    PAST_3RD_PERSON_SINGULAR, \
    PAST_PLURAL, \
    PAST_PARTICIPLE

# Load the pattern.en.Verbs class, with a Dutch lexicon instead.
# Lexicon was trained on CELEX and contains the top 2000 most frequent verbs.
_verbs = VERBS = Verbs(path=os.path.join(MODULE, "verbs.txt"))
conjugate, lemma, lexeme, tenses = \
    _verbs.conjugate, _verbs.lemma, _verbs.lexeme, _verbs.tenses


def _parse_lemma(verb):
    """ Returns the base form of the given inflected verb, using a rule-based approach.
    """
    v = verb.lower()
    # Common prefixes: op-bouwen and ver-bouwen inflect like bouwen.
    for prefix in ("aan", "be", "her", "in", "ont", "op", "over", "uit",
                   "ver"):
        if v.startswith(prefix) and v[len(prefix):] in _verbs._lemmas:
            return prefix + _verbs._lemmas[v[len(prefix):]]
    # Present participle -end: hengelend, knippend.
    if v.endswith("end"):