2017-04-25 18:44:16 +03:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2017-04-25 18:46:01 +03:00
|
|
|
|
2017-05-29 23:14:31 +03:00
|
|
|
@pytest.mark.models('fr')
|
2017-04-27 12:52:14 +03:00
|
|
|
def test_lemmatizer_verb(FR):
|
2017-05-29 23:14:31 +03:00
|
|
|
tokens = FR("Qu'est-ce que tu fais?")
|
2017-04-27 12:52:14 +03:00
|
|
|
assert tokens[0].lemma_ == "que"
|
|
|
|
assert tokens[1].lemma_ == "être"
|
|
|
|
assert tokens[5].lemma_ == "faire"
|
|
|
|
|
2017-05-29 23:14:31 +03:00
|
|
|
|
|
|
|
@pytest.mark.models('fr')
|
2017-04-27 12:52:14 +03:00
|
|
|
@pytest.mark.xfail(reason="sont tagged as AUX")
|
|
|
|
def test_lemmatizer_noun_verb_2(FR):
|
2017-05-29 23:14:31 +03:00
|
|
|
tokens = FR("Les abaissements de température sont gênants.")
|
2017-04-27 12:52:14 +03:00
|
|
|
assert tokens[4].lemma_ == "être"
|
|
|
|
|
2017-05-29 23:14:31 +03:00
|
|
|
|
|
|
|
@pytest.mark.models('fr')
|
2017-04-27 12:52:14 +03:00
|
|
|
@pytest.mark.xfail(reason="Costaricienne TAG is PROPN instead of NOUN and spacy don't lemmatize PROPN")
|
2017-11-20 15:59:59 +03:00
|
|
|
def test_lemmatizer_noun(FR):
|
2017-05-29 23:14:31 +03:00
|
|
|
tokens = FR("il y a des Costaricienne.")
|
2017-04-27 12:52:14 +03:00
|
|
|
assert tokens[4].lemma_ == "Costaricain"
|
|
|
|
|
2017-05-29 23:14:31 +03:00
|
|
|
|
|
|
|
@pytest.mark.models('fr')
|
2017-04-27 12:52:14 +03:00
|
|
|
def test_lemmatizer_noun_2(FR):
|
2017-05-29 23:14:31 +03:00
|
|
|
tokens = FR("Les abaissements de température sont gênants.")
|
2017-04-27 12:52:14 +03:00
|
|
|
assert tokens[1].lemma_ == "abaissement"
|
|
|
|
assert tokens[5].lemma_ == "gênant"
|