mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-10 08:30:34 +03:00
Add official support for the `DependencyMatcher`. Redesign the pattern specification. Fix and extend operator implementations. Update API docs and add usage docs. Patterns -------- Refactor pattern structure to: ``` { "LEFT_ID": str, "REL_OP": str, "RIGHT_ID": str, "RIGHT_ATTRS": dict, } ``` The first node contains only `RIGHT_ID` and `RIGHT_ATTRS` and all subsequent nodes contain all four keys. New operators ------------- Because of the way patterns are constructed from left to right, it's helpful to have `follows` operators along with `precedes` operators. Add operators for simple precedes / follows alongside immediate precedes / follows. * `.*`: precedes * `;`: immediately follows * `;*`: follows Operator fixes -------------- * `<` and `<<` do not include the node itself * Fix reversed order for all operators involving linear precedence (`.`, all sibling operators) * Linear precedence operators do not match nodes outside the same parse Additional fixes ---------------- * Use v3 Matcher API * Support `get` and `remove` * Support pickling
59 lines
3.8 KiB
HTML
59 lines
3.8 KiB
HTML
<svg xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" xml:lang="en" id="c3124cc3e661444cb9d4175a5b7c09d1-0" class="displacy" width="925" height="399.5" direction="ltr" style="max-width: none; height: 399.5px; color: #000000; background: #ffffff; font-family: Arial; direction: ltr">
|
|
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
|
<tspan class="displacy-word" fill="currentColor" x="50">Smith</tspan>
|
|
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="50"></tspan>
|
|
</text>
|
|
|
|
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
|
<tspan class="displacy-word" fill="currentColor" x="225">founded</tspan>
|
|
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="225"></tspan>
|
|
</text>
|
|
|
|
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
|
<tspan class="displacy-word" fill="currentColor" x="400">a</tspan>
|
|
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="400"></tspan>
|
|
</text>
|
|
|
|
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
|
<tspan class="displacy-word" fill="currentColor" x="575">healthcare</tspan>
|
|
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="575"></tspan>
|
|
</text>
|
|
|
|
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
|
<tspan class="displacy-word" fill="currentColor" x="750">company.</tspan>
|
|
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="750"></tspan>
|
|
</text>
|
|
|
|
<g class="displacy-arrow">
|
|
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-0" stroke-width="2px" d="M70,264.5 C70,177.0 215.0,177.0 215.0,264.5" fill="none" stroke="currentColor"></path>
|
|
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
|
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-0" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">nsubj</textPath>
|
|
</text>
|
|
<path class="displacy-arrowhead" d="M70,266.5 L62,254.5 78,254.5" fill="currentColor"></path>
|
|
</g>
|
|
|
|
<g class="displacy-arrow">
|
|
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-1" stroke-width="2px" d="M420,264.5 C420,89.5 745.0,89.5 745.0,264.5" fill="none" stroke="currentColor"></path>
|
|
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
|
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-1" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">det</textPath>
|
|
</text>
|
|
<path class="displacy-arrowhead" d="M420,266.5 L412,254.5 428,254.5" fill="currentColor"></path>
|
|
</g>
|
|
|
|
<g class="displacy-arrow">
|
|
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-2" stroke-width="2px" d="M595,264.5 C595,177.0 740.0,177.0 740.0,264.5" fill="none" stroke="currentColor"></path>
|
|
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
|
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-2" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">compound</textPath>
|
|
</text>
|
|
<path class="displacy-arrowhead" d="M595,266.5 L587,254.5 603,254.5" fill="currentColor"></path>
|
|
</g>
|
|
|
|
<g class="displacy-arrow">
|
|
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-3" stroke-width="2px" d="M245,264.5 C245,2.0 750.0,2.0 750.0,264.5" fill="none" stroke="currentColor"></path>
|
|
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
|
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-3" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">dobj</textPath>
|
|
</text>
|
|
<path class="displacy-arrowhead" d="M750.0,266.5 L758.0,254.5 742.0,254.5" fill="currentColor"></path>
|
|
</g>
|
|
</svg>
|