spaCy/spacy/syntax
adrianeboyd 392c4880d9 Restructure Example with merged sents as default (#4632)
* Switch to train_dataset() function in train CLI

* Fixes for pipe() methods in pipeline components

* Don't clobber `examples` variable with `as_example` in pipe() methods
* Remove unnecessary traversals of `examples`

* Update Parser.pipe() for Examples

* Add `as_examples` kwarg to `pipe()` with implementation to return
`Example`s

* Accept `Doc` or `Example` in `pipe()` with `_get_doc()` (copied from
`Pipe`)

* Fixes to Example implementation in spacy.gold

* Move `make_projective` from an attribute of Example to an argument of
`Example.get_gold_parses()`

* Head of 0 are not treated as unset

* Unset heads are set to self rather than `None` (which causes problems
while projectivizing)

* Check for `Doc` (not just not `None`) when creating GoldParses for
pre-merged example

* Don't clobber `examples` variable in `iter_gold_docs()`

* Add/modify gold tests for handling projectivity

* In JSON roundtrip compare results from `dev_dataset` rather than
`train_dataset` to avoid projectivization (and other potential
modifications)

* Add test for projective train vs. nonprojective dev versions of the
same `Doc`

* Handle ignore_misaligned as arg rather than attr

Move `ignore_misaligned` from an attribute of `Example` to an argument
to `Example.get_gold_parses()`, which makes it parallel to
`make_projective`.

Add test with old and new align that checks whether `ignore_misaligned`
errors are raised as expected (only for new align).

* Remove unused attrs from gold.pxd

Remove `ignore_misaligned` and `make_projective` from `gold.pxd`

* Restructure Example with merged sents as default

An `Example` now includes a single `TokenAnnotation` that includes all
the information from one `Doc` (=JSON `paragraph`). If required, the
individual sentences can be returned as a list of examples with
`Example.split_sents()` with no raw text available.

* Input/output a single `Example.token_annotation`

* Add `sent_starts` to `TokenAnnotation` to handle sentence boundaries

* Replace `Example.merge_sents()` with `Example.split_sents()`

* Modify components to use a single `Example.token_annotation`

  * Pipeline components
  * conllu2json converter

* Rework/rename `add_token_annotation()` and `add_doc_annotation()` to
`set_token_annotation()` and `set_doc_annotation()`, functions that set
rather then appending/extending.

* Rename `morphology` to `morphs` in `TokenAnnotation` and `GoldParse`

* Add getters to `TokenAnnotation` to supply default values when a given
attribute is not available

* `Example.get_gold_parses()` in `spacy.gold._make_golds()` is only
applied on single examples, so the `GoldParse` is returned saved in the
provided `Example` rather than creating a new `Example` with no other
internal annotation

* Update tests for API changes and `merge_sents()` vs. `split_sents()`

* Refer to Example.goldparse in iter_gold_docs()

Use `Example.goldparse` in `iter_gold_docs()` instead of `Example.gold`
because a `None` `GoldParse` is generated with ignore_misaligned and
generating it on-the-fly can raise an unwanted AlignmentError

* Fix make_orth_variants()

Fix bug in make_orth_variants() related to conversion from multiple to
one TokenAnnotation per Example.

* Add basic test for make_orth_variants()

* Replace try/except with conditionals

* Replace default morph value with set
2019-11-25 16:03:28 +01:00
..
__init__.pxd * Work on greedy parser 2014-12-16 22:46:55 +11:00
__init__.py * Work on greedy parser 2014-12-16 22:46:55 +11:00
_beam_utils.pxd Export hash_state from beam_utils 2019-03-15 15:20:28 +01:00
_beam_utils.pyx Use hash_state in beam 2019-03-15 15:22:58 +01:00
_parser_model.pxd Free pointers in parser activations (#4486) 2019-10-22 15:06:44 +02:00
_parser_model.pyx Clarify parser model CPU/GPU code (#4535) 2019-10-27 23:43:09 +01:00
_state.pxd Replace Entity/MatchStruct with SpanC (#4459) 2019-10-18 11:01:47 +02:00
_state.pyx Tidy up syntax 2017-10-27 19:45:57 +02:00
arc_eager.pxd WIP on stringstore change. 27 failures 2017-05-28 14:06:40 +02:00
arc_eager.pyx Restructure Example with merged sents as default (#4632) 2019-11-25 16:03:28 +01:00
ner.pxd WIP on stringstore change. 27 failures 2017-05-28 14:06:40 +02:00
ner.pyx Restructure Example with merged sents as default (#4632) 2019-11-25 16:03:28 +01:00
nn_parser.pxd 💫 Better support for semi-supervised learning (#3035) 2018-12-10 16:25:33 +01:00
nn_parser.pyx Fix Example details for train CLI / pipeline components (#4624) 2019-11-23 14:32:15 +01:00
nonproj.pxd integrated pseudo-projective parsing into parser 2016-03-01 10:09:08 +01:00
nonproj.pyx Restructure Example with merged sents as default (#4632) 2019-11-25 16:03:28 +01:00
stateclass.pxd Replace Entity/MatchStruct with SpanC (#4459) 2019-10-18 11:01:47 +02:00
stateclass.pyx Fix memory leak in beam parser 2017-11-14 02:11:40 +01:00
transition_system.pxd Revert "Merge branch 'develop' of https://github.com/explosion/spaCy into develop" 2018-03-27 19:23:02 +02:00
transition_system.pyx prevent zero-length mem alloc (#4429) 2019-10-22 16:54:33 +02:00