mirror of https://github.com/explosion/spaCy.git
Fix vector_norm test.
This commit is contained in:
parent
fefde8aef8
commit
e120561294
|
@ -5,6 +5,7 @@ from spacy.attrs import IS_SPACE, IS_TITLE, IS_UPPER, LIKE_URL, LIKE_NUM
|
||||||
from spacy.attrs import IS_STOP
|
from spacy.attrs import IS_STOP
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import numpy
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.models
|
@pytest.mark.models
|
||||||
|
@ -67,7 +68,9 @@ def test_vectors(EN):
|
||||||
assert apples.similarity(oranges) > apples.similarity(oov)
|
assert apples.similarity(oranges) > apples.similarity(oov)
|
||||||
assert apples.similarity(oranges) == oranges.similarity(apples)
|
assert apples.similarity(oranges) == oranges.similarity(apples)
|
||||||
assert sum(apples.vector) != sum(oranges.vector)
|
assert sum(apples.vector) != sum(oranges.vector)
|
||||||
assert apples.vector_norm != oranges.vector_norm
|
assert numpy.isclose(
|
||||||
|
apples.vector_norm,
|
||||||
|
numpy.sqrt(numpy.dot(apples.vector, apples.vector)))
|
||||||
|
|
||||||
@pytest.mark.models
|
@pytest.mark.models
|
||||||
def test_ancestors(EN):
|
def test_ancestors(EN):
|
||||||
|
|
Loading…
Reference in New Issue