spaCy/spacy
Paul O'Leary McCann 410fb7ee43
Add Japanese Model (#5544)
* Add more rules to deal with Japanese UD mappings

Japanese UD rules sometimes give different UD tags to tokens with the
same underlying POS tag. The UD spec indicates these cases should be
disambiguated using the output of a tool called "comainu", but rules are
enough to get the right result.

These rules are taken from Ginza at time of writing, see #3756.

* Add new tags from GSD

This is a few rare tags that aren't in Unidic but are in the GSD data.

* Add basic Japanese sentencization

This code is taken from Ginza again.

* Add sentenceizer quote handling

Could probably add more paired characters but this will do for now. Also
includes some tests.

* Replace fugashi with SudachiPy

* Modify tag format to match GSD annotations

Some of the tests still need to be updated, but I want to get this up
for testing training.

* Deal with case with closing punct without opening

* refactor resolve_pos()

* change tag field separator from "," to "-"

* add TAG_ORTH_MAP

* add TAG_BIGRAM_MAP

* revise rules for 連体詞

* revise rules for 連体詞

* improve POS about 2%

* add syntax_iterator.py (not mature yet)

* improve syntax_iterators.py

* improve syntax_iterators.py

* add phrases including nouns and drop NPs consist of STOP_WORDS

* First take at noun chunks

This works in many situations but still has issues in others.

If the start of a subtree has no noun, then nested phrases can be
generated.

    また行きたい、そんな気持ちにさせてくれるお店です。
    [そんな気持ち, また行きたい、そんな気持ちにさせてくれるお店]

For some reason て gets included sometimes. Not sure why.

    ゲンに連れ添って円盤生物を調査するパートナーとなる。
    [て円盤生物, ...]

Some phrases that look like they should be split are grouped together;
not entirely sure that's wrong. This whole thing becomes one chunk:

    道の駅遠山郷北側からかぐら大橋南詰現道交点までの1.060kmのみ開通済み

* Use new generic get_words_and_spaces

The new get_words_and_spaces function is simpler than what was used in
Japanese, so it's good to be able to switch to it. However, there was an
issue. The new function works just on text, so POS info could get out of
sync. Fixing this required a small change to the way dtokens (tokens
with POS and lemma info) were generated.

Specifically, multiple extraneous spaces now become a single token, so
when generating dtokens multiple space tokens should be created in a
row.

* Fix noun_chunks, should be working now

* Fix some tests, add naughty strings tests

Some of the existing tests changed because the tokenization mode of
Sudachi changed to the more fine-grained A mode.

Sudachi also has issues with some strings, so this adds a test against
the naughty strings.

* Remove empty Sudachi tokens

Not doing this creates zero-length tokens and causes errors in the
internal spaCy processing.

* Add yield_bunsetu back in as a separate piece of code

Co-authored-by: Hiroshi Matsuda <40782025+hiroshi-matsuda-rit@users.noreply.github.com>
Co-authored-by: hiroshi <hiroshi_matsuda@megagon.ai>
2020-06-04 19:15:43 +02:00
..
cli prevent loading a pretrained Tok2Vec layer AND pretrained components 2020-05-29 17:38:33 +02:00
data Make spacy/data a package 2017-03-18 20:04:22 +01:00
displacy Add missing import 2020-04-28 13:48:37 +02:00
lang Add Japanese Model (#5544) 2020-06-04 19:15:43 +02:00
matcher Switch to new add API in PhraseMatcher unpickle 2020-05-25 11:22:47 +02:00
ml Replace function registries with catalogue (#4584) 2019-11-07 11:45:22 +01:00
pipeline Preserve _SP when filtering tag map in Tagger 2020-05-31 19:57:54 +02:00
syntax Revert "Remove peeking from Parser.begin_training (#5456)" 2020-05-29 23:21:55 +02:00
tests Add Japanese Model (#5544) 2020-06-04 19:15:43 +02:00
tokens Remove MorphAnalysis __str__ and __repr__ 2020-05-29 14:33:47 +02:00
__init__.pxd * Seems to be working after refactor. Need to wire up more POS tag features, and wire up save/load of POS tags. 2014-10-24 02:23:42 +11:00
__init__.py Simplify warnings 2020-04-28 13:37:37 +02:00
__main__.py Use latest wasabi 2019-11-04 02:38:45 +01:00
_ml.py Skip duplicate lexeme rank setting (#5401) 2020-05-14 18:26:12 +02:00
about.py Switch to v2.3.0.dev0 2020-05-25 12:57:20 +02:00
analysis.py Simplify warnings 2020-04-28 13:37:37 +02:00
attrs.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
attrs.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
compat.py Replace function registries with catalogue (#4584) 2019-11-07 11:45:22 +01:00
errors.py Add rudimentary version checks on model load 2020-06-02 17:33:48 +02:00
glossary.py Update tag maps and docs for English and German (#4501) 2019-10-24 12:56:05 +02:00
gold.pxd Merge changes from master 2019-08-21 14:18:52 +02:00
gold.pyx Add warning for misaligned character offset spans (#5007) 2020-05-19 16:01:18 +02:00
kb.pxd Tidy up and avoid absolute spacy imports in core 2020-05-21 20:05:03 +02:00
kb.pyx Merge pull request #5264 from lfiedler/issue-5230 2020-05-22 00:31:07 +02:00
language.py Improve vector name loading from model meta 2020-05-27 14:48:54 +02:00
lemmatizer.py Return lowercase form as default except for PROPN 2020-05-20 15:35:08 +02:00
lexeme.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
lexeme.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
lookups.py Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
morphology.pxd annotate kb_id through ents in doc 2019-03-22 11:36:44 +01:00
morphology.pyx Prefer _SP over SP for default tag map space attrs 2020-05-26 14:57:13 +02:00
parts_of_speech.pxd Add support for Universal Dependencies v2.0 2017-03-03 13:17:34 +01:00
parts_of_speech.pyx Tidy up rest 2017-10-27 21:07:59 +02:00
scorer.py Fix GoldParse init when token count differs (#5191) 2020-03-26 10:46:23 +01:00
strings.pxd Try to fix StringStore clean up (see #1506) 2017-11-11 03:11:27 +03:00
strings.pyx Merge branch 'master' into feature/lemmatizer 2019-03-16 13:44:22 +01:00
structs.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
symbols.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
symbols.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
tokenizer.pxd Rename to url_match 2020-05-22 12:41:03 +02:00
tokenizer.pyx Rename to url_match 2020-05-22 12:41:03 +02:00
typedefs.pxd Work on changing StringStore to return hashes. 2017-05-28 12:36:27 +02:00
typedefs.pyx Tidy up rest 2017-10-27 21:07:59 +02:00
util.py Remove unnecessary check 2020-06-02 17:41:25 +02:00
vectors.pyx fix deserialization order 2020-05-30 12:53:32 +02:00
vocab.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
vocab.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00