|
@@ -3,7 +3,8 @@ import pytest
|
|
import spacy
|
|
import spacy
|
|
from spacy import displacy
|
|
from spacy import displacy
|
|
|
|
|
|
-from src.strategies.leaf_strategy import leaf_strategy
|
|
|
|
|
|
+from src.generators import Generator
|
|
|
|
+from src.strategies import leaf_strategy
|
|
|
|
|
|
nlp = spacy.load("en_core_web_trf")
|
|
nlp = spacy.load("en_core_web_trf")
|
|
|
|
|
|
@@ -11,8 +12,13 @@ nlp = spacy.load("en_core_web_trf")
|
|
('Regex for redacted phone numbers with extra info for PlayStation', ['PhoneNumberRegex', 'RedactedPhoneNumberRegex'])
|
|
('Regex for redacted phone numbers with extra info for PlayStation', ['PhoneNumberRegex', 'RedactedPhoneNumberRegex'])
|
|
])
|
|
])
|
|
def test_leaf_strategy(text, expected):
|
|
def test_leaf_strategy(text, expected):
|
|
- doc = nlp(text)
|
|
|
|
|
|
+ generator = Generator(text=text, strategy=leaf_strategy)
|
|
|
|
|
|
- result = leaf_strategy(doc)
|
|
|
|
|
|
+ results = generator.suggest()
|
|
|
|
|
|
|
|
+ doc = generator.doc
|
|
|
|
+ for token in doc:
|
|
|
|
+ print(token)
|
|
|
|
+
|
|
|
|
+ print(results)
|
|
# assert result == expected
|
|
# assert result == expected
|