spaCy/spacy
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
..
cli Merge pull request #6064 from explosion/fix/sparse-checkout-ux 2020-09-15 00:32:20 +02:00
displacy Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
lang Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
matcher Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
ml Add vectors option to CharacterEmbed (#6069) 2020-09-16 17:45:04 +02:00
pipeline Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
tests Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
tokens Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
training Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
__init__.pxd * Seems to be working after refactor. Need to wire up more POS tag features, and wire up save/load of POS tags. 2014-10-24 02:23:42 +11:00
__init__.py Support vocab arg in spacy.blank 2020-09-15 11:39:36 +02:00
__main__.py Tidy up 2020-06-22 00:45:40 +02:00
about.py Set version to v3.0.0a18 2020-09-14 22:05:43 +02:00
attrs.pxd Merge branch 'develop' into master-tmp 2020-05-21 18:39:06 +02:00
attrs.pyx Merge branch 'develop' into master-tmp 2020-05-21 18:39:06 +02:00
compat.py Tidy up, autoformat, add types 2020-07-25 15:01:15 +02:00
default_config_pretraining.cfg Update default pretraining config [ci skip] 2020-09-15 01:12:02 +02:00
default_config.cfg Fix defaults 2020-09-08 15:31:21 +02:00
errors.py Refactor Docs.is_ flags (#6044) 2020-09-17 00:14:01 +02:00
glossary.py unicode -> str consistency 2020-05-24 17:20:58 +02:00
kb.pxd Define candidate generator in EL config (#5876) 2020-08-18 16:10:36 +02:00
kb.pyx Update docs links in codebase 2020-09-04 12:58:50 +02:00
language.py Fix 2020-09-16 18:15:14 +02:00
lexeme.pxd Fix Lexeme.from_ptr 2020-08-10 16:43:37 +02:00
lexeme.pyx Update docs links in codebase 2020-09-04 12:58:50 +02:00
lookups.py Update docs links in codebase 2020-09-04 12:58:50 +02:00
morphology.pxd Add Lemmatizer and simplify related components (#5848) 2020-08-07 15:27:13 +02:00
morphology.pyx Add Lemmatizer and simplify related components (#5848) 2020-08-07 15:27:13 +02:00
parts_of_speech.pxd Add support for Universal Dependencies v2.0 2017-03-03 13:17:34 +01:00
parts_of_speech.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
pipe_analysis.py Simplify pipe analysis 2020-08-01 13:40:06 +02:00
schemas.py Improve v3 pretrain command (#6040) 2020-09-13 14:05:05 +02:00
scorer.py Renaming gold & annotation_setter (#6042) 2020-09-09 10:31:03 +02:00
strings.pxd Remove 'cleanup' of strings (#6007) 2020-09-01 16:12:15 +02:00
strings.pyx Update docs links in codebase 2020-09-04 12:58:50 +02:00
structs.pxd Merge branch 'develop' into master-tmp 2020-05-21 18:39:06 +02:00
symbols.pxd Merge branch 'develop' into master-tmp 2020-05-21 18:39:06 +02:00
symbols.pyx Remove PRON_LEMMA symbol (#5968) 2020-08-25 14:21:29 +02:00
tokenizer.pxd Simplify specials and cache checks (#6012) 2020-09-03 09:42:49 +02:00
tokenizer.pyx Fix token.idx for special cases with affixes (#6035) 2020-09-13 14:05:36 +02:00
typedefs.pxd Update spaCy for thinc 8.0.0 (#4920) 2020-01-29 17:06:46 +01:00
typedefs.pyx Tidy up rest 2017-10-27 21:07:59 +02:00
util.py Fix sparse checkout and error handling 2020-09-14 14:12:58 +02:00
vectors.pyx Update docs links in codebase 2020-09-04 12:58:50 +02:00
vocab.pxd Tidy up and move noun_chunks, token_match, url_match 2020-07-22 22:18:46 +02:00
vocab.pyx Update docs links in codebase 2020-09-04 12:58:50 +02:00