WorksApplications / SudachiPy

Python version of Sudachi, a Japanese tokenizer.
Apache License 2.0
392 stars 50 forks source link

build user dictionary failed with a long csv #80

Closed AlloVince closed 5 years ago

AlloVince commented 5 years ago

Hi guys

I meet a issue when building a user dictionary with a little bit longer csv (224 lines), this will cause a exception as

reading the source file...224 words
writing the POS table...2 bytes
writing the connection matrix...4 bytes
building the trie.......Traceback (most recent call last):
  File "custom_dict.py", line 247, in <module>
    builder.build([my_dict_dir + '/my_dict.csv'], None, wf)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dictionarylib/userdictionarybuilder.py", line 40, in build
    self.write_lexicon(out_stream)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dictionarylib/dictionarybuilder.py", line 230, in write_lexicon
    trie.build(keys, vals, progress_func)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearray.py", line 54, in build
    builder.build(key_set)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 45, in build
    self.build_from_dawg_header(dawg_builder)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 95, in build_from_dawg_header
    self.build_from_dawg_insert(dawg, dawg.root(), 0)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 124, in build_from_dawg_insert
    self.build_from_dawg_insert(dawg, dawg_child_id, dic_child_id)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 124, in build_from_dawg_insert
    self.build_from_dawg_insert(dawg, dawg_child_id, dic_child_id)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 124, in build_from_dawg_insert
    self.build_from_dawg_insert(dawg, dawg_child_id, dic_child_id)
  [Previous line repeated 2 more times]
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 116, in build_from_dawg_insert
    offset = self.arrange_from_dawg(dawg, dawg_id, dic_id)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 137, in arrange_from_dawg
    offset = self.find_valid_offset(dic_id)
  File "/Users/allovince/.pyenv/versions/3.7.3/lib/python3.7/site-packages/sudachipy/dartsclone/doublearraybuilder.py", line 260, in find_valid_offset
    raise RuntimeError(unfixed_id, memo)
RuntimeError: (311, [257, 258, 259, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 285, 286, 287, 295, 298, 300, 301, 305, 308, 310, 311, 318, 319, 349, 355, 356, 357, 362, 364, 365, 366, 367, 370, 371, 372, 373, 377, 379, 382, 383, 428, 430, 431, 433, 436, 437, 440, 442, 445, 446, 447, 470, 471, 472, 474, 475, 476, 478, 479, 482, 484, 486, 487, 489, 490, 491, 492, 493, 494, 495, 496, 497, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511])

Also here is the test code, you could save as file direct run it

from sudachipy import dictionarylib
from sudachipy.dictionarylib.userdictionarybuilder import UserDictionaryBuilder
import os
import time
from importlib import import_module
from pathlib import Path

