Skip to main content
. 2022 May 12;12:7864. doi: 10.1038/s41598-022-11833-1

Table 2.

The expansion of synonyms, hypernyms and hyponyms based on WordNet.

The query for the set of synonyms of the same part of speech of ‘reduction’ is coded as:

from nltk.corpus import wordnet as wn

sets = wn.synsets('reduction', pos = wn.NOUN)

print(sets)

The result of the operation:[Synset('decrease.n.04')]

The query for the set of hypernyms of ‘reduction’ is coded as:

from nltk.corpus import wordnet as wn

reduction = wn.synset('reduction.n.01')

hypernym_sets = reduction.hypernyms()

print(hypernym_sets)

root_hypernym = reduction.root_hypernyms()

print(root_hypernym)

The result of the operation:[Synset('change_of_magnitude.n.01')][Synset('entity.n.01')]

The query for the set of hyponyms of ‘reduction’ is coded as:

from nltk.corpus import wordnet as wn

reduction = wn.synset('reduction.n.01')

hyponym_sets = reduction.hyponyms()

print(hyponym_sets)

The result of the operation:

[Synset('amortization.n.01'), Synset('contraction.n.04'), Synset('cut.n.19'), Synset('cutback.n.01'), Synset('de-escalation.n.01'),

Synset('declassification.n.01'), Synset('deflation.n.03'), Synset('depletion.n.01'), Synset('depreciation.n.01'), Synset('devaluation.n.02'),

Synset('devitalization.n.01'), Synset('discount.n.01'), Synset('easing.n.02'), Synset('extenuation.n.02'), Synset('lowering.n.01'),

Synset('minimization.n.01'), Synset('moderation.n.04'), Synset('reverse_split.n.01'), Synset('rollback.n.02'), Synset('shortening.n.02'),

Synset('shrinking.n.02'), Synset('subtraction.n.02'), Synset('tax_credit.n.01'), Synset('tax_shelter.n.01'), Synset('weakening.n.02')]