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
|
|
|
|
2018-07-24 21:38:44 +00:00
|
|
|
def test_fr_lemmatizer_verb(fr_tokenizer):
|
2018-07-04 12:46:45 +00:00
|
|
|
tokens = fr_tokenizer("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
|
|
|
|
2018-07-24 21:38:44 +00:00
|
|
|
def test_fr_lemmatizer_noun_verb_2(fr_tokenizer):
|
2018-07-04 12:46:45 +00:00
|
|
|
tokens = fr_tokenizer("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
|
|
|
|
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")
|
2018-07-24 21:38:44 +00:00
|
|
|
def test_fr_lemmatizer_noun(fr_tokenizer):
|
2018-07-04 12:46:45 +00:00
|
|
|
tokens = fr_tokenizer("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
|
|
|
|
2018-07-24 21:38:44 +00:00
|
|
|
def test_fr_lemmatizer_noun_2(fr_tokenizer):
|
2018-07-04 12:46:45 +00:00
|
|
|
tokens = fr_tokenizer("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"
|