mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-02 19:30:19 +03:00
Documentation
This commit is contained in:
parent
fb9993e163
commit
35ee80c5e3
|
@ -437,11 +437,11 @@ def render_document(
|
|||
AttributeFormat("dep_", name="dep_"),
|
||||
AttributeFormat("ent_type_", name="ent_type_"),
|
||||
AttributeFormat("i", name="index", aligns="r"),
|
||||
AttributeFormat("text", name="text", max_width=20),
|
||||
AttributeFormat("lemma_", name="lemma_", max_width=20),
|
||||
AttributeFormat("text", name="text", max_width=30),
|
||||
AttributeFormat("lemma_", name="lemma_", max_width=30),
|
||||
AttributeFormat("pos_", name="pos_"),
|
||||
AttributeFormat("tag_", name="tag_"),
|
||||
AttributeFormat("morph", name="morph_", max_width=60),
|
||||
AttributeFormat("morph", name="morph", max_width=80),
|
||||
]
|
||||
if search_attr_name is not None and search_attr_value is not None:
|
||||
for col in cols:
|
||||
|
|
|
@ -520,6 +520,31 @@ JSON data as generated by [`Doc.to_json()`](/api/doc#to_json).
|
|||
| `validate` | Whether to validate the JSON input against the expected schema for detailed debugging. Defaults to `False`. ~~bool~~ |
|
||||
| **RETURNS** | A `Doc` corresponding to the provided JSON. ~~Doc~~ |
|
||||
|
||||
## Doc.inspect {id="inspect",tag="method",version="4"}
|
||||
|
||||
Outputs to the console a human-readable, tabular representation of all or part
|
||||
of the document. If any of the four optional parameters are specified, those
|
||||
sentences in the document that correspond to the specification are displayed; if
|
||||
none of them are specified, the whole document is displayed.
|
||||
|
||||
> #### Example
|
||||
>
|
||||
> ```python
|
||||
> doc = nlp("All we have to decide is what to do with the time that is given us. Nobody knows how much time that is.")
|
||||
> doc.inspect()
|
||||
> doc.inspect("lemma_", "give")
|
||||
> doc.inspect("lemma_", "time", start_i=18)
|
||||
> doc.inspect("lemma_", "time", length=20)
|
||||
> ```
|
||||
|
||||
| Name | Description |
|
||||
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `search_attr_name` | The name of an attribute for which to search to determine the sentence at which to begin rendering, e.g. `lemma_`. ~~Optional[str]~~ |
|
||||
| `search_attr_value` | The value of an attribute for which to search to determine the sentence at which to begin rendering, e.g. `give`. ~~Optional[str]~~ |
|
||||
| _keyword-only_ | |
|
||||
| `start_i` | The index at which searching should begin or with whose containing sentence rendering should begin. ~~Optional[int]~~ |
|
||||
| `length` | The number of tokens from the start token to the token with whose containing sentence rendering should end. ~~Optional[int]~~ |
|
||||
|
||||
## Doc.retokenize {id="retokenize",tag="contextmanager",version="2.1"}
|
||||
|
||||
Context manager to handle retokenization of the `Doc`. Modifications to the
|
||||
|
|
Loading…
Reference in New Issue
Block a user