Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

suparunidic

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

suparunidic

Tokenizer POS-tagger Lemmatizer and Dependency-parser for modern and contemporary Japanese with BERT models

  • 1.4.2
  • Source
  • PyPI
  • Socket score

Maintainers
1

Current PyPI packages

SuPar-UniDic

Tokenizer, POS-tagger, lemmatizer, and dependency-parser for modern and contemporary Japanese with BERT models.

Basic usage

>>> import suparunidic
>>> nlp=suparunidic.load()
>>> doc=nlp("太郎は花子が読んでいる本を次郎に渡した")
>>> print(type(doc))
<class 'spacy.tokens.doc.Doc'>
>>> print(suparunidic.to_conllu(doc))
1	太郎	タロウ	PROPN	名詞-固有名詞-人名-名	_	12	nsubj	_	SpaceAfter=No|Translit=タロー
2	は	は	ADP	助詞-係助詞	_	1	case	_	SpaceAfter=No|Translit=ワ
3	花子	ハナコ	PROPN	名詞-固有名詞-人名-名	_	5	nsubj	_	SpaceAfter=No|Translit=ハナコ
4	が	が	ADP	助詞-格助詞	_	3	case	_	SpaceAfter=No|Translit=ガ
5	読ん	読む	VERB	動詞-一般	_	8	acl	_	SpaceAfter=No|Translit=ヨン
6	で	て	SCONJ	助詞-接続助詞	_	5	mark	_	SpaceAfter=No|Translit=デ
7	いる	居る	AUX	動詞-非自立可能	_	5	aux	_	SpaceAfter=No|Translit=イル
8	本	本	NOUN	名詞-普通名詞-一般	_	12	obj	_	SpaceAfter=No|Translit=ホン
9	を	を	ADP	助詞-格助詞	_	8	case	_	SpaceAfter=No|Translit=オ
10	次郎	ジロウ	PROPN	名詞-固有名詞-人名-名	_	12	obl	_	SpaceAfter=No|Translit=ジロー
11	に	に	ADP	助詞-格助詞	_	10	case	_	SpaceAfter=No|Translit=ニ
12	渡し	渡す	VERB	動詞-一般	_	0	root	_	SpaceAfter=No|Translit=ワタシ
13	た	た	AUX	助動詞	_	12	aux	_	SpaceAfter=No|Translit=タ

>>> import deplacy
>>> deplacy.render(doc,Japanese=True)
太郎 PROPN ═╗<════════╗ nsubj(主語)
は   ADP   <╝         ║ case(格表示)
花子 PROPN ═╗<══╗     ║ nsubj(主語)
が   ADP   <╝   ║     ║ case(格表示)
読ん VERB  ═╗═╗═╝<╗   ║ acl(連体修飾節)
で   SCONJ <╝ ║   ║   ║ mark(標識)
いる AUX   <══╝   ║   ║ aux(動詞補助成分)
本   NOUN  ═╗═════╝<╗ ║ obj(目的語)
を   ADP   <╝       ║ ║ case(格表示)
次郎 PROPN ═╗<╗     ║ ║ obl(斜格補語)
に   ADP   <╝ ║     ║ ║ case(格表示)
渡し VERB  ═╗═╝═════╝═╝ ROOT(親)
た   AUX   <╝           aux(動詞補助成分)
>>> from deplacy.deprelja import deprelja
>>> for b in suparunidic.bunsetu_spans(doc):
...   for t in b.lefts:
...     print(suparunidic.bunsetu_span(t),"->",b,"("+deprelja[t.dep_]+")")
...
花子が -> 読んでいる (主語)
読んでいる -> 本を (連体修飾節)
太郎は -> 渡した (主語)
本を -> 渡した (目的語)
次郎に -> 渡した (斜格補語)

suparunidic.load(UniDic,BERT) loads a natural language processor pipeline, which uses UniDic for tokenizer POS-tagger and lemmatizer, then uses BERT for Biaffine dependency-parser of SuPar. Available UniDic options are:

Available BERT options are:

Installation for Linux

pip3 install suparunidic --user

Installation for Cygwin64

Make sure to get python37-devel python37-pip python37-cython python37-numpy python37-wheel gcc-g++ mingw64-x86_64-gcc-g++ git curl make cmake, and then:

curl -L https://raw.githubusercontent.com/KoichiYasuoka/CygTorch/master/installer/supar.sh | sh
pip3.7 install suparunidic

Benchmarks

Results of 舞姬/雪國/荒野より-Benchmarks

BERT="bert-japanese-aozora6m3m-unidic32k-2m"

