mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Merge pull request #7492 from adrianeboyd/bugfix/ux-matcher-attributes
Update matcher errors and docs
This commit is contained in:
		
						commit
						e3c3dbdb15
					
				| 
						 | 
					@ -202,6 +202,8 @@ cdef class Matcher:
 | 
				
			||||||
        doclike (Doc or Span): The document to match over.
 | 
					        doclike (Doc or Span): The document to match over.
 | 
				
			||||||
        as_spans (bool): Return Span objects with labels instead of (match_id,
 | 
					        as_spans (bool): Return Span objects with labels instead of (match_id,
 | 
				
			||||||
            start, end) tuples.
 | 
					            start, end) tuples.
 | 
				
			||||||
 | 
					        allow_missing (bool): Whether to skip checks for missing annotation for
 | 
				
			||||||
 | 
					            attributes included in patterns. Defaults to False.
 | 
				
			||||||
        RETURNS (list): A list of `(match_id, start, end)` tuples,
 | 
					        RETURNS (list): A list of `(match_id, start, end)` tuples,
 | 
				
			||||||
            describing the matches. A match tuple describes a span
 | 
					            describing the matches. A match tuple describes a span
 | 
				
			||||||
            `doc[start:end]`. The `match_id` is an integer. If as_spans is set
 | 
					            `doc[start:end]`. The `match_id` is an integer. If as_spans is set
 | 
				
			||||||
| 
						 | 
					@ -222,7 +224,7 @@ cdef class Matcher:
 | 
				
			||||||
                    if attr == TAG:
 | 
					                    if attr == TAG:
 | 
				
			||||||
                        pipe = "tagger"
 | 
					                        pipe = "tagger"
 | 
				
			||||||
                    elif attr in (POS, MORPH):
 | 
					                    elif attr in (POS, MORPH):
 | 
				
			||||||
                        pipe = "morphologizer"
 | 
					                        pipe = "morphologizer or tagger+attribute_ruler"
 | 
				
			||||||
                    elif attr == LEMMA:
 | 
					                    elif attr == LEMMA:
 | 
				
			||||||
                        pipe = "lemmatizer"
 | 
					                        pipe = "lemmatizer"
 | 
				
			||||||
                    elif attr == DEP:
 | 
					                    elif attr == DEP:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -194,7 +194,7 @@ cdef class PhraseMatcher:
 | 
				
			||||||
                        if attr == TAG:
 | 
					                        if attr == TAG:
 | 
				
			||||||
                            pipe = "tagger"
 | 
					                            pipe = "tagger"
 | 
				
			||||||
                        elif attr in (POS, MORPH):
 | 
					                        elif attr in (POS, MORPH):
 | 
				
			||||||
                            pipe = "morphologizer"
 | 
					                            pipe = "morphologizer or tagger+attribute_ruler"
 | 
				
			||||||
                        elif attr == LEMMA:
 | 
					                        elif attr == LEMMA:
 | 
				
			||||||
                            pipe = "lemmatizer"
 | 
					                            pipe = "lemmatizer"
 | 
				
			||||||
                        elif attr == DEP:
 | 
					                        elif attr == DEP:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -121,10 +121,11 @@ Find all token sequences matching the supplied patterns on the `Doc` or `Span`.
 | 
				
			||||||
> ```
 | 
					> ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Name                                       | Description                                                                                                                                                                                                                                                                                              |
 | 
					| Name                                       | Description                                                                                                                                                                                                                                                                                              |
 | 
				
			||||||
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
 | 
					| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
 | 
				
			||||||
| `doclike`                                  | The `Doc` or `Span` to match over. ~~Union[Doc, Span]~~                                                                                                                                                                                                                                                  |
 | 
					| `doclike`                                  | The `Doc` or `Span` to match over. ~~Union[Doc, Span]~~                                                                                                                                                                                                                                                  |
 | 
				
			||||||
| _keyword-only_                             |                                                                                                                                                                                                                                                                                                          |
 | 
					| _keyword-only_                             |                                                                                                                                                                                                                                                                                                          |
 | 
				
			||||||
| `as_spans` <Tag variant="new">3</Tag>      | Instead of tuples, return a list of [`Span`](/api/span) objects of the matches, with the `match_id` assigned as the span label. Defaults to `False`. ~~bool~~                                                                                                                                            |
 | 
					| `as_spans` <Tag variant="new">3</Tag>      | Instead of tuples, return a list of [`Span`](/api/span) objects of the matches, with the `match_id` assigned as the span label. Defaults to `False`. ~~bool~~                                                                                                                                            |
 | 
				
			||||||
 | 
					| `allow_missing` <Tag variant="new">3</Tag> | Whether to skip checks for missing annotation for attributes included in patterns. Defaults to `False`. ~~bool~~                                                                                                                                                                                         |
 | 
				
			||||||
| **RETURNS**                                | A list of `(match_id, start, end)` tuples, describing the matches. A match tuple describes a span `doc[start:end`]. The `match_id` is the ID of the added match pattern. If `as_spans` is set to `True`, a list of `Span` objects is returned instead. ~~Union[List[Tuple[int, int, int]], List[Span]]~~ |
 | 
					| **RETURNS**                                | A list of `(match_id, start, end)` tuples, describing the matches. A match tuple describes a span `doc[start:end`]. The `match_id` is the ID of the added match pattern. If `as_spans` is set to `True`, a list of `Span` objects is returned instead. ~~Union[List[Tuple[int, int, int]], List[Span]]~~ |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Matcher.\_\_len\_\_ {#len tag="method" new="2"}
 | 
					## Matcher.\_\_len\_\_ {#len tag="method" new="2"}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user