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