Commit 0de36226 authored by Raul Sirel's avatar Raul Sirel
Browse files

add some more tests

parent b3761b32
Pipeline #6819 canceled with stages
in 17 minutes and 15 seconds
......@@ -38,7 +38,7 @@ def test_mlp_process(mlp: MLP):
for test_text in test_texts:
# process text
result = mlp.process(test_text, spans="sentence")
print("\nMLP process output:", result)
#print("\nMLP process output:", result)
# test result form
assert "text_mlp" in result
......@@ -261,3 +261,29 @@ def test_that_entity_mapper_is_loaded_on_demand():
assert pipeline._entity_mapper is None
pipeline.process(raw_text="Tere, minu nimi on Joonas, kas saaksite öelda, mis kell praegu on?", analyzers=["entities"], lang="et")
assert isinstance(pipeline._entity_mapper, EntityMapper)
def test_generic_process_docs_output(mlp: MLP):
docs = [
{"comment": {"random_name": "Barack Obama was one of the presidents of the United States of America!"}},
{"comment": {"random_name": "Issand halasta, mis pask see veel on?!"}},
{"comment": {"random_name": ".fads"}},
{"comment": {"random_name": "Barack Obama was one of the presidents of the United States of America!"}},
{"comment": {"random_name": "Issand halasta, mis pask see veel on?!"}},
{"comment": {"random_name": ".fads"}}
]
doc_paths = ["comment.random_name"]
results = mlp.process_docs(docs=docs, doc_paths=doc_paths)
for i, result in enumerate(results):
assert "comment" in result
comment = result["comment"]
assert "random_name_mlp" in comment
mlp_field = comment["random_name_mlp"]
assert "pos_tags" in mlp_field
assert len(mlp_field["pos_tags"].split(" ")) == len(mlp_field["text"].split(" "))
assert "texta_facts" in result
assert docs[i]["comment"]["random_name"] == comment["random_name"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment