'build anthology based on keywords
I tried to use nltk to extract hyponyms for a given list of words, specifically, for some combined words
my code:
import nltk
from nltk.corpus import wordnet as wn
list = ['artificial_intelligence', "real_time", 'Big_data', "Internet_of_things", "Healthcare",
'Fuzzy_logic', 'deep learning', 'Computer_vision', 'machine_learning']
def get_synset(a_list):
synset_list = []
for word in a_list:
a = wn.synsets(word)[:1] #The index is to ensure each word gets assigned 1st synset only
synset_list.append(a)
return synset_list
lst_synsets = get_synset(list)
lst_synsets
Here is the output:
[[Synset('artificial_intelligence.n.01')],
[Synset('real_time.n.01')],
[],
[],
[Synset('healthcare.n.01')],
[Synset('fuzzy_logic.n.01')],
[],
[],
[]]
I couldn't find NLTK Wordnet Synsets for combined items (e.g. Big data, Internet of things, machine learning, etc) since it doesn't have them.
Is there a way to do that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