舞姬LASMLASBLEX
UniDic="qkana"84.9174.0777.78
UniDic="kindai"74.7769.0969.09
UniDic="kinsei"83.0266.6770.37
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5166.67
UniDic="kinsei"78.9567.9264.15
荒野よりLASMLASBLEX
UniDic="qkana"74.3556.0056.00
UniDic="kindai"74.3553.3353.33
UniDic="kinsei"70.8350.0047.37

BERT="roberta-large-japanese-aozora"

舞姬LASMLASBLEX
UniDic="qkana"75.4758.1865.45
UniDic="kindai"75.4758.1865.45
UniDic="kinsei"66.6752.6356.14
雪國LASMLASBLEX
UniDic="qkana"87.5082.3578.43
UniDic="kindai"83.1978.4374.51
UniDic="kinsei"87.5082.3574.51
荒野よりLASMLASBLEX
UniDic="qkana"80.6364.9459.74
UniDic="kindai"80.6362.3457.14
UniDic="kinsei"78.1259.7454.55

BERT="roberta-large-japanese-aozora-char"

舞姬LASMLASBLEX
UniDic="qkana"79.2569.0976.36
UniDic="kindai"79.2569.0976.36
UniDic="kinsei"68.5259.6563.16
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5170.59
UniDic="kinsei"85.7178.4370.59
荒野よりLASMLASBLEX
UniDic="qkana"76.4461.3361.33
UniDic="kindai"76.4461.3361.33
UniDic="kinsei"72.9256.0056.00

BERT="roberta-base-japanese-aozora"

舞姬LASMLASBLEX
UniDic="qkana"79.2565.4572.73
UniDic="kindai"79.2565.4572.73
UniDic="kinsei"68.5260.7164.29
雪國LASMLASBLEX
UniDic="qkana"87.5082.3578.43
UniDic="kindai"83.1978.4374.51
UniDic="kinsei"87.5082.3574.51
荒野よりLASMLASBLEX
UniDic="qkana"76.4458.6761.33
UniDic="kindai"76.4456.0058.67
UniDic="kinsei"73.9653.3356.00

BERT="roberta-base-japanese-aozora-char"

舞姬LASMLASBLEX
UniDic="qkana"83.0270.3777.78
UniDic="kindai"83.0270.3777.78
UniDic="kinsei"74.0765.4569.09
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5170.59
UniDic="kinsei"85.7178.4370.59
荒野よりLASMLASBLEX
UniDic="qkana"76.4457.8957.89
UniDic="kindai"76.4455.2655.26
UniDic="kinsei"73.9652.6352.63

BERT="roberta-small-japanese-aozora"

舞姬LASMLASBLEX
UniDic="qkana"83.0272.7376.36
UniDic="kindai"83.0272.7376.36
UniDic="kinsei"70.3760.7164.29
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5170.59
UniDic="kinsei"85.7178.4370.59
荒野よりLASMLASBLEX
UniDic="qkana"74.3556.0056.00
UniDic="kindai"74.3553.3353.33
UniDic="kinsei"71.8850.6750.67

BERT="roberta-small-japanese-aozora-char"

舞姬LASMLASBLEX
UniDic="qkana"77.3665.4572.73
UniDic="kindai"77.3665.4572.73
UniDic="kinsei"70.3759.6563.16
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5170.59
UniDic="kinsei"85.7178.4370.59
荒野よりLASMLASBLEX
UniDic="qkana"73.3053.3353.33
UniDic="kindai"73.3050.6750.67
UniDic="kinsei"70.8348.0048.00

BERT="deberta-large-japanese-aozora"

舞姬LASMLASBLEX
UniDic="qkana"84.9174.0777.78
UniDic="kindai"76.6472.7369.09
UniDic="kinsei"81.1366.6770.37
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5166.67
UniDic="kinsei"78.9567.9264.15
荒野よりLASMLASBLEX
UniDic="qkana"77.4961.3361.33
UniDic="kindai"77.4958.6758.67
UniDic="kinsei"73.9655.2652.63

BERT="deberta-base-japanese-aozora"

舞姬LASMLASBLEX
UniDic="qkana"86.7977.7877.78
UniDic="kindai"76.6472.7369.09
UniDic="kinsei"81.1365.4565.45
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"83.1978.4370.59
UniDic="kinsei"78.9567.9264.15
荒野よりLASMLASBLEX
UniDic="qkana"72.2553.3353.33
UniDic="kindai"72.2550.6750.67
UniDic="kinsei"69.7950.0047.37

BERT="deberta-small-japanese-aozora"

