mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 10:26:35 +03:00
1ee6541ab0
* Use morph for extra Japanese tokenizer info Previously Japanese tokenizer info that didn't correspond to Token fields was put in user data. Since spaCy core should avoid touching user data, this moves most information to the Token.morph attribute. It also adds the normalized form, which wasn't exposed before. The subtokens, which are a list of full tokens, are still added to user data, except with the default tokenizer granualarity. With the default tokenizer settings the subtokens are all None, so in this case the user data is simply not set. * Update tests Also adds a new test for norm data. * Update docs * Add Japanese morphologizer factory Set the default to `extend=True` so that the morphologizer does not clobber the values set by the tokenizer. * Use the norm_ field for normalized forms Before this commit, normalized forms were put in the "norm" field in the morph attributes. I am not sure why I did that instead of using the token morph, I think I just forgot about it. * Skip test if sudachipy is not installed * Fix import Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
10 lines
243 B
Python
10 lines
243 B
Python
import pytest
|
|
from spacy.lang.ja import Japanese
|
|
|
|
|
|
def test_ja_morphologizer_factory():
|
|
pytest.importorskip("sudachipy")
|
|
nlp = Japanese()
|
|
morphologizer = nlp.add_pipe("morphologizer")
|
|
assert morphologizer.cfg["extend"] is True
|