spaCy/spacy/tests/doc
Matthew Honnibal 63b7accd74
💫 Make span.as_doc() return a copy, not a view. Closes #1537 (#3107)
Initially span.as_doc() was designed to return a view of the span's contents, as a Doc object. This was a nice idea, but it fails due to the token.idx property, which refers to the character offset within the string. In a span, the idx of the first token might not be 0. Because this data is different, we can't have a view --- it'll be inconsistent.

This patch changes span.as_doc() to instead return a copy. The docs are updated accordingly. Closes #1537

* Update test for span.as_doc()

* Make span.as_doc() return a copy. Closes #1537

* Document change to Span.as_doc()
2018-12-30 15:17:46 +01:00
..
__init__.py Rename "tokens" tests to "doc" 2017-01-11 18:59:01 +01:00
test_add_entities.py Tidy up and format remaining files 2018-11-30 17:43:08 +01:00
test_array.py 💫 Tidy up and auto-format tests (#2967) 2018-11-27 01:09:36 +01:00
test_creation.py 💫 Tidy up and auto-format tests (#2967) 2018-11-27 01:09:36 +01:00
test_doc_api.py Merge branch 'master' into develop 2018-12-18 13:48:10 +01:00
test_pickle_doc.py Tidy up and format remaining files 2018-11-30 17:43:08 +01:00
test_span.py 💫 Make span.as_doc() return a copy, not a view. Closes #1537 (#3107) 2018-12-30 15:17:46 +01:00
test_span_merge.py Tidy up merge conflict leftovers 2018-12-18 13:58:30 +01:00
test_to_json.py 💫 New JSON helpers, training data internals & CLI rewrite (#2932) 2018-11-30 20:16:14 +01:00
test_token_api.py 💫 Tidy up and auto-format tests (#2967) 2018-11-27 01:09:36 +01:00
test_underscore.py Tidy up and format remaining files 2018-11-30 17:43:08 +01:00