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?

Qwen3.8-2.4T-A95Bは「Bei mir bist du schön means that you're grand」をどう係り受け解析するのか

0
Last updated at Posted at 2026-08-18

QwenCloudのQwen3.8-2.4T-A95Bが100万トークンまで無料と聞いたので、7月28日の記事を横目に、多言語Few-Shot係り受け解析に挑戦してみた。Google Colaboratoryだと、こんな感じ。

!pip install openai deplacy
msg=[{"role":"system","content":"Try dependency-parsing with UPOS and DEPREL."},
  {"role":"user","content":"You don't know what love is"},
  {"role":"assistant","content":"You_PRON_nsubj_know|do_AUX_aux_know|n't_PART_advmod_know|know_VERB_root_know|what_PRON_comp_know|love_NOUN_nsubj_what|is_AUX_cop_what"},
  {"role":"user","content":"Du weißt nicht was Liebe ist"},
  {"role":"assistant","content":"Du_PRON_nsubj_weißt|weißt_VERB_root_weißt|nicht_PART_advmod_weißt|was_PRON_ccomp_weißt|Liebe_NOUN_nsubj_was|ist_AUX_cop_was"},
  {"role":"user","content":"Bei mir bist du schön means that you're grand"}]
url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
key="sk-your-api-key"
mdl="qwen3.8-2.4t-a95b"
if url==None:
  from transformers import pipeline
  nlp=pipeline("text-generation",mdl,temperature=0.00001,token=key)
  res=nlp(msg)
  out=res[0]["generated_text"][-1]["content"].strip().replace("¥n","|")
else:
  from openai import OpenAI
  cli=OpenAI(base_url=url,api_key=key)
  res=cli.chat.completions.create(model=mdl,temperature=0,messages=msg)
  out=res.choices[0].message.content.strip().replace("¥n","|")
clu="# output = "+out+"\n"
c=[s.split("_")+["_","_","_"] for s in out.split("|")]
a,b=[t[0] for t in c],[]
for i,t in enumerate(c):
  if t[2]=="root":
    h="0"
  else:
    try:
      k=b.index(t[3])
    except:
      k=-1
    try:
      j=a[i+1:].index(t[3])
      h=str(i+j+2) if k<0 or j<k else str(i-k)
    except:
      h="_" if k<0 else str(i-k)
  clu+="\t".join([str(i+1),t[0],"_",t[1],"_","_",h,t[2],"_","_"])+"\n"
  b.insert(0,t[0])
import deplacy
deplacy.serve(clu,port=None)

「Bei mir bist du schön means that you're grand」をFew-Shot係り受け解析してみたところ、私(安岡孝一)の手元では以下の結果が出力された。

# output = Bei_ADP_case_mir|mir_PRON_obl_schön|bist_AUX_cop_schön|du_PRON_nsubj_schön|schön_ADJ_csubj_means|means_VERB_root_means|that_SCONJ_mark_grand|you_PRON_nsubj_grand|'re_AUX_cop_grand|grand_ADJ_ccomp_means
1	Bei	_	ADP	_	_	2	case	_	_
2	mir	_	PRON	_	_	5	obl	_	_
3	bist	_	AUX	_	_	5	cop	_	_
4	du	_	PRON	_	_	5	nsubj	_	_
5	schön	_	ADJ	_	_	6	csubj	_	_
6	means	_	VERB	_	_	0	root	_	_
7	that	_	SCONJ	_	_	10	mark	_	_
8	you	_	PRON	_	_	10	nsubj	_	_
9	're	_	AUX	_	_	10	cop	_	_
10	grand	_	ADJ	_	_	6	ccomp	_	_

de+en.png

素晴らしい、完璧だ。この出力に7828トークンほど使ったのだが、さて、他の言語にも適用できるかな。

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?