舞姬LASMLASBLEX
UniDic="qkana"75.4760.7164.29
UniDic="kindai"67.2959.6556.14
UniDic="kinsei"71.7050.9154.55
雪國LASMLASBLEX
UniDic="qkana"83.9374.5170.59
UniDic="kindai"79.6570.5962.75
UniDic="kinsei"77.1964.1560.38
荒野よりLASMLASBLEX
UniDic="qkana"75.3956.0056.00
UniDic="kindai"75.3956.0056.00
UniDic="kinsei"71.8852.6350.00

BERT="deberta-base-japanese-unidic"

舞姬LASMLASBLEX
UniDic="qkana"86.7977.7877.78
UniDic="kindai"76.6472.7369.09
UniDic="kinsei"79.2560.7160.71
雪國LASMLASBLEX
UniDic="qkana"83.9376.0072.00
UniDic="kindai"79.6572.0064.00
UniDic="kinsei"77.1965.3861.54
荒野よりLASMLASBLEX
UniDic="qkana"77.4961.3361.33
UniDic="kindai"77.4958.6758.67
UniDic="kinsei"73.9655.2652.63

BERT="bert-base-japanese-char-extended"

舞姬LASMLASBLEX
UniDic="qkana"81.1372.7376.36
UniDic="kindai"81.1372.7376.36
UniDic="kinsei"68.5259.6563.16
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5170.59
UniDic="kinsei"85.7178.4370.59
荒野よりLASMLASBLEX
UniDic="qkana"75.3956.0056.00
UniDic="kindai"75.3953.3353.33
UniDic="kinsei"71.8848.0048.00

BERT="bert-large-japanese-char-extended"

舞姬LASMLASBLEX
UniDic="qkana"75.4764.2971.43
UniDic="kindai"75.4764.2971.43
UniDic="kinsei"64.8155.1762.07
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5170.59
UniDic="kinsei"85.7178.4370.59
荒野よりLASMLASBLEX
UniDic="qkana"78.5364.0064.00
UniDic="kindai"78.5361.3361.33
UniDic="kinsei"76.0458.6758.67

BERT="bert-base-japanese-char"

舞姬LASMLASBLEX
UniDic="qkana"77.3664.2971.43
UniDic="kindai"77.3664.2971.43
UniDic="kinsei"66.6755.1758.62
雪國LASMLASBLEX
UniDic="qkana"78.5772.0068.00
UniDic="kindai"74.3468.0064.00
UniDic="kinsei"78.5772.0064.00
荒野よりLASMLASBLEX
UniDic="qkana"75.3958.6758.67
UniDic="kindai"75.3956.0056.00
UniDic="kinsei"72.9253.3353.33

BERT="bert-base-japanese-whole-word-masking"

舞姬LASMLASBLEX
UniDic="qkana"73.5857.1464.29
UniDic="kindai"73.5857.1464.29
UniDic="kinsei"64.8151.7255.17
雪國LASMLASBLEX
UniDic="qkana"85.7182.3578.43
UniDic="kindai"76.1173.0869.23
UniDic="kinsei"85.7182.3574.51
荒野よりLASMLASBLEX
UniDic="qkana"73.3052.6352.63
UniDic="kindai"73.3052.6352.63
UniDic="kinsei"69.7950.0050.00

BERT="bert-large-japanese"

舞姬LASMLASBLEX
UniDic="qkana"79.2565.4572.73
UniDic="kindai"79.2565.4572.73
UniDic="kinsei"68.5256.1459.65
雪國LASMLASBLEX
UniDic="qkana"78.5776.9273.08
UniDic="kindai"74.3473.0869.23
UniDic="kinsei"78.5776.9269.23
荒野よりLASMLASBLEX
UniDic="qkana"78.5359.7457.14
UniDic="kindai"78.5357.1454.55
UniDic="kinsei"77.0854.5551.95

BERT="bert-large-japanese-char"

舞姬LASMLASBLEX
UniDic="qkana"79.2569.0972.73
UniDic="kindai"79.2569.0972.73
UniDic="kinsei"68.5259.6563.16
雪國LASMLASBLEX
UniDic="qkana"80.3670.5970.59
UniDic="kindai"76.1166.6766.67
UniDic="kinsei"80.3670.5966.67
荒野よりLASMLASBLEX
UniDic="qkana"74.3553.3353.33
UniDic="kindai"74.3550.6750.67
UniDic="kinsei"71.8848.0048.00

BERT="roberta-base-japanese"

