0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

英語係り受け解析モデルmodernbert-base-english-ud-triangularリリース

Last updated at Posted at 2025-01-19

『青空文庫ModernBERTモデルによる国語研長単位係り受け解析』(情報処理学会研究報告Vol.2025-CH-137『人文科学とコンピュータ』2025年2月8日掲載予定)を横目に、英語係り受け解析モデル「modernbert-base-english-ud-triangular」を試作してみた。Google Colaboratoryで動かしてみよう。

!pip install transformers triton deplacy
from transformers import pipeline
nlp=pipeline("universal-dependencies","KoichiYasuoka/modernbert-base-english-ud-triangular",trust_remote_code=True,aggregation_strategy="simple")
doc=nlp("It don't mean a thing if it ain't got that swing")
import deplacy
deplacy.serve(doc,port=None)

「It don't mean a thing if it ain't got that swing」を係り受け解析してみたところ、私(安岡孝一)の手元では、以下の結果が出力された。

# text = It don't mean a thing if it ain't got that swing
1	It	_	PRON	_	Case=Nom|Gender=Neut|Number=Sing|Person=3|PronType=Prs	4	nsubj	_	_
2	do	_	AUX	_	Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin	4	aux	_	SpaceAfter=No
3	n't	_	PART	_	Polarity=Neg	4	advmod	_	_
4	mean	_	VERB	_	VerbForm=Inf	0	root	_	_
5	a	_	DET	_	Definite=Ind|PronType=Art	6	det	_	_
6	thing	_	NOUN	_	Number=Sing	4	obj	_	_
7	if	_	SCONJ	_	_	11	mark	_	_
8	it	_	PRON	_	Case=Nom|Gender=Neut|Number=Sing|Person=3|PronType=Prs	11	nsubj	_	_
9	ai	_	AUX	_	Mood=Ind|Number=Sing|Person=1|Tense=Pres|Typo=Yes|VerbForm=Fin	11	aux	_	SpaceAfter=No
10	n't	_	PART	_	Polarity=Neg	11	advmod	_	_
11	got	_	VERB	_	Tense=Past|VerbForm=Part	4	advcl	_	_
12	that	_	DET	_	Number=Sing|PronType=Dem	13	det	_	_
13	swing	_	NOUN	_	Number=Sing	11	obj	_	SpaceAfter=No

en.png

トークナイザに手を入れた結果、昨年12月28日の記事に較べて、「don't」や「ain't」が良くなっている。間引きした上三角行列による係り受け解析も、うまく動いているようだ。ただ、さすがに200×200を超える上三角行列は、たとえ間引いても8192トークンに乗らない感じなので、そのあたり、もう少しアイデアが必要かな。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?