mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-07 13:44:55 +03:00
Use the equality check
This commit is contained in:
parent
52bc927db9
commit
6f3210ebb9
|
@ -706,13 +706,7 @@ class Language:
|
|||
# Check source type
|
||||
if not isinstance(source, Language):
|
||||
raise ValueError(Errors.E945.format(name=source_name, source=type(source)))
|
||||
# Check vectors, with faster checks first
|
||||
if (
|
||||
self.vocab.vectors.shape != source.vocab.vectors.shape
|
||||
or self.vocab.vectors.key2row != source.vocab.vectors.key2row
|
||||
or self.vocab.vectors.to_bytes(exclude=["strings"])
|
||||
!= source.vocab.vectors.to_bytes(exclude=["strings"])
|
||||
):
|
||||
if self.vocab.vectors != source.vocab.vectors:
|
||||
warnings.warn(Warnings.W113.format(name=source_name))
|
||||
if source_name not in source.component_names:
|
||||
raise KeyError(
|
||||
|
|
|
@ -245,6 +245,7 @@ cdef class Vectors:
|
|||
|
||||
|
||||
def __eq__(self, other):
|
||||
# Check for equality, with faster checks first
|
||||
return (
|
||||
self.shape == other.shape
|
||||
and self.key2row == other.key2row
|
||||
|
|
Loading…
Reference in New Issue
Block a user