mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* new file: test_issue4924.py * modified: spacy/gold.pyx * modified: test_issue4924.py for python2
This commit is contained in:
parent
b9afcd56e3
commit
708a4d27eb
|
@ -694,6 +694,11 @@ cdef class GoldParse:
|
|||
self.cats = {} if cats is None else dict(cats)
|
||||
self.links = links
|
||||
|
||||
# orig_annot is used as an iterator in `nlp.evalate` even if self.length == 0,
|
||||
# so set a empty list to avoid error.
|
||||
# if self.lenght > 0, this is modified latter.
|
||||
self.orig_annot = []
|
||||
|
||||
# avoid allocating memory if the doc does not contain any tokens
|
||||
if self.length > 0:
|
||||
if words is None:
|
||||
|
|
16
spacy/tests/regression/test_issue4924.py
Normal file
16
spacy/tests/regression/test_issue4924.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# coding: utf8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
|
||||
import spacy
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def nlp():
|
||||
return spacy.blank("en")
|
||||
|
||||
|
||||
def test_evaluate(nlp):
|
||||
docs_golds = [("", {})]
|
||||
nlp.evaluate(docs_golds)
|
Loading…
Reference in New Issue
Block a user