spaCy/website/docs/usage
Adriane Boyd 7e4cd7575c
Refactor Docs.is_ flags (#6044)
* Refactor Docs.is_ flags

* Add derived `Doc.has_annotation` method

  * `Doc.has_annotation(attr)` returns `True` for partial annotation

  * `Doc.has_annotation(attr, require_complete=True)` returns `True` for
    complete annotation

* Add deprecation warnings to `is_tagged`, `is_parsed`, `is_sentenced`
and `is_nered`

* Add `Doc._get_array_attrs()`, which returns a full list of `Doc` attrs
for use with `Doc.to_array`, `Doc.to_bytes` and `Doc.from_docs`. The
list is the `DocBin` attributes list plus `SPACY` and `LENGTH`.

Notes on `Doc.has_annotation`:

* `HEAD` is converted to `DEP` because heads don't have an unset state

* Accept `IS_SENT_START` as a synonym of `SENT_START`

Additional changes:

* Add `NORM`, `ENT_ID` and `SENT_START` to default attributes for
`DocBin`

* In `Doc.from_array()` the presence of `DEP` causes `HEAD` to override
`SENT_START`

* In `Doc.from_array()` using `attrs` other than
`Doc._get_array_attrs()` (i.e., a user's custom list rather than our
default internal list) with both `HEAD` and `SENT_START` shows a warning
that `HEAD` will override `SENT_START`

* `set_children_from_heads` does not require dependency labels to set
sentence boundaries and sets `sent_start` for all non-sentence starts to
`-1`

* Fix call to set_children_form_heads

Co-authored-by: Matthew Honnibal <honnibal+gh@gmail.com>
2020-09-17 00:14:01 +02:00
..
101 Update docs [ci skip] 2020-09-12 17:05:10 +02:00
_benchmarks-models.md Update docs [ci skip] 2020-09-13 17:59:38 +02:00
embeddings-transformers.md Update docs [ci skip] 2020-09-12 17:05:10 +02:00
facts-figures.md Update docs [ci skip] 2020-09-13 11:31:50 +02:00
index.md Update docs [ci skip] 2020-09-15 12:44:03 +02:00
layers-architectures.md Update docs [ci skip] 2020-09-12 17:05:10 +02:00
linguistic-features.md Update docs [ci skip] 2020-09-12 17:05:10 +02:00
models.md Update docs [ci skip] 2020-09-12 17:05:10 +02:00
processing-pipelines.md references to usage page on layers and architectures 2020-09-09 14:47:32 +02:00
projects.md Update docs [ci skip] 2020-09-13 23:09:19 +02:00
rule-based-matching.md Update docs [ci skip] 2020-09-13 11:31:50 +02:00
saving-loading.md Update docs [ci skip] 2020-09-12 17:05:10 +02:00
spacy-101.md Update docs [ci skip] 2020-09-12 17:40:50 +02:00
training.md Update docs [ci skip] 2020-09-13 23:09:19 +02:00
v2-1.md Remove u-strings and fix formatting [ci skip] 2019-09-12 16:11:15 +02:00
v2-2.md Update v3 docs [ci skip] 2020-07-05 16:11:16 +02:00
v2-3.md Extend v2.3 migration guide (#5653) 2020-06-26 14:13:01 +02:00
v2.md Update docs [ci skip] 2020-09-12 17:05:10 +02:00
v3.md Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
visualizers.md "model" terminology consistency in docs 2020-09-03 13:13:03 +02:00