Skip to content

Commit

Permalink
tests: misc
Browse files Browse the repository at this point in the history
  • Loading branch information
HLasse committed Dec 20, 2022
1 parent 9c7c032 commit c12d80a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions textdescriptives/components/coherence.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from spacy.tokens import Doc


@Language.factory("textdescriptives.coherence")
@Language.factory("textdescriptives/coherence")
def create_coherence_component(nlp: Language, name: str):
"""Allows Coherence to be added to a spaCy pipe using nlp.add_pipe("textdescriptives.coherence").
"""Allows Coherence to be added to a spaCy pipe using nlp.add_pipe("textdescriptives/coherence").
If the pipe does not contain a parser or sentencizer, the sentencizer component is silently added."""
return Coherence(nlp)

Expand Down
4 changes: 2 additions & 2 deletions textdescriptives/tests/test_coherence.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
@pytest.fixture(scope="function")
def nlp():
nlp = spacy.load("en_core_web_sm")
nlp.add_pipe("textdescriptives.coherence")
nlp.add_pipe("textdescriptives/coherence")
return nlp


def test_coherence_integration(nlp):
assert "textdescriptives.coherence" == nlp.pipe_names[-1]
assert "textdescriptives/coherence" == nlp.pipe_names[-1]


def test_coherence(nlp):
Expand Down
5 changes: 2 additions & 3 deletions textdescriptives/tests/test_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,8 @@ def test_passed_quality_check(text: str, passed: bool, nlp: spacy.Language):


def test_quality_multi_process(nlp):
texts = [oliver_twist, secret_garden, flatland]
texts = [ftfy.fix_text(text) for text in texts]
texts = ["A couple of texts here, yeah yeah yeah.", "This is a second text, no repetition what so ever."]

docs = nlp.pipe(texts, n_process=3)
docs = nlp.pipe(texts, n_process=2)
for doc in docs:
assert doc._.quality

0 comments on commit c12d80a

Please sign in to comment.