Arabic Word Net synonyms in Python? -


i using python 2.7, trying synonyms of arabic words using arabic wordnet

i downloaded both needed files:

  1. awndatabasemanagement.py
  2. upc_db.xml

based on this answer, made few edits in awndatabasemanagement.py:

  1. line 320 opts['i']='upc_db.xml' instead of

    opts['i']='e:/usuaris/horacio/arabicwn/awndatabase/upc_db.xml'

  2. i added @ end wn.get_synsets_from_word(u"جَمِيل")

  3. i added @ line 2: # -*- coding: utf-8 -*-

then ran using: $ python awndatabasemanagement.py -i upc_db.xml , no errors found: <open file 'upc_db.xml', mode 'r' @ 0x10156c270>

yet when run original py file:

from nltk.corpus import wordnet wn jan = wn.synsets('wait')[0] print(jan) #this works fine print(jan.lemma_names(lang='arb')) #this works fine  wn.get_synsets_from_word(u"جَمِيل") 

i :

`synset('delay.n.01') [u'\u0627\u0650\u0646\u0652\u062a\u0650\u0638\u0627\u0631', u'\u062a\u0623\u062c\u0650\u064a\u0644', u'\u062a\u0623\u062e\u0650\u064a\u0631', u'\u062a\u0648\u0642\u0651\u064f\u0641'] traceback (most recent call last): file "c:/users/pycharmprojects20dec.py" line 492, in <module> wn.get_synsets_from_word("جَمِيل") attributeerror: 'wordnetcorpusreader' object has no attribute 'get_synsets_from_word` 

i don't know problem.

arabic wordnet works independent of nltk. in folder have awndatabasemanagement.py , upc_db.xml, put script , change to:

from awndatabasemanagement import wn synsets = wn.get_synsetids_from_word(u"جَمِيل") s in synsets:     wn._items[s].describe() 

output be:

itemid  jamiyl_a1ar offset  300218842 name  جَمِيل type  synset pos  input links  [[u'be_in_state', u'jamaal_n1ar'], [u'near_antonym', u'qabiyh_a1ar']] output links  [[u'near_antonym', u'qabiyh_a1ar']] 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -