spaCy/website/docs/usage
adrianeboyd 2c876eb672 Add tokenizer explain() debugging method (#4596)
* Expose tokenizer rules as a property

Expose the tokenizer rules property in the same way as the other core
properties. (The cache resetting is overkill, but consistent with
`from_bytes` for now.)

Add tests and update Tokenizer API docs.

* Update Hungarian punctuation to remove empty string

Update Hungarian punctuation definitions so that `_units` does not match
an empty string.

* Use _load_special_tokenization consistently

Use `_load_special_tokenization()` and have it to handle `None` checks.

* Fix precedence of `token_match` vs. special cases

Remove `token_match` check from `_split_affixes()` so that special cases
have precedence over `token_match`. `token_match` is checked only before
infixes are split.

* Add `make_debug_doc()` to the Tokenizer

Add `make_debug_doc()` to the Tokenizer as a working implementation of
the pseudo-code in the docs.

Add a test (marked as slow) that checks that `nlp.tokenizer()` and
`nlp.tokenizer.make_debug_doc()` return the same non-whitespace tokens
for all languages that have `examples.sentences` that can be imported.

* Update tokenization usage docs

Update pseudo-code and algorithm description to correspond to
`nlp.tokenizer.make_debug_doc()` with example debugging usage.

Add more examples for customizing tokenizers while preserving the
existing defaults.

Minor edits / clarifications.

* Revert "Update Hungarian punctuation to remove empty string"

This reverts commit f0a577f7a5.

* Rework `make_debug_doc()` as `explain()`

Rework `make_debug_doc()` as `explain()`, which returns a list of
`(pattern_string, token_string)` tuples rather than a non-standard
`Doc`. Update docs and tests accordingly, leaving the visualization for
future work.

* Handle cases with bad tokenizer patterns

Detect when tokenizer patterns match empty prefixes and suffixes so that
`explain()` does not hang on bad patterns.

* Remove unused displacy image

* Add tokenizer.explain() to usage docs
2019-11-20 13:07:25 +01:00
..
101 Work around Markdown rendering issue surfaced in #4600 [ci skip] 2019-11-11 17:12:08 +01:00
_benchmarks-choi.md 💫 Update website (#3285) 2019-02-17 19:31:19 +01:00
adding-languages.md Update syntax iterators [ci skip] 2019-10-30 14:31:40 +01:00
examples.md Use consistent spelling 2019-10-02 10:37:39 +02:00
facts-figures.md Use consistent spelling 2019-10-02 10:37:39 +02:00
index.md Add CI for Python 3.8 (#4479) 2019-11-15 01:13:48 +01:00
linguistic-features.md Add tokenizer explain() debugging method (#4596) 2019-11-20 13:07:25 +01:00
models.md Update lemma data documentation [ci skip] 2019-10-01 13:22:13 +02:00
processing-pipelines.md Use consistent spelling 2019-10-02 10:37:39 +02:00
rule-based-matching.md Adjust order of docs sections [ci skip] 2019-11-17 16:08:56 +01:00
saving-loading.md Clarify serialization of extension attributes (closes #4377) [ci skip] 2019-10-05 11:58:00 +02:00
spacy-101.md Alphanumeric -> alphabetic [ci skip] 2019-10-06 13:30:01 +02:00
training.md Use consistent spelling 2019-10-02 10:37:39 +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 v2-2.md [ci skip] 2019-10-02 16:58:21 +02:00
v2.md Merge branch 'master' into develop 2019-09-14 16:42:01 +02:00
vectors-similarity.md Remove u-strings and fix formatting [ci skip] 2019-09-12 16:11:15 +02:00
visualizers.md Remove u-strings and fix formatting [ci skip] 2019-09-12 16:11:15 +02:00