ModernCamemBERT-baseをもとに、フランス語品詞付与・係り受け解析モデルmodernbert-base-french-ud-embedsを試作してみた。Google Colaboratoryで動かしてみよう。
!pip install transformers triton deplacy
from transformers import pipeline
nlp=pipeline("universal-dependencies","KoichiYasuoka/modernbert-base-french-ud-embeds",trust_remote_code=True)
doc=nlp("Il y a tout ce que vous voulez aux Champs-Elysées")
import deplacy
deplacy.serve(doc,port=None)
「Il y a tout ce que vous voulez aux Champs-Elysées」を係り受け解析してみたところ、私(安岡孝一)の手元では以下の結果が得られた。
# text = Il y a tout ce que vous voulez aux Champs-Elysées
1 Il _ PRON _ Emph=No|Gender=Masc|Number=Sing|Person=3|PronType=Prs 3 expl:subj _ _
2 y _ PRON _ Emph=No|Person=3|PronType=Prs 3 expl:comp _ _
3 a _ VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ _
4 tout _ ADJ _ Gender=Masc|Number=Sing|PronType=Ind 5 amod _ _
5 ce _ PRON _ Gender=Masc|Number=Sing|Person=3|PronType=Dem 3 obj _ _
6 que _ PRON _ PronType=Rel 8 obj _ _
7 vous _ PRON _ Number=Plur|Person=2|PronType=Prs 8 nsubj _ _
8 voulez _ VERB _ Mood=Ind|Number=Plur|Person=2|Tense=Pres|VerbForm=Fin 5 acl:relcl _ _
9-10 aux _ _ _ _ _ _ _ _
9 à _ ADP _ _ 11 case _ _
10 les _ DET _ Definite=Def|Number=Plur|PronType=Art 11 det _ _
11 Champs-Elysées _ PROPN _ Number=Plur 5 nmod _ SpaceAfter=No
うーん、惜しい。「Champs-Elysées」へのリンクは「ce」からnmodではなく、動詞の「voulez」か「a」からoblを引くべきだと思う。それ以外は、ちゃんと「aux」を「à」「les」に分解できているし、リンクも正しいようだ。さて、このあたり、どうチューニングしていけばいいかな。