舞姬LASMLASBLEX
UniDic="qkana"83.0272.7376.36
UniDic="kindai"83.0272.7376.36
UniDic="kinsei"72.2263.1666.67
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"83.1978.4374.51
UniDic="kinsei"85.7178.4370.59
荒野よりLASMLASBLEX
UniDic="qkana"72.2551.3551.35
UniDic="kindai"72.2551.3551.35
UniDic="kinsei"69.7948.6548.65

BERT="roberta-large-japanese"

舞姬LASMLASBLEX
UniDic="qkana"79.2565.4569.09
UniDic="kindai"69.1660.7157.14
UniDic="kinsei"73.5850.0053.57
雪國LASMLASBLEX
UniDic="qkana"85.7178.4374.51
UniDic="kindai"81.4274.5166.67
UniDic="kinsei"78.9567.9264.15
荒野よりLASMLASBLEX
UniDic="qkana"72.2557.8957.89
UniDic="kindai"72.2555.2655.26
UniDic="kinsei"68.7551.9549.35

BERT="electra-base-japanese-discriminator"

舞姬LASMLASBLEX
UniDic="qkana"75.4761.8269.09
UniDic="kindai"75.4761.8269.09
UniDic="kinsei"64.8152.6356.14
雪國LASMLASBLEX
UniDic="qkana"87.5082.3578.43
UniDic="kindai"83.1978.4374.51
UniDic="kinsei"87.5082.3574.51
荒野よりLASMLASBLEX
UniDic="qkana"73.3050.6750.67
UniDic="kindai"73.3050.6750.67
UniDic="kinsei"70.8348.0048.00

BERT="bert-small-japanese"

舞姬LASMLASBLEX
UniDic="qkana"79.2562.9670.37
UniDic="kindai"79.2562.9670.37
UniDic="kinsei"70.3757.1460.71
雪國LASMLASBLEX
UniDic="qkana"76.7973.0869.23
UniDic="kindai"72.5769.2365.38
UniDic="kinsei"76.7973.0865.38
荒野よりLASMLASBLEX
UniDic="qkana"72.2547.3747.37
UniDic="kindai"72.2547.3747.37
UniDic="kinsei"69.7942.6745.33

BERT="electra-base-japanese-generator"

舞姬LASMLASBLEX
UniDic="qkana"77.3664.2971.43
UniDic="kindai"77.3664.2971.43
UniDic="kinsei"68.5258.6262.07
雪國LASMLASBLEX
UniDic="qkana"76.7973.0869.23
UniDic="kindai"72.5769.2365.38
UniDic="kinsei"76.7973.0865.38
荒野よりLASMLASBLEX
UniDic="qkana"69.1145.3345.33
UniDic="kindai"69.1145.3345.33
UniDic="kinsei"66.6742.6742.67

BERT="japanese-roberta-base"

舞姬LASMLASBLEX
UniDic="qkana"73.5857.1464.29
UniDic="kindai"73.5857.1464.29
UniDic="kinsei"64.8151.7255.17
雪國LASMLASBLEX
UniDic="qkana"87.5082.3578.43
UniDic="kindai"83.1978.4374.51
UniDic="kinsei"87.5082.3574.51
荒野よりLASMLASBLEX
UniDic="qkana"74.3550.0047.37
UniDic="kindai"74.3547.3744.74
UniDic="kinsei"71.8844.7442.11

BERT="albert-japanese-v2"

舞姬LASMLASBLEX
UniDic="qkana"77.3664.2971.43
UniDic="kindai"77.3664.2971.43
UniDic="kinsei"66.6755.1758.62
雪國LASMLASBLEX
UniDic="qkana"76.7973.0869.23
UniDic="kindai"72.5769.2365.38
UniDic="kinsei"76.7973.0865.38
荒野よりLASMLASBLEX
UniDic="qkana"73.3051.9549.35
UniDic="kindai"73.3049.3546.75
UniDic="kinsei"69.7946.7544.16

BERT="albert-base-japanese-v1"

舞姬LASMLASBLEX
UniDic="qkana"73.5857.1464.29
UniDic="kindai"73.5857.1464.29
UniDic="kinsei"64.8151.7255.17
雪國LASMLASBLEX
UniDic="qkana"76.7973.0869.23
UniDic="kindai"74.3469.2365.38
UniDic="kinsei"76.7973.0865.38
荒野よりLASMLASBLEX
UniDic="qkana"65.9742.6742.67
UniDic="kindai"65.9740.0040.00
UniDic="kinsei"64.5839.4739.47

BERT="electra-small-japanese-discriminator"

