spaCy/spacy/pipeline
kadarakos 1bb87f35bc
Detect cycle during projectivize (#10877)
* detect cycle during projectivize

* not complete test to detect cycle in projectivize

* boolean to int type to propagate error

* use unordered_set instead of set

* moved error message to errors

* removed cycle from test case

* use find instead of count

* cycle check: only perform one lookup

* Return bool again from _has_head_as_ancestor

Communicate presence of cycles through an output argument.

* Switch to returning std::pair to encode presence of a cycle

The has_cycle pointer is too easy to misuse. Ideally, we would have a
sum type like Rust's `Result` here, but C++ is not there yet.

* _is_non_proj_arc: clarify what we are returning

* _has_head_as_ancestor: remove count

We are now explicitly checking for cycles, so the algorithm must always
terminate. Either we encounter the head, we find a root, or a cycle.

* _is_nonproj_arc: simplify condition

* Another refactor using C++ exceptions

* Remove unused error code

* Print graph with cycle on exception

* Include .hh files in source package

* Add FIXME comment

* cycle detection test

* find cycle when starting from problematic vertex

Co-authored-by: Daniël de Kok <me@danieldk.eu>
2022-06-08 19:34:11 +02:00
..
_edit_tree_internals Refactor error messages to remove hardcoded strings (#10729) 2022-05-02 13:38:46 +02:00
_parser_internals Detect cycle during projectivize (#10877) 2022-06-08 19:34:11 +02:00
legacy
__init__.py Add SpanRuler component (#9880) 2022-06-02 13:12:53 +02:00
attributeruler.py
dep_parser.pyx
edit_tree_lemmatizer.py Fix issues for Mypy 0.950 and Pydantic 1.9.0 (#10786) 2022-05-25 09:33:54 +02:00
entity_linker.py
entityruler.py
functions.py
lemmatizer.py
morphologizer.pyx
multitask.pyx
ner.pyx
pipe.pxd
pipe.pyi
pipe.pyx fix typo + CI slow testing (#10835) 2022-06-02 00:10:16 +02:00
sentencizer.pyx
senter.pyx Tagger: use unnormalized probabilities for inference (#10197) 2022-03-15 14:15:31 +01:00
span_ruler.py
spancat.py
tagger.pyx
textcat.py
textcat_multilabel.py Fix Scorer.score_cats for missing labels (#9443) 2021-12-29 11:04:39 +01:00
tok2vec.py Fix Tok2Vec for empty batches (#10324) 2022-02-21 10:22:36 +01:00
trainable_pipe.pxd
trainable_pipe.pyx
transition_parser.pxd Parser: use C saxpy/sgemm provided by the Ops implementation (#10773) 2022-05-27 11:20:52 +02:00
transition_parser.pyx