掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 1740|回复: 4

[词典求助] Wordnet MySQL

[复制链接]

该用户从未签到

发表于 2016-5-13 19:58:53 | 显示全部楼层 |阅读模式
完整版本# c  H6 p" ~8 ~0 M7 I3 T+ e

" O+ |' R3 i% p% x; K, nhttps://sourceforge.net/projects/wnsql/files/8 q6 V8 v+ q6 G- u( {3 K
6 j1 W% c5 F! I  q' H

" f8 g2 H- n! e/ _不少在线字典都是用这数据。* @9 s) G* P( s" S* I

. O5 p7 `% [' J# a9 s. p7 ]6 z谁会用这个数据库?怎样快速查到同义词、反义词等等?

该用户从未签到

 楼主| 发表于 2016-5-14 01:34:12 | 显示全部楼层
找到一份资料:
! w7 D7 ?  N$ U2 |' K3 c. z9 c2 I( B( @& K& U$ U# X
https://stackoverflow.com/questi ... net-sql-explanation
# R* t/ {! P1 r1 V6 i" B+ b
4 e3 |- V8 b1 W' T' |: cThe Synset Table The synsets table is one of the most important tables in the database. It is responsible for housing all the definitions within WordNet. Each row in the synset table has a synsetid, a definition, a pos (parts of speech field) and a lexdomainid (which links to the lexdomain table) There are 117373 synsets in the WordNet Database.
) l  W" a: z5 h( @' f4 |8 e' D6 M- M* f; z4 Y
The Words Table WordNet also has a “words” table, that only has two fields: a wordid, and a “lemma”. The words table is responsible for housing all the lemmas (base words) within the Wordnet Database. There are 146625 entries in this table( X2 t. m( |, g& A( Q& Q

/ e( ?- ^8 c% x2 CSo.. how are these two tables linked? The answer? The sense table!
# a3 n' I( e" l/ t
& U8 w( b. I- y9 \9 G0 MThe Sense Table The sense table is responsible for linking together words (in the words table), with definitions (in the synset table). The entries in the sense table are referred as “word-sense pairs” - because each pairing of a wordid with a synset is one complete meaning of a word - a “sense of the word”.
, Z7 n, L" ?0 s7 W  RThere are a total of 206,354 word senses in the WordNet database.
. E7 K& G$ x* I, N. T2 g( f& c+ J3 _8 b1 p
The Lexdomains table The Lexdomains table is referenced by the sense table, and is used to define what lexical domain a word-sense pair belongs to. There are 45 lexical domains in the lexdomains table. The lexdomain table therefore, is WordNet’s way of “tagging” a word-sense pair. However, it is quite limited, because a word-sense pair can only belong to ONE lexical domain.
) q8 `; }" _1 O' @
$ {2 I! l. `) A5 N+ U- x. gThe 45 lexical domains include:" N# y4 S. R# f% ^" k
" B/ y  e( T! v2 i; Y  \
Adjectives: all, pert
; U) z" o' f0 _3 V6 h' S3 H) C$ i7 L+ R, H2 G
Adverbs all
4 ]) u, T+ t5 L$ d7 k- @- C  [9 }: b+ ~8 t1 c& Y! }& Z
Nouns tops, act, animal, artifact, attribute,body, cognition, communication, event, feeling, food, group, location,motive,object, person, phenomenon, plant, possession, process, quantity,linkdef, shape, state, substance, time," J& p; L3 X6 p

& U& ~  p, D* BVerbs body, change, cognition,communication, competition, consumption, contact, creation, emotion, motion, perception, possession, social, stative, weather, ppl
: |1 x" X: X6 D3 e  g3 S3 m. @$ A2 \: f  T) b7 O$ A
The casedwords table Some words within the words table naturally have the first letter capitalized ie: “A-team”. Since the words table stores all words as lowercase, WordNet uses this table to specify the uppercase version of the word. There are 40313 entries in this table.
/ B4 q. I6 C8 B, |) ]
9 V3 p& }  s5 z, C9 w' L9 IThere are many other tables in the WordNet DB, once I have them researched, I'll post again.. d% g, U8 i; K8 O- }

' d0 w: _2 A& N% J7 [Finding yer synonyms To answer your question regarding synonyms - You need to do the following.
* N  V' A) w; w4 f  y7 M* k+ p
) A1 C' n8 Z: W9 q6 e& a& |Let's say you want to find the synonyms for the word "Carry". In order to do so, you would first search the words table for a lemma matching the word "carry". This would yield the wordid 21253. You would then search the senses table, to find all word-sense pairs for the word carry. This yields 41 results - each result lists the wordid 21253, and a senseid (which is the index of the word-sense pair) and a synsetid.
' g9 a  K9 N" n  X# |2 V+ u* E% t1 |3 ~- ^2 e, F1 |1 u+ y& Y5 x& y; y
Now, you would then need to query the synset table for each of the synsetid's returned so you can access the associated definition field in the synset table.$ P, ^# Q, h: `& {7 |  ?

& _4 J! |* x, w" v+ H5 Z* x- qLastly to find the synonyms for each of the synsets listed, you'd simply need to search the sense table for other word-sense pairs that shared the same synset.3 g2 f5 p- R. r. L( {! N
2 E' F& E# [$ [
Example: One of the 41 word-sense pairs for the word "carry" is listed below: wordsense example If we lookup the definition for this synsetid 202083512, you will find “transmit or serve as the medium for transmission”
5 e& a( U& k( ?7 N+ b* x+ K! }7 X8 N9 K5 v
To find all the synonyms for this definition, you would then search the sense table for the same synsetid 202083512. This yields synonyms: channel, conduct, convey, impart, and transmit (note: you will need to left join the words table to get the actual lemmas)

该用户从未签到

发表于 2016-7-5 13:08:57 | 显示全部楼层
用nltk调用wordnet非常方便。。。。

该用户从未签到

 楼主| 发表于 2016-7-5 18:28:14 | 显示全部楼层
fnaviwwo1 发表于 2016-7-5 13:08# ~/ V" |2 a1 r! ?: f
用nltk调用wordnet非常方便。。。。

) g" d1 ?  E6 J6 z$ ~% M0 ]嗯 是的 发现到了 谢谢
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

小黑屋|手机版|Archiver|PDAWIKI |网站地图

GMT+8, 2025-4-24 09:20 , Processed in 0.020726 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表