spaCy/spacy
adrianeboyd adc9745718 Modify morphology to support arbitrary features (#4932)
* Restructure tag maps for MorphAnalysis changes

Prepare tag maps for upcoming MorphAnalysis changes that allow
arbritrary features.

* Use default tag map rather than duplicating for ca / uk / vi

* Import tag map into defaults for ga

* Modify tag maps so all morphological fields and features are strings
  * Move features from `"Other"` to the top level
  * Rewrite tuples as strings separated by `","`

* Rewrite morph symbols for fr lemmatizer as strings

* Export MorphAnalysis under spacy.tokens

* Modify morphology to support arbitrary features

Modify `Morphology` and `MorphAnalysis` so that arbitrary features are
supported.

* Modify `MorphAnalysisC` so that it can support arbitrary features and
multiple values per field. `MorphAnalysisC` is redesigned to contain:
  * key: hash of UD FEATS string of morphological features
  * array of `MorphFeatureC` structs that each contain a hash of `Field`
and `Field=Value` for a given morphological feature, which makes it
possible to:
    * find features by field
    * represent multiple values for a given field

* `get_field()` is renamed to `get_by_field()` and is no longer `nogil`.
Instead a new helper function `get_n_by_field()` is `nogil` and returns
`n` features by field.

* `MorphAnalysis.get()` returns all possible values for a field as a
list of individual features such as `["Tense=Pres", "Tense=Past"]`.

* `MorphAnalysis`'s `str()` and `repr()` are the UD FEATS string.

* `Morphology.feats_to_dict()` converts a UD FEATS string to a dict
where:
  * Each field has one entry in the dict
  * Multiple values remain separated by a separator in the value string

* `Token.morph_` returns the UD FEATS string and you can set
`Token.morph_` with a UD FEATS string or with a tag map dict.

* Modify get_by_field to use np.ndarray

Modify `get_by_field()` to use np.ndarray. Remove `max_results` from
`get_n_by_field()` and always iterate over all the fields.

* Rewrite without MorphFeatureC

* Add shortcut for existing feats strings as keys

Add shortcut for existing feats strings as keys in `Morphology.add()`.

* Check for '_' as empty analysis when adding morphs

* Extend helper converters in Morphology

Add and extend helper converters that convert and normalize between:

* UD FEATS strings (`"Case=dat,gen|Number=sing"`)
* per-field dict of feats (`{"Case": "dat,gen", "Number": "sing"}`)
* list of individual features (`["Case=dat", "Case=gen",
"Number=sing"]`)

All converters sort fields and values where applicable.
2020-01-23 22:01:54 +01:00
..
cli Improve train CLI sentrec scoring (#4892) 2020-01-08 16:52:14 +01:00
data
displacy Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
lang Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
matcher Add better schemas and validation using Pydantic (#4831) 2019-12-25 12:39:49 +01:00
ml Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
pipeline Add as_example to Sentencizer pipe() (#4933) 2020-01-22 15:40:31 +01:00
syntax More formatting changes 2019-12-25 17:59:52 +01:00
tests Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
tokens Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
__init__.pxd
__init__.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
__main__.py More formatting changes 2019-12-25 17:59:52 +01:00
_ml.py More formatting changes 2019-12-25 17:59:52 +01:00
about.py Update version [ci skip] 2019-11-21 18:19:37 +01:00
analysis.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
attrs.pxd Fix attrs alignment 2019-07-12 17:59:47 +02:00
attrs.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
compat.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
errors.py Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
glossary.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
gold.pxd Add lemmas to GoldParse / Example / docs_to_json (#4726) 2019-11-28 14:53:44 +01:00
gold.pyx Fix gold training (#4938) 2020-01-23 22:00:24 +01:00
kb.pxd rename entity frequency 2019-07-19 17:40:28 +02:00
kb.pyx More formatting changes 2019-12-25 17:59:52 +01:00
language.py Add sentrec shortcut to Language (#4890) 2020-01-08 16:51:24 +01:00
lemmatizer.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
lexeme.pxd 💫 Support lexical attributes in retokenizer attrs (closes #2390) (#3325) 2019-02-24 21:13:51 +01:00
lexeme.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
lookups.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
morphology.pxd Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
morphology.pyx Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
parts_of_speech.pxd
parts_of_speech.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
schemas.py Add better schemas and validation using Pydantic (#4831) 2019-12-25 12:39:49 +01:00
scorer.py Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
strings.pxd
strings.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
structs.pxd Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
symbols.pxd Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
symbols.pyx Modify morphology to support arbitrary features (#4932) 2020-01-23 22:01:54 +01:00
tokenizer.pxd Generalize handling of tokenizer special cases (#4259) 2019-11-13 21:24:35 +01:00
tokenizer.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
typedefs.pxd
typedefs.pyx
util.py More formatting changes 2019-12-25 17:59:52 +01:00
vectors.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00
vocab.pxd 💫 WIP: Basic lookup class scaffolding and JSON for all lemmati… (#4167) 2019-08-22 14:21:32 +02:00
vocab.pyx Drop Python 2.7 and 3.5 (#4828) 2019-12-22 01:53:56 +01:00