dict_content = '''幸福人,5146,5146,8000,幸福人,名詞,固有名詞,一般,*,*,*,こうふくじん,幸福人,*,*,*,*,*
鶉坂,5146,5146,8000,鶉坂,名詞,固有名詞,一般,*,*,*,うずらざか,鶉坂,*,*,*,*,*
一車,5146,5146,8000,一車,名詞,固有名詞,一般,*,*,*,ひとくるま,一車,*,*,*,*,*
初客,5146,5146,8000,初客,名詞,固有名詞,一般,*,*,*,はつきゃく,初客,*,*,*,*,*
御番衆,5146,5146,8000,御番衆,名詞,固有名詞,一般,*,*,*,ごばんしゅう,御番衆,*,*,*,*,*
山桔梗,5146,5146,8000,山桔梗,名詞,固有名詞,一般,*,*,*,やまききょう,山桔梗,*,*,*,*,*
崖庭,5146,5146,8000,崖庭,名詞,固有名詞,一般,*,*,*,がけにわ,崖庭,*,*,*,*,*
愛縄堂,5146,5146,8000,愛縄堂,名詞,固有名詞,一般,*,*,*,あいじょうどう,愛縄堂,*,*,*,*,*
木額,5146,5146,8000,木額,名詞,固有名詞,一般,*,*,*,もくがく,木額,*,*,*,*,*
鮓箱,5146,5146,8000,鮓箱,名詞,固有名詞,一般,*,*,*,すしばこ,鮓箱,*,*,*,*,*
塙隼人,5146,5146,8000,塙隼人,名詞,固有名詞,一般,*,*,*,はなわはやと,塙隼人,*,*,*,*,*
情涙,5146,5146,8000,情涙,名詞,固有名詞,一般,*,*,*,じょうるい,情涙,*,*,*,*,*
大与力,5146,5146,8000,大与力,名詞,固有名詞,一般,*,*,*,だいよりき,大与力,*,*,*,*,*
役退,5146,5146,8000,役退,名詞,固有名詞,一般,*,*,*,やくび,役退,*,*,*,*,*
塙家,5146,5146,8000,塙家,名詞,固有名詞,一般,*,*,*,はなわけ,塙家,*,*,*,*,*
皎々,5146,5146,8000,皎々,名詞,固有名詞,一般,*,*,*,こうこう,皎々,*,*,*,*,*
三本錐,5146,5146,8000,三本錐,名詞,固有名詞,一般,*,*,*,さんぼんぎり,三本錐,*,*,*,*,*
御成道,5146,5146,8000,御成道,名詞,固有名詞,一般,*,*,*,おなりみち,御成道,*,*,*,*,*
寂地,5146,5146,8000,寂地,名詞,固有名詞,一般,*,*,*,じゃくち,寂地,*,*,*,*,*
眉深,5146,5146,8000,眉深,名詞,固有名詞,一般,*,*,*,まぶか,眉深,*,*,*,*,*
御霊廟,5146,5146,8000,御霊廟,名詞,固有名詞,一般,*,*,*,みたまや,御霊廟,*,*,*,*,*
死笑靨,5146,5146,8000,死笑靨,名詞,固有名詞,一般,*,*,*,しにえくぼ,死笑靨,*,*,*,*,*
笑靨,5146,5146,8000,笑靨,名詞,固有名詞,一般,*,*,*,えくぼ,笑靨,*,*,*,*,*
鮫柄,5146,5146,8000,鮫柄,名詞,固有名詞,一般,*,*,*,さめづか,鮫柄,*,*,*,*,*
麗玉,5146,5146,8000,麗玉,名詞,固有名詞,一般,*,*,*,れいぎょく,麗玉,*,*,*,*,*
専役,5146,5146,8000,専役,名詞,固有名詞,一般,*,*,*,せんやく,専役,*,*,*,*,*
幾歳,5146,5146,8000,幾歳,名詞,固有名詞,一般,*,*,*,いくつ,幾歳,*,*,*,*,*
石責,5146,5146,8000,石責,名詞,固有名詞,一般,*,*,*,いしぜ,石責,*,*,*,*,*
斑痕,5146,5146,8000,斑痕,名詞,固有名詞,一般,*,*,*,はんこん,斑痕,*,*,*,*,*
蟇然,5146,5146,8000,蟇然,名詞,固有名詞,一般,*,*,*,がまぜん,蟇然,*,*,*,*,*
偽聾,5146,5146,8000,偽聾,名詞,固有名詞,一般,*,*,*,にせつんぼ,偽聾,*,*,*,*,*
塙江漢,5146,5146,8000,塙江漢,名詞,固有名詞,一般,*,*,*,はなわこうかん,塙江漢,*,*,*,*,*
公暇,5146,5146,8000,公暇,名詞,固有名詞,一般,*,*,*,こうか,公暇,*,*,*,*,*
何人,5146,5146,8000,何人,名詞,固有名詞,一般,*,*,*,なんぴと,何人,*,*,*,*,*
谷文晁,5146,5146,8000,谷文晁,名詞,固有名詞,一般,*,*,*,たにぶんちょう,谷文晁,*,*,*,*,*
酒菰,5146,5146,8000,酒菰,名詞,固有名詞,一般,*,*,*,さかごも,酒菰,*,*,*,*,*
手抗,5146,5146,8000,手抗,名詞,固有名詞,一般,*,*,*,てむか,手抗,*,*,*,*,*
自鳴鐘,5146,5146,8000,自鳴鐘,名詞,固有名詞,一般,*,*,*,とけい,自鳴鐘,*,*,*,*,*
牢鞘,5146,5146,8000,牢鞘,名詞,固有名詞,一般,*,*,*,ろうざや,牢鞘,*,*,*,*,*
夜雲雀,5146,5146,8000,夜雲雀,名詞,固有名詞,一般,*,*,*,よひばり,夜雲雀,*,*,*,*,*
町駕,5146,5146,8000,町駕,名詞,固有名詞,一般,*,*,*,まちかご,町駕,*,*,*,*,*
大目的,5146,5146,8000,大目的,名詞,固有名詞,一般,*,*,*,おおあて,大目的,*,*,*,*,*
鈍々,5146,5146,8000,鈍々,名詞,固有名詞,一般,*,*,*,どんどん,鈍々,*,*,*,*,*
眼鑑,5146,5146,8000,眼鑑,名詞,固有名詞,一般,*,*,*,めがね,眼鑑,*,*,*,*,*
京普請,5146,5146,8000,京普請,名詞,固有名詞,一般,*,*,*,きょうぶしん,京普請,*,*,*,*,*
細軸,5146,5146,8000,細軸,名詞,固有名詞,一般,*,*,*,ほそもの,細軸,*,*,*,*,*
書額,5146,5146,8000,書額,名詞,固有名詞,一般,*,*,*,しょがく,書額,*,*,*,*,*
客卓,5146,5146,8000,客卓,名詞,固有名詞,一般,*,*,*,きゃくたく,客卓,*,*,*,*,*
冷蔑,5146,5146,8000,冷蔑,名詞,固有名詞,一般,*,*,*,れいべつ,冷蔑,*,*,*,*,*
眉眼,5146,5146,8000,眉眼,名詞,固有名詞,一般,*,*,*,びがん,眉眼,*,*,*,*,*
図取,5146,5146,8000,図取,名詞,固有名詞,一般,*,*,*,ずどり,図取,*,*,*,*,*
一眄,5146,5146,8000,一眄,名詞,固有名詞,一般,*,*,*,いちべん,一眄,*,*,*,*,*
女主人,5146,5146,8000,女主人,名詞,固有名詞,一般,*,*,*,おんなあるじ,女主人,*,*,*,*,*
町人体,5146,5146,8000,町人体,名詞,固有名詞,一般,*,*,*,ちょうにんてい,町人体,*,*,*,*,*
此家,5146,5146,8000,此家,名詞,固有名詞,一般,*,*,*,ここ,此家,*,*,*,*,*
切銘,5146,5146,8000,切銘,名詞,固有名詞,一般,*,*,*,きりめい,切銘,*,*,*,*,*
其許,5146,5146,8000,其許,名詞,固有名詞,一般,*,*,*,そこもと,其許,*,*,*,*,*
年扶持,5146,5146,8000,年扶持,名詞,固有名詞,一般,*,*,*,ねんぶち,年扶持,*,*,*,*,*
万代,5146,5146,8000,万代,名詞,固有名詞,一般,*,*,*,ばんだい,万代,*,*,*,*,*
草埃,5146,5146,8000,草埃,名詞,固有名詞,一般,*,*,*,くさぼこり,草埃,*,*,*,*,*
唖男,5146,5146,8000,唖男,名詞,固有名詞,一般,*,*,*,おしおとこ,唖男,*,*,*,*,*
庭垣,5146,5146,8000,庭垣,名詞,固有名詞,一般,*,*,*,にわがき,庭垣,*,*,*,*,*
惚々,5146,5146,8000,惚々,名詞,固有名詞,一般,*,*,*,ほれぼれ,惚々,*,*,*,*,*
塙郁次郎,5146,5146,8000,塙郁次郎,名詞,固有名詞,一般,*,*,*,はなわいくじろう,塙郁次郎,*,*,*,*,*
火除地,5146,5146,8000,火除地,名詞,固有名詞,一般,*,*,*,ひよけち,火除地,*,*,*,*,*
鳩渓,5146,5146,8000,鳩渓,名詞,固有名詞,一般,*,*,*,きゅうけい,鳩渓,*,*,*,*,*
蘭人,5146,5146,8000,蘭人,名詞,固有名詞,一般,*,*,*,らんじん,蘭人,*,*,*,*,*
逆磔,5146,5146,8000,逆磔,名詞,固有名詞,一般,*,*,*,さかさはりつけ,逆磔,*,*,*,*,*
手欄,5146,5146,8000,手欄,名詞,固有名詞,一般,*,*,*,てすり,手欄,*,*,*,*,*
掌脂,5146,5146,8000,掌脂,名詞,固有名詞,一般,*,*,*,てあぶら,掌脂,*,*,*,*,*
藍弁慶,5146,5146,8000,藍弁慶,名詞,固有名詞,一般,*,*,*,あいべんけい,藍弁慶,*,*,*,*,*
手裡,5146,5146,8000,手裡,名詞,固有名詞,一般,*,*,*,しゅり,手裡,*,*,*,*,*
召捕,5146,5146,8000,召捕,名詞,固有名詞,一般,*,*,*,やっ,召捕,*,*,*,*,*
取做,5146,5146,8000,取做,名詞,固有名詞,一般,*,*,*,とりな,取做,*,*,*,*,*
細縞,5146,5146,8000,細縞,名詞,固有名詞,一般,*,*,*,ほそじま,細縞,*,*,*,*,*
其方,5146,5146,8000,其方,名詞,固有名詞,一般,*,*,*,そのほう,其方,*,*,*,*,*
組為替,5146,5146,8000,組為替,名詞,固有名詞,一般,*,*,*,くみがわせ,組為替,*,*,*,*,*
暗灰色,5146,5146,8000,暗灰色,名詞,固有名詞,一般,*,*,*,あんかいしょく,暗灰色,*,*,*,*,*
真夜半,5146,5146,8000,真夜半,名詞,固有名詞,一般,*,*,*,まよなか,真夜半,*,*,*,*,*
法縄,5146,5146,8000,法縄,名詞,固有名詞,一般,*,*,*,ほうじょう,法縄,*,*,*,*,*
征悪,5146,5146,8000,征悪,名詞,固有名詞,一般,*,*,*,せいあく,征悪,*,*,*,*,*
帯際,5146,5146,8000,帯際,名詞,固有名詞,一般,*,*,*,おびぎわ,帯際,*,*,*,*,*
仄白,5146,5146,8000,仄白,名詞,固有名詞,一般,*,*,*,ほのじろ,仄白,*,*,*,*,*
好捕手,5146,5146,8000,好捕手,名詞,固有名詞,一般,*,*,*,こうとりて,好捕手,*,*,*,*,*
富武家,5146,5146,8000,富武家,名詞,固有名詞,一般,*,*,*,とみたけけ,富武家,*,*,*,*,*
仄暗,5146,5146,8000,仄暗,名詞,固有名詞,一般,*,*,*,ほのぐら,仄暗,*,*,*,*,*
小襖,5146,5146,8000,小襖,名詞,固有名詞,一般,*,*,*,こぶすま,小襖,*,*,*,*,*
塙氏,5146,5146,8000,塙氏,名詞,固有名詞,一般,*,*,*,はなわうじ,塙氏,*,*,*,*,*
人無,5146,5146,8000,人無,名詞,固有名詞,一般,*,*,*,ひとな,人無,*,*,*,*,*
底泥土,5146,5146,8000,底泥土,名詞,固有名詞,一般,*,*,*,そこどろ,底泥土,*,*,*,*,*
一襲,5146,5146,8000,一襲,名詞,固有名詞,一般,*,*,*,ひとかさ,一襲,*,*,*,*,*
宿端,5146,5146,8000,宿端,名詞,固有名詞,一般,*,*,*,しゅくはず,宿端,*,*,*,*,*
石餅屋,5146,5146,8000,石餅屋,名詞,固有名詞,一般,*,*,*,いしもちや,石餅屋,*,*,*,*,*
量見,5146,5146,8000,量見,名詞,固有名詞,一般,*,*,*,りょうけん,量見,*,*,*,*,*
桝酒,5146,5146,8000,桝酒,名詞,固有名詞,一般,*,*,*,ますざけ,桝酒,*,*,*,*,*
駕舁,5146,5146,8000,駕舁,名詞,固有名詞,一般,*,*,*,かごかき,駕舁,*,*,*,*,*
宿触,5146,5146,8000,宿触,名詞,固有名詞,一般,*,*,*,しゅくぶ,宿触,*,*,*,*,*
早飛脚,5146,5146,8000,早飛脚,名詞,固有名詞,一般,*,*,*,はや,早飛脚,*,*,*,*,*
電瞬,5146,5146,8000,電瞬,名詞,固有名詞,一般,*,*,*,でんしゅん,電瞬,*,*,*,*,*
古鈴,5146,5146,8000,古鈴,名詞,固有名詞,一般,*,*,*,これい,古鈴,*,*,*,*,*
七歳,5146,5146,8000,七歳,名詞,固有名詞,一般,*,*,*,ななつ,七歳,*,*,*,*,*
一羽雁,5146,5146,8000,一羽雁,名詞,固有名詞,一般,*,*,*,ひとはがり,一羽雁,*,*,*,*,*
名捕手,5146,5146,8000,名捕手,名詞,固有名詞,一般,*,*,*,めいとりて,名捕手,*,*,*,*,*
含月荘,5146,5146,8000,含月荘,名詞,固有名詞,一般,*,*,*,がんげつそう,含月荘,*,*,*,*,*
腕頸,5146,5146,8000,腕頸,名詞,固有名詞,一般,*,*,*,うでくび,腕頸,*,*,*,*,*
一挺,5146,5146,8000,一挺,名詞,固有名詞,一般,*,*,*,いっちょう,一挺,*,*,*,*,*
紺合羽,5146,5146,8000,紺合羽,名詞,固有名詞,一般,*,*,*,こんがっぱ,紺合羽,*,*,*,*,*
新駕,5146,5146,8000,新駕,名詞,固有名詞,一般,*,*,*,あらかご,新駕,*,*,*,*,*
小筥,5146,5146,8000,小筥,名詞,固有名詞,一般,*,*,*,こばこ,小筥,*,*,*,*,*
燧打石,5146,5146,8000,燧打石,名詞,固有名詞,一般,*,*,*,ひうちいし,燧打石,*,*,*,*,*
御番士方,5146,5146,8000,御番士方,名詞,固有名詞,一般,*,*,*,ごばんしがた,御番士方,*,*,*,*,*
香筥,5146,5146,8000,香筥,名詞,固有名詞,一般,*,*,*,こうばこ,香筥,*,*,*,*,*
思判,5146,5146,8000,思判,名詞,固有名詞,一般,*,*,*,しはん,思判,*,*,*,*,*
居辣,5146,5146,8000,居辣,名詞,固有名詞,一般,*,*,*,いすく,居辣,*,*,*,*,*
山詰,5146,5146,8000,山詰,名詞,固有名詞,一般,*,*,*,やまづ,山詰,*,*,*,*,*
短槍,5146,5146,8000,短槍,名詞,固有名詞,一般,*,*,*,たんそう,短槍,*,*,*,*,*
七刻,5146,5146,8000,七刻,名詞,固有名詞,一般,*,*,*,ななつ,七刻,*,*,*,*,*
前黄門公,5146,5146,8000,前黄門公,名詞,固有名詞,一般,*,*,*,さきのこうもんこう,前黄門公,*,*,*,*,*
革袴,5146,5146,8000,革袴,名詞,固有名詞,一般,*,*,*,かわばかま,革袴,*,*,*,*,*
其女,5146,5146,8000,其女,名詞,固有名詞,一般,*,*,*,そなた,其女,*,*,*,*,*
孤寂,5146,5146,8000,孤寂,名詞,固有名詞,一般,*,*,*,こじゃく,孤寂,*,*,*,*,*
蘭之助,5146,5146,8000,蘭之助,名詞,固有名詞,一般,*,*,*,らんのすけ,蘭之助,*,*,*,*,*
金行燈,5146,5146,8000,金行燈,名詞,固有名詞,一般,*,*,*,かなあんどう,金行燈,*,*,*,*,*
稀々,5146,5146,8000,稀々,名詞,固有名詞,一般,*,*,*,たまたま,稀々,*,*,*,*,*
含月,5146,5146,8000,含月,名詞,固有名詞,一般,*,*,*,がんげつ,含月,*,*,*,*,*
甲走,5146,5146,8000,甲走,名詞,固有名詞,一般,*,*,*,かんばし,甲走,*,*,*,*,*
中山越,5146,5146,8000,中山越,名詞,固有名詞,一般,*,*,*,なかやまごえ,中山越,*,*,*,*,*
人焼竈,5146,5146,8000,人焼竈,名詞,固有名詞,一般,*,*,*,ひとやきがま,人焼竈,*,*,*,*,*
一撃,5146,5146,8000,一撃,名詞,固有名詞,一般,*,*,*,ひとう,一撃,*,*,*,*,*
革襷,5146,5146,8000,革襷,名詞,固有名詞,一般,*,*,*,かわだすき,革襷,*,*,*,*,*
大破綻,5146,5146,8000,大破綻,名詞,固有名詞,一般,*,*,*,おおごと,大破綻,*,*,*,*,*
細智,5146,5146,8000,細智,名詞,固有名詞,一般,*,*,*,さいち,細智,*,*,*,*,*
楢薪,5146,5146,8000,楢薪,名詞,固有名詞,一般,*,*,*,ならまき,楢薪,*,*,*,*,*
竈場,5146,5146,8000,竈場,名詞,固有名詞,一般,*,*,*,かまば,竈場,*,*,*,*,*
一箇,5146,5146,8000,一箇,名詞,固有名詞,一般,*,*,*,ひとつ,一箇,*,*,*,*,*
土蓋,5146,5146,8000,土蓋,名詞,固有名詞,一般,*,*,*,どぶた,土蓋,*,*,*,*,*
六刻,5146,5146,8000,六刻,名詞,固有名詞,一般,*,*,*,むつ,六刻,*,*,*,*,*
竈開,5146,5146,8000,竈開,名詞,固有名詞,一般,*,*,*,かまあ,竈開,*,*,*,*,*
燐木,5146,5146,8000,燐木,名詞,固有名詞,一般,*,*,*,つけぎ,燐木,*,*,*,*,*
竈肌,5146,5146,8000,竈肌,名詞,固有名詞,一般,*,*,*,かまはだ,竈肌,*,*,*,*,*
合客,5146,5146,8000,合客,名詞,固有名詞,一般,*,*,*,あいきゃく,合客,*,*,*,*,*
炉部屋,5146,5146,8000,炉部屋,名詞,固有名詞,一般,*,*,*,ろべや,炉部屋,*,*,*,*,*
閾際,5146,5146,8000,閾際,名詞,固有名詞,一般,*,*,*,しきいぎわ,閾際,*,*,*,*,*
丑満,5146,5146,8000,丑満,名詞,固有名詞,一般,*,*,*,うしみつ,丑満,*,*,*,*,*
手功焦,5146,5146,8000,手功焦,名詞,固有名詞,一般,*,*,*,てがらあせ,手功焦,*,*,*,*,*
父愛,5146,5146,8000,父愛,名詞,固有名詞,一般,*,*,*,ふあい,父愛,*,*,*,*,*
不音,5146,5146,8000,不音,名詞,固有名詞,一般,*,*,*,ぶいん,不音,*,*,*,*,*
一間,5146,5146,8000,一間,名詞,固有名詞,一般,*,*,*,ひとま,一間,*,*,*,*,*
表書院,5146,5146,8000,表書院,名詞,固有名詞,一般,*,*,*,おもてしょいん,表書院,*,*,*,*,*
相成,5146,5146,8000,相成,名詞,固有名詞,一般,*,*,*,あいな,相成,*,*,*,*,*
父情,5146,5146,8000,父情,名詞,固有名詞,一般,*,*,*,ふじょう,父情,*,*,*,*,*
獄土,5146,5146,8000,獄土,名詞,固有名詞,一般,*,*,*,ごくど,獄土,*,*,*,*,*
一縛,5146,5146,8000,一縛,名詞,固有名詞,一般,*,*,*,ひとから,一縛,*,*,*,*,*
藪牢,5146,5146,8000,藪牢,名詞,固有名詞,一般,*,*,*,やぶろう,藪牢,*,*,*,*,*
懸合,5146,5146,8000,懸合,名詞,固有名詞,一般,*,*,*,かけあ,懸合,*,*,*,*,*
我説,5146,5146,8000,我説,名詞,固有名詞,一般,*,*,*,がせつ,我説,*,*,*,*,*
前差,5146,5146,8000,前差,名詞,固有名詞,一般,*,*,*,まえざし,前差,*,*,*,*,*
諸倒,5146,5146,8000,諸倒,名詞,固有名詞,一般,*,*,*,もろだお,諸倒,*,*,*,*,*
巧々,5146,5146,8000,巧々,名詞,固有名詞,一般,*,*,*,うまうま,巧々,*,*,*,*,*
見限,5146,5146,8000,見限,名詞,固有名詞,一般,*,*,*,みき,見限,*,*,*,*,*
舟辰,5146,5146,8000,舟辰,名詞,固有名詞,一般,*,*,*,ふなたつ,舟辰,*,*,*,*,*
夜魔,5146,5146,8000,夜魔,名詞,固有名詞,一般,*,*,*,よま,夜魔,*,*,*,*,*
塗鞘,5146,5146,8000,塗鞘,名詞,固有名詞,一般,*,*,*,ぬりざや,塗鞘,*,*,*,*,*
夜靄,5146,5146,8000,夜靄,名詞,固有名詞,一般,*,*,*,よもや,夜靄,*,*,*,*,*
櫓韻,5146,5146,8000,櫓韻,名詞,固有名詞,一般,*,*,*,ろいん,櫓韻,*,*,*,*,*
宗服,5146,5146,8000,宗服,名詞,固有名詞,一般,*,*,*,しゅうふく,宗服,*,*,*,*,*
名与力,5146,5146,8000,名与力,名詞,固有名詞,一般,*,*,*,めいよりき,名与力,*,*,*,*,*
中川尻,5146,5146,8000,中川尻,名詞,固有名詞,一般,*,*,*,なかがわじり,中川尻,*,*,*,*,*
槙町,5146,5146,8000,槙町,名詞,固有名詞,一般,*,*,*,まきちょう,槙町,*,*,*,*,*
訴文,5146,5146,8000,訴文,名詞,固有名詞,一般,*,*,*,そぶん,訴文,*,*,*,*,*
大捕手,5146,5146,8000,大捕手,名詞,固有名詞,一般,*,*,*,おおとりて,大捕手,*,*,*,*,*
苦茗,5146,5146,8000,苦茗,名詞,固有名詞,一般,*,*,*,くめい,苦茗,*,*,*,*,*
老腹,5146,5146,8000,老腹,名詞,固有名詞,一般,*,*,*,おいばら,老腹,*,*,*,*,*
一分,5146,5146,8000,一分,名詞,固有名詞,一般,*,*,*,いちぶん,一分,*,*,*,*,*
何艘,5146,5146,8000,何艘,名詞,固有名詞,一般,*,*,*,なんばい,何艘,*,*,*,*,*
血脂,5146,5146,8000,血脂,名詞,固有名詞,一般,*,*,*,ちあぶら,血脂,*,*,*,*,*
四尋,5146,5146,8000,四尋,名詞,固有名詞,一般,*,*,*,よひろ,四尋,*,*,*,*,*
迅舟,5146,5146,8000,迅舟,名詞,固有名詞,一般,*,*,*,はやぶね,迅舟,*,*,*,*,*
鱚舟,5146,5146,8000,鱚舟,名詞,固有名詞,一般,*,*,*,きすぶね,鱚舟,*,*,*,*,*
烏爪,5146,5146,8000,烏爪,名詞,固有名詞,一般,*,*,*,からすづめ,烏爪,*,*,*,*,*
女橋,5146,5146,8000,女橋,名詞,固有名詞,一般,*,*,*,おんなばし,女橋,*,*,*,*,*
白紫陽花,5146,5146,8000,白紫陽花,名詞,固有名詞,一般,*,*,*,しろあじさい,白紫陽花,*,*,*,*,*
舅父様,5146,5146,8000,舅父様,名詞,固有名詞,一般,*,*,*,とうさま,舅父様,*,*,*,*,*
舅父,5146,5146,8000,舅父,名詞,固有名詞,一般,*,*,*,とう,舅父,*,*,*,*,*
手裡剣,5146,5146,8000,手裡剣,名詞,固有名詞,一般,*,*,*,しゅりけん,手裡剣,*,*,*,*,*
扱帯,5146,5146,8000,扱帯,名詞,固有名詞,一般,*,*,*,しごき,扱帯,*,*,*,*,*
犯蹟,5146,5146,8000,犯蹟,名詞,固有名詞,一般,*,*,*,はんせき,犯蹟,*,*,*,*,*
前黄門,5146,5146,8000,前黄門,名詞,固有名詞,一般,*,*,*,さきのこうもん,前黄門,*,*,*,*,*
御内,5146,5146,8000,御内,名詞,固有名詞,一般,*,*,*,おんうち,御内,*,*,*,*,*
此寺,5146,5146,8000,此寺,名詞,固有名詞,一般,*,*,*,ここ,此寺,*,*,*,*,*
一期,5146,5146,8000,一期,名詞,固有名詞,一般,*,*,*,いちご,一期,*,*,*,*,*
観破,5146,5146,8000,観破,名詞,固有名詞,一般,*,*,*,みやぶ,観破,*,*,*,*,*
直手,5146,5146,8000,直手,名詞,固有名詞,一般,*,*,*,じきしゅ,直手,*,*,*,*,*
無役者,5146,5146,8000,無役者,名詞,固有名詞,一般,*,*,*,むやくもの,無役者,*,*,*,*,*
喝声,5146,5146,8000,喝声,名詞,固有名詞,一般,*,*,*,かっせい,喝声,*,*,*,*,*
山扮装,5146,5146,8000,山扮装,名詞,固有名詞,一般,*,*,*,やまいでたち,山扮装,*,*,*,*,*
霧谷,5146,5146,8000,霧谷,名詞,固有名詞,一般,*,*,*,きりだに,霧谷,*,*,*,*,*
岩牢,5146,5146,8000,岩牢,名詞,固有名詞,一般,*,*,*,いわろう,岩牢,*,*,*,*,*
渓川,5146,5146,8000,渓川,名詞,固有名詞,一般,*,*,*,たにがわ,渓川,*,*,*,*,*
蒸殺,5146,5146,8000,蒸殺,名詞,固有名詞,一般,*,*,*,むしごろ,蒸殺,*,*,*,*,*
薪小屋,5146,5146,8000,薪小屋,名詞,固有名詞,一般,*,*,*,たきぎごや,薪小屋,*,*,*,*,*
身振,5146,5146,8000,身振,名詞,固有名詞,一般,*,*,*,みぶり,身振,*,*,*,*,*
片唾,5146,5146,8000,片唾,名詞,固有名詞,一般,*,*,*,かたず,片唾,*,*,*,*,*
重粥,5146,5146,8000,重粥,名詞,固有名詞,一般,*,*,*,おもゆ,重粥,*,*,*,*,*
暮六刻,5146,5146,8000,暮六刻,名詞,固有名詞,一般,*,*,*,くれむつ,暮六刻,*,*,*,*,*
七刻仕舞,5146,5146,8000,七刻仕舞,名詞,固有名詞,一般,*,*,*,ななつじま,七刻仕舞,*,*,*,*,*
問詰,5146,5146,8000,問詰,名詞,固有名詞,一般,*,*,*,なじ,問詰,*,*,*,*,*
頬綿,5146,5146,8000,頬綿,名詞,固有名詞,一般,*,*,*,ほおわた,頬綿,*,*,*,*,*
黒龍紋,5146,5146,8000,黒龍紋,名詞,固有名詞,一般,*,*,*,くろりゅうもん,黒龍紋,*,*,*,*,*
身扮,5146,5146,8000,身扮,名詞,固有名詞,一般,*,*,*,みなり,身扮,*,*,*,*,*
恐察,5146,5146,8000,恐察,名詞,固有名詞,一般,*,*,*,きょうさつ,恐察,*,*,*,*,*
周防守,5146,5146,8000,周防守,名詞,固有名詞,一般,*,*,*,すおうのかみ,周防守,*,*,*,*,*
正腹,5146,5146,8000,正腹,名詞,固有名詞,一般,*,*,*,しょうふく,正腹,*,*,*,*,*
鋲乗物,5146,5146,8000,鋲乗物,名詞,固有名詞,一般,*,*,*,びょうのりもの,鋲乗物,*,*,*,*,*
二更,5146,5146,8000,二更,名詞,固有名詞,一般,*,*,*,にこう,二更,*,*,*,*,*
大吟味,5146,5146,8000,大吟味,名詞,固有名詞,一般,*,*,*,だいぎんみ,大吟味,*,*,*,*,*
凛絶,5146,5146,8000,凛絶,名詞,固有名詞,一般,*,*,*,りんぜつ,凛絶,*,*,*,*,*
目企,5146,5146,8000,目企,名詞,固有名詞,一般,*,*,*,もくろ,目企,*,*,*,*,*
世囈言,5146,5146,8000,世囈言,名詞,固有名詞,一般,*,*,*,よまいごと,世囈言,*,*,*,*,*
偽落胤,5146,5146,8000,偽落胤,名詞,固有名詞,一般,*,*,*,にせらくいん,偽落胤,*,*,*,*,*
干乾,5146,5146,8000,干乾,名詞,固有名詞,一般,*,*,*,ひから,干乾,*,*,*,*,*
愛涙燦爛,5146,5146,8000,愛涙燦爛,名詞,固有名詞,一般,*,*,*,あいるいさんらん,愛涙燦爛,*,*,*,*,*
一献,5146,5146,8000,一献,名詞,固有名詞,一般,*,*,*,いっこん,一献,*,*,*,*,*
一荷,5146,5146,8000,一荷,名詞,固有名詞,一般,*,*,*,いっか,一荷,*,*,*,*,*
'''

