From d9c29de3af190db3a3b3bef64bcff434ebe04b57 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 22 Sep 2015 02:11:31 +0200 Subject: [PATCH] * Add vectors tests for token API --- tests/tokens/test_token_api.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/tokens/test_token_api.py b/tests/tokens/test_token_api.py index e85feca6b..99c99fc11 100644 --- a/tests/tokens/test_token_api.py +++ b/tests/tokens/test_token_api.py @@ -51,3 +51,14 @@ def test_is_properties(EN): assert addr.is_oov assert not Hi.is_oov +@pytest.mark.models +def test_vectors(EN): + apples, oranges, oov = EN(u'apples oranges ldskbjlsdkbflzdfbl') + assert apples.has_vector + assert oranges.has_vector + assert not oov.has_vector + assert apples.similarity(oranges) > apples.similarity(oov) + assert apples.similarity(oranges) == oranges.similarity(apples) + assert sum(apples.vector) != sum(oranges.vector) + assert apples.vector_norm != oranges.vector_norm +