舞姬LASMLASBLEX
UniDic="qkana"73.5857.1464.29
UniDic="kindai"73.5857.1464.29
UniDic="kinsei"62.9648.2851.72
雪國LASMLASBLEX
UniDic="qkana"73.2169.2365.38
UniDic="kindai"70.8065.3861.54
UniDic="kinsei"73.2169.2361.54
荒野よりLASMLASBLEX
UniDic="qkana"74.3550.0047.37
UniDic="kindai"74.3550.0047.37
UniDic="kinsei"72.9250.0047.37

BERT="electra-small-japanese-generator"

舞姬LASMLASBLEX
UniDic="qkana"73.5860.7164.29
UniDic="kindai"73.5860.7164.29
UniDic="kinsei"66.6755.1758.62
雪國LASMLASBLEX
UniDic="qkana"73.2169.2365.38
UniDic="kindai"70.8065.3861.54
UniDic="kinsei"73.2169.2361.54
荒野よりLASMLASBLEX
UniDic="qkana"69.1145.9545.95
UniDic="kindai"69.1143.2443.24
UniDic="kinsei"66.6740.5440.54

BERT="ku-bert-japanese-large"

舞姬LASMLASBLEX
UniDic="qkana"77.3665.4572.73
UniDic="kindai"77.3665.4572.73
UniDic="kinsei"64.8152.6359.65
雪國LASMLASBLEX
UniDic="qkana"82.1474.5170.59
UniDic="kindai"81.4274.5170.59
UniDic="kinsei"82.1474.5166.67
荒野よりLASMLASBLEX
UniDic="qkana"62.8339.4742.11
UniDic="kindai"62.8336.8439.47
UniDic="kinsei"62.5038.9641.56

BERT="bert-base-ja-cased"

舞姬LASMLASBLEX
UniDic="qkana"73.5858.1865.45
UniDic="kindai"73.5858.1865.45
UniDic="kinsei"64.8152.6356.14
雪國LASMLASBLEX
UniDic="qkana"73.2169.2365.38
UniDic="kindai"70.8065.3861.54
UniDic="kinsei"73.2169.2361.54
荒野よりLASMLASBLEX
UniDic="qkana"63.8741.5644.16
UniDic="kindai"63.8738.9641.56
UniDic="kinsei"61.4636.3638.96

BERT="laboro-bert-japanese-large"

舞姬LASMLASBLEX
UniDic="qkana"71.7056.1463.16
UniDic="kindai"71.7056.1463.16
UniDic="kinsei"62.9650.8554.24
雪國LASMLASBLEX
UniDic="qkana"71.4365.3865.38
UniDic="kindai"67.2661.5461.54
UniDic="kinsei"71.4365.3861.54
荒野よりLASMLASBLEX
UniDic="qkana"67.0242.6742.67
UniDic="kindai"67.0240.0040.00
UniDic="kinsei"65.6237.3337.33

BERT="nict-bert-base-japanese-100k"

舞姬LASMLASBLEX
UniDic="qkana"67.9249.1252.63
UniDic="kindai"67.9249.1252.63
UniDic="kinsei"57.4140.6844.07
雪國LASMLASBLEX
UniDic="qkana"82.1474.5174.51
UniDic="kindai"81.4274.5174.51
UniDic="kinsei"82.1474.5170.59
荒野よりLASMLASBLEX
UniDic="qkana"68.0641.1043.84
UniDic="kindai"68.0638.3641.10
UniDic="kinsei"65.6235.6238.36

BERT="unihanlm-base"

舞姬LASMLASBLEX
UniDic="qkana"69.8152.6359.65
UniDic="kindai"69.8152.6359.65
UniDic="kinsei"61.1147.4650.85
雪國LASMLASBLEX
UniDic="qkana"85.7178.4378.43
UniDic="kindai"79.6570.5970.59
UniDic="kinsei"85.7178.4374.51
荒野よりLASMLASBLEX
UniDic="qkana"61.7836.3638.96
UniDic="kindai"61.7836.3638.96
UniDic="kinsei"60.4236.3638.96

BERT="distilbert-base-japanese"

舞姬LASMLASBLEX
UniDic="qkana"77.3664.2971.43
UniDic="kindai"77.3664.2971.43
UniDic="kinsei"68.5258.6262.07
雪國LASMLASBLEX
UniDic="qkana"73.2169.2365.38
UniDic="kindai"70.8065.3861.54
UniDic="kinsei"73.2169.2361.54
荒野よりLASMLASBLEX
UniDic="qkana"63.8734.6740.00
UniDic="kindai"63.8732.0037.33
UniDic="kinsei"62.5034.2136.84

Author

Koichi Yasuoka (安岡孝一)

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc