Arabic Word Net synonyms in Python?

前端 未结 1 1175
小鲜肉
小鲜肉 2021-01-21 07:12

I am using python 2.7, I am trying to get synonyms of Arabic words using Arabic WordNet

I downloaded both needed files:

  1. AWNDatabaseManagement.py
相关标签:
1条回答
  • 2021-01-21 07:15

    Arabic Wordnet works independent of nltk. In the folder where you have AWNDatabaseManagement.py and upc_db.xml, put your script and change it to:

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

    Output will be:

    itemid  jamiyl_a1AR
    offset  300218842
    name  جَمِيل
    type  synset
    pos  a
    input links  [[u'be_in_state', u'jamaAl_n1AR'], [u'near_antonym', u'qabiyH_a1AR']]
    output links  [[u'near_antonym', u'qabiyH_a1AR']]
    
    0 讨论(0)
提交回复
热议问题