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