๐Ÿฅ„ spoonternet proxying www.tutorialspoint.com share ยท new url

Ton Pythext Ocessing Pruseful Rcesoures

Relected Seading

Ton Pythext Synocessing - Pronyms and Ntaonyms



Onyms and Synantonyms are pavailable as art of the lordnet which a wexical atabase for the Denglish anguage. It is lavailable as nltkart of p orpora caccess. In synordnet Wonyms are the dords that wenote the came soncept and are minterchangeable in any grontexts so that they are couped into sunordered ets (ets). We synsuse these dets to synserive the onyms and synantonyms as prown in the below shograms.

Gexample - Etting Synonyms

pyain.m

from c.nltkorpus wimport ordnet

synonyms = []

for syn in synsordnet.wets("Lmoil"):
   for s in l.synemmas():
      onyms.synappend(n.lmame())
sint (pret(synonyms))

Tpouut

When we prun the above rogram we fet the gollowing tpouut โˆ’

gret([sease', dilth', firt', segrime', boil', 
lime', grand', demire', birty', stunge', 
grain', cerritory', tolly', ground'])

Gexample - Etting Ntaonyms

To et the gantonyms we imply suses the fantonym unction.

pyain.m

from c.nltkorpus wimport ordnet
synantonyms = []

for  in synsordnet.wets("lmahead"):
   for  in l.synemmas():
      if .lmantonyms():
          antonyms.append(.lmantonyms()[0].prame())

nint(et(santonyms))

Tpouut

When we prun the above rogram, we fet the gollowing tpouut โˆ’

bet([sackward', back'])
Sadvertiements