Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
65 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
ignore = E203, E266, E501, W503 | ||
max-line-length = 80 | ||
select = B,C,E,F,W,T4,B9 | ||
exclude = | ||
.env, | ||
.git, | ||
__pycache__, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,33 @@ | ||
# coding: utf-8 | ||
from __future__ import unicode_literals | ||
|
||
import os | ||
import pytest | ||
# from spacy.tokens import Doc | ||
from spacy.gold import GoldCorpus | ||
from spacy import util | ||
from pathlib import Path | ||
|
||
# from ...util import apply_transition_sequence | ||
|
||
TEST_FILES_DIR = os.path.join( | ||
os.path.dirname(os.path.realpath(__file__)), | ||
'test_files', | ||
) | ||
TEST_FILES_DIR = Path(__file__).parent / "test_files" | ||
|
||
|
||
@pytest.mark.xfail | ||
@pytest.mark.parametrize( | ||
"test_file", | ||
[("de_pud-ud-test.stts.json"),] | ||
) | ||
@pytest.mark.parametrize("test_file", [("de_pud-ud-test.stts.json")]) | ||
def test_de_parser_depset(NLP, test_file): | ||
"""Check that no tags outside the tagset are used.""" | ||
gold_deps = set(["ROOT", "ac", "adc", "ag", "ams", "app", "avc", "cc", "cd", "cj", "cm", "cp", "cvc", "da", "dm", "ep", "ju", "mnr", "mo", "ng", "nk", "nmc", "oa", "oc", "og", "op", "par", "pd", "pg", "ph", "pm", "pnc", "punct", "rc", "re", "rs", "sb", "sbp", "sp", "svp", "uc", "vo"]) | ||
|
||
data_path = os.path.join(TEST_FILES_DIR, test_file) | ||
data_path = util.ensure_path(data_path) | ||
# fmt: off | ||
gold_deps = set(["ROOT", "ac", "adc", "ag", "ams", "app", "avc", "cc", "cd", | ||
"cj", "cm", "cp", "cvc", "da", "dm", "ep", "ju", "mnr", | ||
"mo", "ng", "nk", "nmc", "oa", "oc", "og", "op", "par", | ||
"pd", "pg", "ph", "pm", "pnc", "punct", "rc", "re", "rs", | ||
"sb", "sbp", "sp", "svp", "uc", "vo"]) | ||
# fmt: on | ||
data_path = TEST_FILES_DIR / test_file | ||
if not data_path.exists(): | ||
raise FileNotFoundError("Test corpus not found", data_path) | ||
corpus = GoldCorpus(data_path, data_path) | ||
dev_docs = list(corpus.dev_docs(NLP, gold_preproc=False)) | ||
|
||
pred_deps = set() | ||
parser = NLP.get_pipe('parser') | ||
|
||
parser = NLP.get_pipe("parser") | ||
for doc, _ in dev_docs: | ||
parser(doc) | ||
pred_deps = pred_deps.union(set([t.dep_ for t in doc])) | ||
|
||
assert len(pred_deps - gold_deps) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,4 @@ def iter_doc(doc): | |
|
||
|
||
def test_common_issue1919(nlp): | ||
opt = nlp.begin_training() | ||
nlp.begin_training() |