From b3e338d65e63c8550b1ab040b4414a75fb7716b3 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Fri, 4 Sep 2020 20:58:36 +0200 Subject: [PATCH] Update docs [ci skip] --- website/docs/usage/v3.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/website/docs/usage/v3.md b/website/docs/usage/v3.md index e5228ab21..8006863e1 100644 --- a/website/docs/usage/v3.md +++ b/website/docs/usage/v3.md @@ -209,11 +209,18 @@ aren't set. > #### Example > > ```python -> # TODO: example +> from spacy.matcher import DependencyMatcher +> +> matcher = DependencyMatcher(nlp.vocab) +> pattern = [ +> {"RIGHT_ID": "anchor_founded", "RIGHT_ATTRS": {"ORTH": "founded"}}, +> {"LEFT_ID": "anchor_founded", "REL_OP": ">", "RIGHT_ID": "subject", "RIGHT_ATTRS": {"DEP": "nsubj"}} +> ] +> matcher.add("FOUNDED", [pattern]) > ``` -The [`DependencyMatcher`](/api/dependencymatcher) lets you match patterns within -the dependency parse using +The new [`DependencyMatcher`](/api/dependencymatcher) lets you match patterns +within the dependency parse using [Semgrex](https://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/semgraph/semgrex/SemgrexPattern.html) operators. It follows the same API as the token-based [`Matcher`](/api/matcher). A pattern added to the dependency matcher consists of a **list of