<jupyter_start><jupyter_text>[世界のUniversal Dependenciesと係り受け解析ツール群](http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/publications/2021-06-22.pdf) [タイ語UDを用いた係り受け解析器の自作](https://koichiyasuoka.github.io/deplacy/demo/2021-06-22/) [UDPipe](https://ufal.mff.cuni.cz/udpipe/1/install)を用いる場合 必要なパッケージと訓練用train.conlluを準備<jupyter_code>!test -f udpipe-1.2.0-bin.zip || curl -LO https://github.com/ufal/udpipe/releases/download/v1.2.0/udpipe-1.2.0-bin.zip
!test -d udpipe-1.2.0-bin || unzip udpipe-1.2.0-bin.zip
!test -f /usr/local/bin/udpipe || cp udpipe-1.2.0-bin/bin-linux64/udpipe /usr/local/bin/udpipe && chmod 755 /usr/local/bin/udpipe
!test -d UD_Thai-PUD || git clone --depth=1 https://github.com/universaldependencies/UD_Thai-PUD
!test -f train.conllu || ln -s UD_Thai-PUD/th_pud-ud-test.conllu train.conllu
!pip install ufal.udpipe deplacy<jupyter_output><empty_output><jupyter_text>my.udpipeを作成 (45分程度)<jupyter_code>!udpipe --train my.udpipe train.conllu<jupyter_output><empty_output><jupyter_text>C++版で係り受け解析<jupyter_code>!echo ไม่เข้าถ้าเสือ ย่อมไม่ได้ลูกเสือ | udpipe --tokenizer=presegmented --tag --parse my.udpipe<jupyter_output><empty_output><jupyter_text>python版で係り受け解析<jupyter_code>import ufal.udpipe
mdl = ufal.udpipe.Model.load("my.udpipe")
nlp = ufal.udpipe.Pipeline(mdl, "tokenizer=presegmented", "", "", "").process
doc = nlp("ไม่เข้าถ้าเสือ ย่อมไม่ได้ลูกเสือ")
print(doc)
import deplacy
deplacy.serve(doc,port=None)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17549896765313144, 'fraction_numerical': 0.029593943565037854, 'mean_word_length': 6.092682926829268, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '532844', 'license': 'MIT', 'n_tokens_mistral': 751, 'n_tokens_neox': 731, 'n_words': 67, 'path': 'demo/2021-06-22/udpipe-th.ipynb', 'repo_name': 'KoichiYasuoka/deplacy', 'size': '1453'}