my_dict_dir = os.path.abspath(os.path.dirname(__file__))
system_dict_path = Path(import_module('sudachidict').__file__).parent
system_dict_path = os.path.join(system_dict_path, 'resources', 'system.dic')
system_dict = dictionarylib.BinaryDictionary.from_system_dictionary(system_dict_path)
with open(my_dict_dir + '/my_dict.csv', 'w', encoding='utf-8') as wf:
    wf.write(dict_content)

header = dictionarylib.dictionaryheader.DictionaryHeader(
    dictionarylib.USER_DICT_VERSION_2, int(time.time()), 'my_dict')
with open(my_dict_dir + '/my_dict.dic', 'wb') as wf:
    wf.write(header.to_bytes())
    builder = UserDictionaryBuilder(system_dict.grammar,
                                    system_dict.lexicon, )
    builder.build([my_dict_dir + '/my_dict.csv'], None, wf)
izziiyt commented 5 years ago

Thank you for your FB. Let me know which sudachipy version you used !

izziiyt commented 5 years ago

I found it works with experiment branch (partially cythonized). Could you check with experiment branch ?

pip install -e git+git://github.com/WorksApplications/SudachiPy@experiment#egg=Sudachipy
AlloVince commented 5 years ago

thank you for your quick reply, my version is 0.3.10

