mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 02:06:31 +03:00
Fix Pipe base class
This commit is contained in:
parent
8718ca8b1f
commit
4632c597e7
|
@ -66,8 +66,12 @@ class Pipe(object):
|
||||||
and `set_annotations()` methods.
|
and `set_annotations()` methods.
|
||||||
"""
|
"""
|
||||||
self.require_model()
|
self.require_model()
|
||||||
scores, tensors = self.predict([doc])
|
predictions = self.predict([doc])
|
||||||
self.set_annotations([doc], scores, tensors=tensors)
|
if isinstance(predictions, tuple) and len(tuple) == 2:
|
||||||
|
scores, tensors = predictions
|
||||||
|
self.set_annotations([doc], scores, tensor=tensors)
|
||||||
|
else:
|
||||||
|
self.set_annotations([doc], predictions)
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
def require_model(self):
|
def require_model(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user