예제 #1
0
파일: __init__.py 프로젝트: navtej/pattern
def lemma(word, pos="NN"):
    if pos == "NNS":
        return singularize(word)
    if pos.startswith(("VB", "MD")):
        return conjugate(word, "infinitive") or word
    if pos.startswith("JJ") and word.endswith("e"):
        return predicative(word)
    return word
예제 #2
0
def lemma(word, pos="NN"):
    if pos == "NNS":
        return singularize(word)
    if pos.startswith(("VB", "MD")):
        return conjugate(word, "infinitive") or word
    if pos.startswith(("DT", "JJ")):
        return predicative(word)
    return word
예제 #3
0
def lemma(word, pos="NN"):
    if pos == "NNS":
        return singularize(word)
    if pos.startswith(("VB","MD")):
        return conjugate(word, "infinitive") or word
    if pos.startswith(("JJ",)):
        return predicative(word)
    if pos.startswith(("DT","PR","WP")):
        return singularize(word, pos=pos)
    return word
예제 #4
0
def lemma(word, pos="NN"):
    if pos == "NNS":
        return singularize(word)
    if pos.startswith(("VB","MD")):
        return conjugate(word, "infinitive") or word
    if pos.startswith(("JJ",)):
        return predicative(word)
    if pos.startswith(("DT","PR","WP")):
        return singularize(word, pos=pos)
    if pos.startswith(("RB", "IN")) and (word.endswith(("'", u"’")) or word == "du"):
        return singularize(word, pos=pos)
    return word