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