Fix tests

This commit is contained in:
Andras Schmelczer 2022-05-25 19:49:14 +02:00
parent 00353837b4
commit 89661e8fbc
No known key found for this signature in database
GPG key ID: 39260B5B0614A13E
18 changed files with 14 additions and 16 deletions

View file

@ -0,0 +1,20 @@
import unittest
from src.great_ai.utilities.lemmatize_text import lemmatize_token
from src.great_ai.utilities.nlp import nlp
class TestLemmatizeToken(unittest.TestCase):
def test_simple(self) -> None:
token = nlp("Center")[0]
self.assertEqual(lemmatize_token(token), "centre")
self.assertEqual(lemmatize_token(token, add_negation=True), "centre")
self.assertEqual(lemmatize_token(token, add_part_of_speech=True), "centre_NOUN")
def test_punctuation(self) -> None:
token = nlp("This.")[1]
self.assertEqual(lemmatize_token(token), ".")
self.assertEqual(lemmatize_token(token, add_negation=True), ".")
self.assertEqual(lemmatize_token(token, add_part_of_speech=True), "._PUNCT")