我正在尝试理解WordNet的文件格式,主要文档是WNDB和WNINPUT。正如我在WNDB中所理解的,有两个名为index.something
和data.something
的文件,其中这个something
可以是noun, adv, vrb, adj
。
所以,如果我想知道一些关于单词dog
作为noun
的信息,我会查看index.noun
,搜索单词dog
,这给了我一行:
dog n 7 5 @ ~ #m #p %p 7 1 02086723 10133978 10042764 09905672 07692347 03907626 02712903
根据WNDB文档摘要,此行代表以下数据:
lemma pos synset_cnt p_cnt [ptr_symbol...] sense_cnt tagsense_cnt synset_offset [synset_offset...]
其中,lemma
是单词,pos
是标识符,告诉它是名词,synset_cnt
告诉我们这个单词包含了多少个同义词,p_cnt
告诉我们有多少指向这些同义词的指针,[ptr_symbol]
是指针数组,sense_cnt
和tagsense_cnt
我不理解,希望得到解释,synset_offset
是要查看data.noun
文件的一个或多个同义词
好吧,我知道这些指针指向了一些东西,下面是它们的描述,如WNINPUT:中所写
@ Hypernym
~ Hyponym
#m Member holonym
#p Part holonym
%p Part meronym
我不知道如何为这个名词找到Hypernom,但让我们继续:
其他重要数据是synset_offset
,它们是:
02086723 10133978 10042764 09905672 07692347 03907626 02712903
让我们看看data.noun
:中的第一个02086723
02086723 05 n 03 dog 0 domestic_dog 0 Canis_familiaris 0 023 @ 02085998 n 0000 @ 01320032 n 0000 #m 02086515 n 0000 #m 08011383 n 0000 ~ 01325095 n 0000 ~ 02087384 n 0000 ~ 02087513 n 0000 ~ 02087924 n 0000 ~ 02088026 n 0000 ~ 02089774 n 0000 ~ 02106058 n 0000 ~ 02112993 n 0000 ~ 02113458 n 0000 ~ 02113610 n 0000 ~ 02113781 n 0000 ~ 02113929 n 0000 ~ 02114152 n 0000 ~ 02114278 n 0000 ~ 02115149 n 0000 ~ 02115478 n 0000 ~ 02115987 n 0000 ~ 02116630 n 0000 %p 02161498 n 0000 | a member of the genus Canis (probably descended from the common wolf) that has been domesticated by man since prehistoric times; occurs in many breeds; "the dog barked all night"
正如您所看到的,我们已经找到了以02086723
开头的行。该行的内容在WNDB中描述为:
synset_offset lex_filenum ss_type w_cnt word lex_id [word lex_id...] p_cnt [ptr...] [frames...] | gloss
synset_offset我们已经知道了,
lex_filenum
说我们的单词在词典编纂者的哪个文件中(这是我最不理解的部分),
ss_type
是n
,它告诉我们它是一个名词,
w_cnt
:两位十六进制整数,表示同义集中的单词数,在本例中为03
,这意味着我们在该同义集中有3个单词:dog 0 domestic_dog 0 Canis_familiaris 0
,每个单词后面都跟一个名为:的数字
lex_id
:一位十六进制整数,当附加到引理上时,它唯一地标识词典编纂器文件中的意义
p_cnt: counts the number of pointers, which in our case is `023`, so we have 23 pointers, wow
p_cnt
之后是指针,每个指针的格式为:
pointer_symbol synset_offset pos source/target
其中pointer_symbol
是关于像我展示的符号(@,~,…),
synset_offset
:是pos
对应的数据文件中目标synset的字节偏移量
source/target
:字段区分词汇指针和语义指针。它是一个四字节字段,包含两个两位数的十六进制整数。前两位数字表示当前(源)同义词集中的单词编号,后两位数字指示目标同义词集中的单词编号。值0000表示pointer_symbol表示当前(源)synset和由synset_offset指示的目标synset之间的语义关系。
好的,让我们来检查第一个指针:
@ 02085998 n 0000
它是一个带有符号@
的指针,表示它是Hypernym
,并指向类型为n
(名词)的带有偏移02085998
的同义集,而source/target
是0000
当我在data.noun中搜索时,我会得到
02085998 05 n 02 canine 0 canid 0 011 @ 02077948 n 0000 #m 02085690 n 0000 + 02688440 a 0101 ~ 02086324 n 0000 ~ 02086723 n 0000 ~ 02116752 n 0000 ~ 02117748 n 0000 ~ 02117987 n 0000 ~ 02119787 n 0000 ~ 02120985 n 0000 %p 02442560 n 0000 | any of various fissiped mammals with nonretractile claws and typically long muzzles
其为CCD_ 41的CCD_。所以这就是你如何找到同义词之间的关系。我想这行中dog的指针符号只是为了告诉我可以为dog这个词找到哪些类型的关系?这不是多余的吗?因为正如我们所看到的,这些指针符号已经在每个synset_offsets
中。当我们查看data.noun
中的每个synset_offset
时,我们可以看到这些指针符号,那么为什么它们在index.noun
文件中是必要的呢?
另外,请注意,我根本没有使用词典编纂者文件。我知道在data.noun
中,特别是在字段lex_filenum
中,我可以知道dog
的数据结构位于哪里,但这个结构是什么?正如你所看到的,我可以通过查看index
和data
文件找到超名词和许多其他关系,我没有使用任何所谓的词典编纂器文件
您正在查找此页面:https://wordnet.princeton.edu/wordnet/man/lexnames.5WN.html
在WordNet开发过程中,根据句法类别和逻辑分组,将语法集组织成45个词典编纂器文件
这些分组是超次名称层次本体的某种并行集群(平面分组)。
简而言之:
来自文档:
文件格式[WordNet-3.0/dict/
]中词典编纂者文件的格式
lexname中的每一行都包含3个以制表符分隔的字段,并以换行符结束。第一个字段是两位数的十进制整数文件号。(列表中的第一个文件编号为00。)第二个字段是由该数字表示的词典编纂器文件的名称,第三个字段是一个整数,表示文件中包含的同义词集的语法类别。这只是程序和脚本的快捷方式,因为语法类别也是词典编纂器文件名的一部分。
在外行的解释中(我):
这只是如何为文件中的第二列分配值的标准,例如
data.nouns
、data.verbs
等。传统上,Wordnet创建者/维护者应该相应地命名他们的文件,但有时,只需将所有名词放在一起并使用索引来表示synset的类别会更容易。
分类指南如下:
File Number Name Contents
00 adj.all all adjective clusters
01 adj.pert relational adjectives (pertainyms)
02 adv.all all adverbs
03 noun.Tops unique beginner for nouns
04 noun.act nouns denoting acts or actions
05 noun.animal nouns denoting animals
06 noun.artifact nouns denoting man-made objects
07 noun.attribute nouns denoting attributes of people and objects
08 noun.body nouns denoting body parts
09 noun.cognition nouns denoting cognitive processes and contents
10 noun.communication nouns denoting communicative processes and contents
11 noun.event nouns denoting natural events
12 noun.feeling nouns denoting feelings and emotions
13 noun.food nouns denoting foods and drinks
14 noun.group nouns denoting groupings of people or objects
15 noun.location nouns denoting spatial position
16 noun.motive nouns denoting goals
17 noun.object nouns denoting natural objects (not man-made)
18 noun.person nouns denoting people
19 noun.phenomenon nouns denoting natural phenomena
20 noun.plant nouns denoting plants
21 noun.possession nouns denoting possession and transfer of possession
22 noun.process nouns denoting natural processes
23 noun.quantity nouns denoting quantities and units of measure
24 noun.relation nouns denoting relations between people or things or ideas
25 noun.shape nouns denoting two and three dimensional shapes
26 noun.state nouns denoting stable states of affairs
27 noun.substance nouns denoting substances
28 noun.time nouns denoting time and temporal relations
29 verb.body verbs of grooming, dressing and bodily care
30 verb.change verbs of size, temperature change, intensifying, etc.
31 verb.cognition verbs of thinking, judging, analyzing, doubting
32 verb.communication verbs of telling, asking, ordering, singing
33 verb.competition verbs of fighting, athletic activities
34 verb.consumption verbs of eating and drinking
35 verb.contact verbs of touching, hitting, tying, digging
36 verb.creation verbs of sewing, baking, painting, performing
37 verb.emotion verbs of feeling
38 verb.motion verbs of walking, flying, swimming
39 verb.perception verbs of seeing, hearing, feeling
40 verb.possession verbs of buying, selling, owning
41 verb.social verbs of political and social activities and events
42 verb.stative verbs of being, having, spatial relations
43 verb.weather verbs of raining, snowing, thawing, thundering
44 adj.ppl participial adjectives
例如,在WordNet-3.0/dict/data.noun
中,我们看到行:
00034213 03 n 01 phenomenon 0 008 @ 00029677 n 0000 ~ 11408559 n 0000 ~ 11408733 n 0000 ~ 11408914 n 0000 ~ 11410625 n 0000 ~ 11418138 n 0000 ~ 11418460 n 0000 ~ 11529295 n 0000 | any state or process known through the senses rather than by intuition or reasoning
00034479 04 n 01 thing 0 001 @ 00037396 n 0000 | an action; "how could you do such a thing?"
查看第2列,对于phenomenon
,值为指向noun.Tops
的03
。
对于thing
,它具有值04
,该值是指noun.act
。
IMHO,根据使用情况,这些分配可能没有用处。它们主要用于创建wordnet以及我们如何轻松地将本体层次结构扁平化为简单的扁平集群。
这些信息中有用的是它们之间存在的关系,以及(有时)信息的类型。每个人都使用Wordnet!有些人甚至将其与RDF表示法联系起来。但是我几年前就使用过Wordnet,因为我想建立一个单词的超树,它们的超类和子类,加上WN中没有的其他一些类型的关系,我不得不放弃Wordnet及其行话。我需要一个"不那么简化"的"真实世界"组织。我想出了自己的方法,混合了Wiktionary、许多正则表达式、一些YAGO、一些其他可以让我建立层次结构和其他关系的本体,还有一些ML。我还研究了Roger Schank的分类法、Roget词库,以及识别和分类(类型学)概念的各种尝试,如Wierzbicka和其他概念。如果你想要严肃的东西,diy。