Commit 10acb14d authored by Neeme Kahusk's avatar Neeme Kahusk
Browse files

pwn relations

parent 877576be
......@@ -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']
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment