mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-21 01:21:58 +03:00
Rephrase error about vocab methods for vectors
This commit is contained in:
parent
ffbc4af216
commit
8d6df674fa
|
@ -553,7 +553,8 @@ class Errors(metaclass=ErrorsWithCodes):
|
|||
"during training, make sure to include it in 'annotating components'")
|
||||
|
||||
# New errors added in v3.x
|
||||
E849 = ("Unable to {action} vectors for vectors of type {vectors_type}.")
|
||||
E849 = ("The vocab only supports {method} for vectors of type "
|
||||
"spacy.vectors.Vectors, not {vectors_type}.")
|
||||
E850 = ("The PretrainVectors objective currently only supports default or "
|
||||
"floret vectors, not {mode} vectors.")
|
||||
E851 = ("The 'textcat' component labels should only have values of 0 or 1, "
|
||||
|
|
|
@ -300,7 +300,7 @@ cdef class Vocab:
|
|||
width, you have to call this to change the size of the vectors.
|
||||
"""
|
||||
if not isinstance(self.vectors, Vectors):
|
||||
raise ValueError(Errors.E849.format(action="reset", vectors_type=type(self.vectors)))
|
||||
raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(Vectors)))
|
||||
if width is not None and shape is not None:
|
||||
raise ValueError(Errors.E065.format(width=width, shape=shape))
|
||||
elif shape is not None:
|
||||
|
@ -311,7 +311,7 @@ cdef class Vocab:
|
|||
|
||||
def deduplicate_vectors(self):
|
||||
if not isinstance(self.vectors, Vectors):
|
||||
raise ValueError(Errors.E849.format(action="deduplicate", vectors_type=type(self.vectors)))
|
||||
raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors)))
|
||||
if self.vectors.mode != VectorsMode.default:
|
||||
raise ValueError(Errors.E858.format(
|
||||
mode=self.vectors.mode,
|
||||
|
@ -366,7 +366,7 @@ cdef class Vocab:
|
|||
DOCS: https://spacy.io/api/vocab#prune_vectors
|
||||
"""
|
||||
if not isinstance(self.vectors, Vectors):
|
||||
raise ValueError(Errors.E849.format(action="prune", vectors_type=type(self.vectors)))
|
||||
raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(Vectors)))
|
||||
if self.vectors.mode != VectorsMode.default:
|
||||
raise ValueError(Errors.E858.format(
|
||||
mode=self.vectors.mode,
|
||||
|
|
Loading…
Reference in New Issue
Block a user