Created
January 25, 2021 14:01
-
-
Save LowriWilliams/4e9a7f2c604810cf0da7e1d579028f41 to your computer and use it in GitHub Desktop.
wn/hypernyms_hyponyms.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 29, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\n", | |
"Synset abstract term for 'dog': [Synset('canine.n.02'), Synset('domestic_animal.n.01')]\n", | |
"\n", | |
"Synset specific term for 'dog': [Synset('bitch.n.04'), Synset('dog.n.01'), Synset('fox.n.01'), Synset('hyena.n.01'), Synset('jackal.n.01'), Synset('wild_dog.n.01'), Synset('wolf.n.01')]\n", | |
"\n", | |
"Synset root hypernerm for 'dog': [Synset('entity.n.01')]\n", | |
"\n", | |
"\n", | |
"\n", | |
"Synset abstract term for 'run': [Synset('travel_rapidly.v.01')]\n", | |
"\n", | |
"Synset specific term for 'run': [Synset('flit.v.01'), Synset('run.v.01'), Synset('zoom.v.01')]\n", | |
"\n", | |
"Synset root hypernerm term for 'run': [Synset('travel.v.01')]\n" | |
] | |
} | |
], | |
"source": [ | |
"print (\"\\nSynset abstract term for 'dog': \", wn.synset('dog.n.01').hypernyms()) \n", | |
" \n", | |
"print (\"\\nSynset specific term for 'dog': \", wn.synset('dog.n.01').hypernyms()[0].hyponyms()) \n", | |
" \n", | |
"print (\"\\nSynset root hypernerm for 'dog': \", wn.synset('dog.n.01').root_hypernyms()) \n", | |
"\n", | |
"print(\"\\n\")\n", | |
"\n", | |
"print (\"\\nSynset abstract term for 'run': \", wn.synset('run.v.01').hypernyms()) \n", | |
" \n", | |
"print (\"\\nSynset specific term for 'run': \", wn.synset('run.v.01').hypernyms()[0].hyponyms()) \n", | |
" \n", | |
"print (\"\\nSynset root hypernerm term for 'run': \", wn.synset('run.v.01').root_hypernyms()) " | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment