コード例 #1
0
def test_issue2179():
    """Test that spurious 'extra_labels' aren't created when initializing NER."""
    nlp = Italian()
    ner = nlp.create_pipe("ner")
    ner.add_label("CITIZENSHIP")
    nlp.add_pipe(ner)
    nlp.begin_training()
    nlp2 = Italian()
    nlp2.add_pipe(nlp2.create_pipe("ner"))
    nlp2.from_bytes(nlp.to_bytes())
    assert "extra_labels" not in nlp2.get_pipe("ner").cfg
    assert nlp2.get_pipe("ner").labels == ("CITIZENSHIP", )
コード例 #2
0
ファイル: test_issue2001-2500.py プロジェクト: spacy-io/spaCy
def test_issue2179():
    """Test that spurious 'extra_labels' aren't created when initializing NER."""
    nlp = Italian()
    ner = nlp.create_pipe("ner")
    ner.add_label("CITIZENSHIP")
    nlp.add_pipe(ner)
    nlp.begin_training()
    nlp2 = Italian()
    nlp2.add_pipe(nlp2.create_pipe("ner"))
    nlp2.from_bytes(nlp.to_bytes())
    assert "extra_labels" not in nlp2.get_pipe("ner").cfg
    assert nlp2.get_pipe("ner").labels == ("CITIZENSHIP",)
コード例 #3
0
def test_issue2482():
    """Test we can serialize and deserialize a blank NER or parser model."""
    nlp = Italian()
    nlp.add_pipe(nlp.create_pipe("ner"))
    b = nlp.to_bytes()
    Italian().from_bytes(b)
コード例 #4
0
ファイル: test_issue2001-2500.py プロジェクト: spacy-io/spaCy
def test_issue2482():
    """Test we can serialize and deserialize a blank NER or parser model."""
    nlp = Italian()
    nlp.add_pipe(nlp.create_pipe("ner"))
    b = nlp.to_bytes()
    Italian().from_bytes(b)