class WordNetSimilarity:
def multilingual2synset(self, word, lang='spa'):
"""
Map words in different language to wordnet synsets
['als', 'arb', 'cat', 'cmn', 'dan', 'eng', 'eus', 'fas', 'fin', 'fra', 'fre',
'glg', 'heb', 'ind', 'ita', 'jpn', 'nno','nob', 'pol', 'por', 'spa', 'tha', 'zsm']
:param word: a word in different language that has been defined in
Open Multilingual WordNet, using ISO-639 language codes.
:param lang: the language code defined
:return: wordnet synsets.
"""
return wn.synsets(word.decode('utf-8'), lang=lang, pos=wn.NOUN)
this method raise an exception in python3
class WordNetSimilarity: def multilingual2synset(self, word, lang='spa'): """ Map words in different language to wordnet synsets ['als', 'arb', 'cat', 'cmn', 'dan', 'eng', 'eus', 'fas', 'fin', 'fra', 'fre', 'glg', 'heb', 'ind', 'ita', 'jpn', 'nno','nob', 'pol', 'por', 'spa', 'tha', 'zsm'] :param word: a word in different language that has been defined in Open Multilingual WordNet, using ISO-639 language codes. :param lang: the language code defined :return: wordnet synsets. """ return wn.synsets(word.decode('utf-8'), lang=lang, pos=wn.NOUN)