mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
cfffdba7b1
* Implement new API for {Phrase}Matcher.add (backwards-compatible) * Update docs * Also update DependencyMatcher.add * Update internals * Rewrite tests to use new API * Add basic check for common mistake Raise error with suggestion if user likely passed in a pattern instead of a list of patterns * Fix typo [ci skip]
18 lines
514 B
Python
18 lines
514 B
Python
# coding: utf8
|
|
from __future__ import unicode_literals
|
|
|
|
import pytest
|
|
from spacy.tokens import Doc, Token
|
|
from spacy.matcher import Matcher
|
|
|
|
|
|
@pytest.mark.xfail
|
|
def test_issue3555(en_vocab):
|
|
"""Test that custom extensions with default None don't break matcher."""
|
|
Token.set_extension("issue3555", default=None)
|
|
matcher = Matcher(en_vocab)
|
|
pattern = [{"LEMMA": "have"}, {"_": {"issue3555": True}}]
|
|
matcher.add("TEST", [pattern])
|
|
doc = Doc(en_vocab, words=["have", "apple"])
|
|
matcher(doc)
|