yuki-kaze commented 5 years ago

お世話になります。

自然言語処理解析用のライブラリGinzaの活用を試行しています。 Ginzaをインストール時に、Ginzaに同梱されたSudacipyも同時にインストールされました。

そのSudachiPy用に用意したユーザー辞書をビルドしようとしたところ、 上記とほぼ同一のruntimeerrorが発生してしまいました。

環境としては以下のような構成となります。 Ginza 2.0.0 ja-ginza 2.1.0 SudachiDict-core 20190531 SudachiPy 0.3.11

下記のexperiment branchはもはや存在しないでしょうか? また、ginzaとは別に後からsudachipyだけをインストールしなおすことは不安に思っています。 pip install -e git+git://github.com/WorksApplications/SudachiPy@experiment#egg=Sudachipy

もし可能であれば何かご助言頂けると助かります。 以上よろしくお願いいたします

izziiyt commented 5 years ago

@yuki-kaze

まず最初にお願いなのですが、今後は同じような事象に困っている非日本語話者のユーザーのためにも英語で投稿していただけると助かります! https://github.com/WorksApplications/SudachiPy#contact に記載されているslackでは基本的に日本語で議論がなされているのでカジュアルに日本語で聞きたいときはこちらをご利用ください。

以下英語でお答えします。

In my environment, the bellow command properly works. Could you tell me what this command dumped ?

pip install -e git+git://github.com/WorksApplications/SudachiPy@experiment#egg=Sudachipy

また、ginzaとは別に後からsudachipyだけをインストールしなおすことは不安に思っています もし可能であれば何かご助言頂けると助かります。

I think installing SudachiPy in virtual environment and run ubuild is one option. For example, like bellow

$ python -m venv venv
$ source venv/bin/activate
$ pip install -e git+git://github.com/WorksApplications/SudachiPy@experiment#egg=Sudachipy
$ sudachipy ubuild ...

After that you can use the created dictionary in your original environment.