mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-12 01:20:35 +03:00
* Fix on_match callback and remove empty patterns (#6312) For the `DependencyMatcher`: * Fix on_match callback so that it is called once per matched pattern * Fix results so that patterns with empty match lists are not returned * Add --prefer-binary for python 3.5 * Add version pins for pyrsistent * Use backwards-compatible super() * Try to fix tests on Travis (2.7) * Fix naming conflict and formatting * Update pkuseg version in Chinese tokenizer warnings * Some changes for Armenian (#5616) * Fixing numericals * We need a Armenian question sign to make the sentence a question * Update lex_attrs.py (#5608) * Fix compat * Update Armenian from v2.3.x Co-authored-by: Ines Montani <ines@ines.io> Co-authored-by: Karen Hambardzumyan <mahnerak@gmail.com> Co-authored-by: Marat M. Yavrumyan <myavrum@ysu.am>
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
# coding: utf-8
|
|
from __future__ import unicode_literals
|
|
|
|
import pytest
|
|
|
|
|
|
# TODO add test cases with valid punctuation signs.
|
|
|
|
hy_tokenize_text_test = [
|
|
(
|
|
"Մետաղագիտությունը պայմանականորեն բաժանվում է տեսականի և կիրառականի (տեխնիկական)",
|
|
[
|
|
"Մետաղագիտությունը",
|
|
"պայմանականորեն",
|
|
"բաժանվում",
|
|
"է",
|
|
"տեսականի",
|
|
"և",
|
|
"կիրառականի",
|
|
"(",
|
|
"տեխնիկական",
|
|
")",
|
|
],
|
|
),
|
|
(
|
|
"Գետաբերանը գտնվում է Օմոլոնա գետի ձախ ափից 726 կմ հեռավորության վրա",
|
|
[
|
|
"Գետաբերանը",
|
|
"գտնվում",
|
|
"է",
|
|
"Օմոլոնա",
|
|
"գետի",
|
|
"ձախ",
|
|
"ափից",
|
|
"726",
|
|
"կմ",
|
|
"հեռավորության",
|
|
"վրա",
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize("text,expected_tokens", hy_tokenize_text_test)
|
|
def test_ga_tokenizer_handles_exception_cases(hy_tokenizer, text, expected_tokens):
|
|
tokens = hy_tokenizer(text)
|
|
token_list = [token.text for token in tokens if not token.is_space]
|
|
assert expected_tokens == token_list
|