Tidy up and auto-format

This commit is contained in:
Ines Montani 2019-02-13 15:29:08 +01:00
parent fbf9f1edf1
commit 4d2438f985
4 changed files with 14 additions and 14 deletions

View File

@ -315,6 +315,7 @@ class Errors(object):
"So instead of pickling the span, pickle the Doc it belongs to or " "So instead of pickling the span, pickle the Doc it belongs to or "
"use Span.as_doc to convert the span to a standalone Doc object.") "use Span.as_doc to convert the span to a standalone Doc object.")
@add_codes @add_codes
class TempErrors(object): class TempErrors(object):
T001 = ("Max length currently 10 for phrase matching") T001 = ("Max length currently 10 for phrase matching")

View File

@ -2,14 +2,13 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .stop_words import STOP_WORDS from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from ..norm_exceptions import BASE_NORMS
from ...language import Language from ...language import Language
from ...attrs import LANG from ...attrs import LANG
class KannadaDefaults(Language.Defaults): class KannadaDefaults(Language.Defaults):
lex_attr_getters = dict(Language.Defaults.lex_attr_getters)
lex_attr_getters[LANG] = lambda text: "kn"
stop_words = STOP_WORDS stop_words = STOP_WORDS

View File

@ -1,24 +1,25 @@
'''Test that labels are mapped to classes consistently when loading NER model.''' # coding: utf8
from __future__ import unicode_literals from __future__ import unicode_literals
from spacy.lang.en import English from spacy.lang.en import English
import pytest import pytest
@pytest.mark.xfail @pytest.mark.xfail
def test_issue3209(): def test_issue3209():
'''Test issue that occurred in spaCy nightly where NER labels were being """Test issue that occurred in spaCy nightly where NER labels were being
mapped to classes incorrectly after loading the model, when the labels mapped to classes incorrectly after loading the model, when the labels
were added using ner.add_label(). were added using ner.add_label().
''' """
nlp = English() nlp = English()
ner = nlp.create_pipe('ner') ner = nlp.create_pipe("ner")
nlp.add_pipe(ner) nlp.add_pipe(ner)
ner.add_label('ANIMAL') ner.add_label("ANIMAL")
nlp.begin_training() nlp.begin_training()
move_names = ['O', 'B-ANIMAL', 'I-ANIMAL', 'L-ANIMAL', 'U-ANIMAL'] move_names = ["O", "B-ANIMAL", "I-ANIMAL", "L-ANIMAL", "U-ANIMAL"]
assert ner.move_names == move_names assert ner.move_names == move_names
nlp2 = English() nlp2 = English()
nlp2.add_pipe(nlp2.create_pipe('ner')) nlp2.add_pipe(nlp2.create_pipe("ner"))
nlp2.from_bytes(nlp.to_bytes()) nlp2.from_bytes(nlp.to_bytes())
assert nlp2.get_pipe('ner').move_names == move_names assert nlp2.get_pipe("ner").move_names == move_names

View File

@ -1,7 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import pytest
from spacy.matcher import PhraseMatcher from spacy.matcher import PhraseMatcher
from spacy.lang.en import English from spacy.lang.en import English
from spacy.compat import pickle from spacy.compat import pickle