だから私は読んで辞書に入れる必要がある行を持っています.最初の数字はキーで、4番目の数字はキーに関連付けられる単語の量です.
f = open("wordnetSample.txt", "r")
D = {}
for line in f:
L = line.split()
D.update({L[0]: L[4:4 + 2 * int(L[3]):2]})
これらは私が辞書に入れている行のサンプルです
09826802 18 n 01 Areopagite 0 002 @ 10326901 n 0000 #m 08181009 n 0000 | a member of the council of the Areopagus
09826918 18 n 01 Argive 0 002 @ 09729560 n 0000 + 08804512 n 0101 | a native or inhabitant of the city of Argos
これは私がこれまでにDのために持っているものです
{'09826802': ['Areopagite'], '09826918': ['Argive']}
そして、私はこれが欲しい:
{'09826802': ['Areopagite', 'a member of the council of the Areopagus'], '09826918': ['Argive', 'a native or inhabitant of the city of Argos']}