mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-28 19:06:33 +03:00
c0f4a1e43b
* verbose and tag_map options * adding init_tok2vec option and only changing the tok2vec that is specified * adding omit_extra_lookups and verifying textcat config * wip * pretrain bugfix * add replace and resume options * train_textcat fix * raw text functionality * improve UX when KeyError or when input data can't be parsed * avoid unnecessary access to goldparse in TextCat pipe * save performance information in nlp.meta * add noise_level to config * move nn_parser's defaults to config file * multitask in config - doesn't work yet * scorer offering both F and AUC options, need to be specified in config * add textcat verification code from old train script * small fixes to config files * clean up * set default config for ner/parser to allow create_pipe to work as before * two more test fixes * small fixes * cleanup * fix NER pickling + additional unit test * create_pipe as before
25 lines
990 B
Python
25 lines
990 B
Python
from spacy.pipeline.pipes import DependencyParser
|
|
from spacy.vocab import Vocab
|
|
|
|
from spacy.pipeline.defaults import default_parser
|
|
|
|
|
|
def test_issue3830_no_subtok():
|
|
"""Test that the parser doesn't have subtok label if not learn_tokens"""
|
|
config = {"learn_tokens": False, "min_action_freq": 30, "beam_width": 1, "beam_update_prob": 1.0}
|
|
parser = DependencyParser(Vocab(), default_parser(), **config)
|
|
parser.add_label("nsubj")
|
|
assert "subtok" not in parser.labels
|
|
parser.begin_training(lambda: [])
|
|
assert "subtok" not in parser.labels
|
|
|
|
|
|
def test_issue3830_with_subtok():
|
|
"""Test that the parser does have subtok label if learn_tokens=True."""
|
|
config = {"learn_tokens": True, "min_action_freq": 30, "beam_width": 1, "beam_update_prob": 1.0}
|
|
parser = DependencyParser(Vocab(), default_parser(), **config)
|
|
parser.add_label("nsubj")
|
|
assert "subtok" not in parser.labels
|
|
parser.begin_training(lambda: [])
|
|
assert "subtok" in parser.labels
|