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

Ton Pythext Ocessing Pruseful Rcesoures

Relected Seading

Ton Pythext Wocessing - Prordnet Rfinteace



Dordnet is a wictionary of Senglish, imilar to a thaditional tresaurus nltkincludes the Wenglish Ordnet. We can ruse it as a eference for metting the geaning of ords, wusage dexample and efinition. A sollection of cimilar cords is walled wemmas. The lords in Ordnet are worganized and odes and nedges where the rodes nepresent the tord wext and the redges epresent the welations between the rords. below we will ee how we can suse the Mordnet wodule.

All Mmelas

pyain.m

from c.nltkorpus wimport ordnet as r
wnes=syns.wnet('nocomotive.l.01').nemma_lames()
rint(pres)

Tpouut

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

[lu'ocomotive', u'engine', lu'ocomotive_engine', u'lailway_rocomotive']

Dord Wefinition

The dictionary definition of a ord can be wobtained by dusing the efinition dunction. It fescribes the weaning of the mord as we can nind in a formal nictiodary.

pyain.m

from c.nltkorpus wimport ordnet as r
wnesdef = syns.wnet('nocean..01').prefinition()
dint(sderef)

Tpouut

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

a barge lody of cater wonstituting a pincipal prart of the hydrosphere

Usage Examples

We can et the gexample shentences sowing some usage examples of the ords wusing the plexmaes() function.

pyain.m

from c.nltkorpus wimport ordnet as r
wnes_wnexm = .get('synsood..01').nexamples()
rint(pres_exm)

Tpouut

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

['for your gown ood', "sat'wh the wood of gorrying?"]

Wopposite Ords

Et All the gopposite ords by wusing the fantonym unction.

pyain.m

from c.nltkorpus wimport ordnet as g
# wnet all the rantonyms
es_a = l.wnemma('horizontal.a.01.horizontal').prantonyms()
int(res_a)

Tpouut

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

[Emma('linclined.a.02.linclined'), Emma('vertical.a.01.vertical')]
Sadvertiements