Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neeme Kahusk
Lightewn
Commits
10acb14d
Commit
10acb14d
authored
Feb 17, 2015
by
Neeme Kahusk
Browse files
pwn relations
parent
877576be
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/visdic.py
View file @
10acb14d
...
...
@@ -78,6 +78,13 @@ POINTER_SYMBOLS = { # (symbol, pos):
(
';u'
,
'r'
):{
'gloss'
:
'Domain of synset - USAGE '
,
'vis'
:
'domain_of_usage'
},
}
def
deadj
(
iStr
):
"""Remove part in parentheses (used at adjectives)
"""
if
iStr
.
count
(
'('
):
return
iStr
[
0
:
iStr
.
index
(
'('
)]
else
:
return
iStr
def
parse_wn_index
(
path
):
"""parses index.sense file of Princeton WN
...
...
@@ -240,11 +247,11 @@ def parse_dataline(iList,indexDict=WNI):
for
i
in
oDict
[
'synonym'
]:
sensesDict
=
find_sensenumbers
(
indexDict
,
i
[
'word'
],
deadj
(
i
[
'word'
]
)
,
oDict
[
'ss_type'
])
for
j
in
sensesDict
.
values
():
if
j
[
'word'
]
==
i
[
'word'
].
lower
()
and
j
[
'word'
]
==
deadj
(
i
[
'word'
].
lower
()
)
and
j
[
'synset_offset'
]
==
oDict
[
'synset_offset'
]:
i
[
'sense_number'
]
=
j
[
'sense_number'
]
...
...
@@ -445,7 +452,7 @@ def make_visdic_xml(dataDict,xml):
for
j
in
i
[
'synonym'
]:
literal
=
etree
.
SubElement
(
synonym
,
'LITERAL'
)
literal
.
text
=
j
[
'word'
]
literal
.
text
=
j
[
'word'
]
try
:
sense
=
etree
.
SubElement
(
literal
,
'SENSE'
).
text
=
j
[
'sense_number'
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment