mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +03:00
Tidy up and auto-format
This commit is contained in:
parent
fbf9f1edf1
commit
4d2438f985
|
@ -315,6 +315,7 @@ class Errors(object):
|
|||
"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.")
|
||||
|
||||
|
||||
@add_codes
|
||||
class TempErrors(object):
|
||||
T001 = ("Max length currently 10 for phrase matching")
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from .stop_words import STOP_WORDS
|
||||
from .lex_attrs import LEX_ATTRS
|
||||
|
||||
from ..norm_exceptions import BASE_NORMS
|
||||
from ...language import Language
|
||||
from ...attrs import LANG
|
||||
|
||||
|
||||
class KannadaDefaults(Language.Defaults):
|
||||
lex_attr_getters = dict(Language.Defaults.lex_attr_getters)
|
||||
lex_attr_getters[LANG] = lambda text: "kn"
|
||||
stop_words = STOP_WORDS
|
||||
|
||||
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
'''Test that labels are mapped to classes consistently when loading NER model.'''
|
||||
# coding: utf8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from spacy.lang.en import English
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.xfail
|
||||
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
|
||||
were added using ner.add_label().
|
||||
'''
|
||||
"""
|
||||
nlp = English()
|
||||
ner = nlp.create_pipe('ner')
|
||||
ner = nlp.create_pipe("ner")
|
||||
nlp.add_pipe(ner)
|
||||
|
||||
ner.add_label('ANIMAL')
|
||||
|
||||
ner.add_label("ANIMAL")
|
||||
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
|
||||
nlp2 = English()
|
||||
nlp2.add_pipe(nlp2.create_pipe('ner'))
|
||||
nlp2.add_pipe(nlp2.create_pipe("ner"))
|
||||
nlp2.from_bytes(nlp.to_bytes())
|
||||
assert nlp2.get_pipe('ner').move_names == move_names
|
||||
|
||||
assert nlp2.get_pipe("ner").move_names == move_names
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
from spacy.matcher import PhraseMatcher
|
||||
from spacy.lang.en import English
|
||||
from spacy.compat import pickle
|
||||
|
|
Loading…
Reference in New Issue
Block a user