{"id":19467306,"url":"https://github.com/thunlp/openhownet","last_synced_at":"2025-05-16T04:00:23.696Z","repository":{"id":42461165,"uuid":"166509445","full_name":"thunlp/OpenHowNet","owner":"thunlp","description":"Core Data of HowNet and OpenHowNet Python API","archived":false,"fork":false,"pushed_at":"2021-12-16T17:14:40.000Z","size":271131,"stargazers_count":619,"open_issues_count":5,"forks_count":87,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-05-10T01:38:08.054Z","etag":null,"topics":["hownet","knowledge-base","nlp","openhownet","semantics","sememe"],"latest_commit_sha":null,"homepage":"https://openhownet.thunlp.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thunlp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-19T05:22:15.000Z","updated_at":"2025-05-01T06:38:41.000Z","dependencies_parsed_at":"2022-09-26T17:31:05.792Z","dependency_job_id":null,"html_url":"https://github.com/thunlp/OpenHowNet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FOpenHowNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FOpenHowNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FOpenHowNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FOpenHowNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thunlp","download_url":"https://codeload.github.com/thunlp/OpenHowNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464890,"owners_count":22075570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hownet","knowledge-base","nlp","openhownet","semantics","sememe"],"created_at":"2024-11-10T18:34:29.834Z","updated_at":"2025-05-16T04:00:23.665Z","avatar_url":"https://github.com/thunlp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### [中](README_ZH.md)|En\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://openhownet.thunlp.org/\"\u003e\n    \u003cimg src=\"openhownet-logo.png\" width = \"300\"  alt=\"OpenHowNet Logo\" align=center /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://openhownet.readthedocs.io/\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://readthedocs.org/projects/openhownet/badge/?version=latest\" alt=\"ReadTheDoc Status\"\u003e\n  \u003c/a\u003e\n  \u003ca  href=\"https://pypi.org/project/OpenHowNet/\"  target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/OpenHowNet?label=pypi\" alt=\"PyPI version\"\u003e\n  \u003c/a\u003e\n  \u003ca  href=\"https://github.com/thunlp/OpenHowNet/releases\"  target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/thunlp/OpenHowNet\" alt=\"GitHub release (latest by date)\"\u003e  \n  \u003c/a\u003e\n  \u003ca target=\"_blank\"\u003e\n    \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/thunlp/OpenHowNet\"\u003e\n  \u003c/a\u003e\n   \u003ca target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/PRs-Welcome-red\" alt=\"PRs are Welcome\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nOpenHowNet API is developed by [THUNLP](http://thunlp.org/), which provides a convenient way to search information in HowNet, display sememe trees, calculate word similarity via sememes, etc. You can also visit our [website](https://openhownet.thunlp.org) to enjoy searching and exhibiting sememes of words online.\n\n\nIf you use any data or API provided by OpenHowNet in your research, please cite the following paper:\n\n```\n@article{qi2019openhownet,\n    title={OpenHowNet: An Open Sememe-based Lexical Knowledge Base},\n    author={Qi, Fanchao and Yang, Chenghao and Liu, Zhiyuan and Dong, Qiang and Sun, Maosong and Dong, Zhendong},\n    journal={arXiv preprint arXiv:1901.09957},\n    year={2019},\n}\n```\n\n## Introduction to HowNet\n\nHowNet is the most typical *sememe* knowledge base. A sememe is defined as the minimum semantic unit in linguistics, and some linguists believe that the meanings of all words in any language can be represented by a limited set of sememes. Mr Zhendong Dong and his son Qiang Dong put this idea into practice, and spent almost 30 years building HowNet, which predefines about 2,000 sememes and uses them to annotate over 200,000 senses of English and Chinese words.\n\nSince HowNet was constructed, it has been widely utilized in various NLP tasks. You can refer to [this paper list](https://github.com/thunlp/SCPapers) to take a look at all the HowNet-related studies.\n\n## HowNet Dictionary\n\nHowNet core data file (namely HowNet dictionary that can be downloaded [here](https://openhownet.thunlp.org/download)) consists of 237,973 concepts (or senses) represented by Chinese \u0026 English words and phrases. Each concept in HowNet is annotated with a sememe-based definition, the POS tag, sentiment orientation, example sentences, etc. Here is an example of how concepts are annotated in HowNet:\n\n\n```\nNO.=000000026417 \t# Concept ID\nW_C=不惜 \t# Chinese word\nG_C=verb \t# POS tag of the Chinese word\nS_C=PlusFeeling|正面情感 \t# Sentiment orientation\nE_C=~牺牲业余时间，~付出全部精力，~出卖自己的灵魂 \t# Example sentences of the Chinese word\nW_E=do not hesitate to \t# English word \nG_E=verb \t# POS tag of the English word\nS_E=PlusFeeling|正面情感 \t# Sentiment orientation\nE_E=               \t# Example sentences of the English word\nDEF={willing|愿意} \t# Sememe-based definition\nRMK=\n```\n\n\n## OpenHowNet API\n\n### Installation\n\nYou can choose either of the following two methods to install OpenHowNet API.\n\n1. **Installation via pip** (recommended)\n\n```bash\npip install OpenHowNet\n```\n\n2. **Installation via Github**\n\n\n```bash\ngit clone https://github.com/thunlp/OpenHowNet/\ncd OpenHowNet\npython setup.py install\n```\n\n##### Requirements\n\n\n* Python\u003e=3.6\n* anytree\u003e=2.4.3\n* tqdm\u003e=4.31.1\n* requests\u003e=2.22.0\n\n### Core Data Type\n\n* **HowNetDict**：HowNet dictionary class, which encapsulates the core functions such as HowNet core data retrieval, presentation, similarity calculation, etc.\n* **Sense**：The class that encapsulates the information of concepts in HowNet, mainly including Chinese and English words, POS, sememe-based definition, etc.\n* **Sememe**：The class that encapsulates the information of sememes in HowNet, including Chinese and English words describing a sememe, frequency of a sememe in HowNet, and the relationship between sememes.\n\n### Basic Usage\n\nThe following code snippets illustrate some basic functions of OpenHowNet API. You can also download this [Jupyter Notebook](OpenHowNet_demo.ipynb) to run the code. For more functions and detailed information, please turn to our [documentation](https://openhownet.readthedocs.io/).\n\n\n#### Initialization\n\n\n```python\nimport OpenHowNet\nhownet_dict = OpenHowNet.HowNetDict()\n```\n\nAn error will occur if you haven't downloaded the HowNet data. In this case you need to run `OpenHowNet.download()` first.\n\n\n#### Get Concepts Represented by a Word\n\nBy default, the api will search HowNet for all the concepts (senses) represented by the given word (in English or Chinese) and return a list of instances in the Sense class. You can also set the language to reduce search time. If the given word does not exist in HowNet, this api will return an empty list.\n\n```python\n\u003e\u003e\u003e # Get all the senses represented by the word \"苹果\".\n\u003e\u003e\u003e result_list = hownet_dict.get_sense(\"苹果\")\n\u003e\u003e\u003e print(\"The number of retrievals: \", len(result_list))\nThe number of retrievals:  8\n \n\u003e\u003e\u003e print(\"An example of retrievals: \", result_list)\nAn example of retrievals:  [No.244401|apple|苹果, No.244402|malus pumila|苹果, No.244403|orchard apple tree|苹果, No.244396|apple|苹果, No.244397|apple|苹果, No.244398|IPHONE|苹果, No.244399|apple|苹果, No.244400|iphone|苹果]\n```\n\nYou can get the detailed information of a sense by the Sense instance.\n\n```python\n\u003e\u003e\u003e sense_example = result_list[0]\n\u003e\u003e\u003e print(\"Sense example:\", sense_example)\nSense example: No.244401|apple|苹果\n\u003e\u003e\u003e print(\"Sense id: \",sense_example.No)\nSense id:  000000244401\n\u003e\u003e\u003e print(\"English word in the sense: \", sense_example.en_word)\nEnglish word in the sense:  apple\n\u003e\u003e\u003e print(\"Chinese word in the sense: \", sense_example.zh_word)\nChinese word in the sense:  苹果\n\u003e\u003e\u003e print(\"HowNet Def of the sense: \", sense_example.Def)\nHowNet Def of the sense:  {tree|树:{reproduce|生殖:PatientProduct={fruit|水果},agent={~}}}\n\u003e\u003e\u003e print(\"Sememe list of the sense: \", sense_example.get_sememe_list())\nSememe list of the sense:  {fruit|水果, tree|树, reproduce|生殖}\n```\n\nYou can visualize the structured sememe-based definition of a sense  (namely the \"sememe tree\") \n\n\n```python\n\u003e\u003e\u003e sense_example.visualize_sememe_tree()\n[sense]No.244401|apple|苹果\n└── [None]tree|树\n    └── [agent]reproduce|生殖\n        └── [PatientProduct]fruit|水果\n```\n\n#### Get All Words and Sememes in HowNet\n\nThe package provides api to get all the senses, words and sememes in HowNet.\n\n\n```python\n\u003e\u003e\u003e all_senses = hownet_dict.get_all_senses()\n\u003e\u003e\u003e print(\"The number of all senses: {}\".format(len(all_senses)))\nThe number of all senses: 237974\n  \n\u003e\u003e\u003e zh_word_list = hownet_dict.get_zh_words()\n\u003e\u003e\u003e print(\"Chinese words in HowNet: \",zh_word_list[:30])\nChinese words in HowNet:  ['', '\"', '#', '#号标签', '$', '$.J.', '$A.', '$NZ.', '%', \"'\", '(', ')', '*', '+', ',', '-', '--', '.', '...', '...为止', '...也同样使然', '...以上', '...以内', '...以来', '...何如', '...内', '...出什么问题', '...发生了什么', '...发生故障', '...家里有几口人']\n\n\u003e\u003e\u003e en_word_list = hownet_dict.get_en_words()\n\u003e\u003e\u003e print(\"English words in HowNet: \",en_word_list[:30])\nEnglish words in HowNet:  ['A', 'An', 'Frenchmen', 'Frenchwomen', 'Ottomans', 'a', 'aardwolves', 'abaci', 'abandoned', 'abbreviated', 'abode', 'aboideaux', 'aboiteaux', 'abscissae', 'absorbed', 'acanthi', 'acari', 'accepted', 'acciaccature', 'acclaimed', 'accommodating', 'accompanied', 'accounting', 'accused', 'acetabula', 'acetified', 'aching', 'acicula', 'acini', 'acquired']\n\n\u003e\u003e\u003e all_sememes = hownet_dict.get_all_sememes()\n\u003e\u003e\u003e print('There are {} sememes in HowNet'.format(len(all_sememes)))\nThere are 2540 sememes in HowNet\n```\n\n#### Get Sememes of a Word\n\nYou can retrieve sememe-based definitions of the senses represented by the given word. By default, the package will retrieve all the senses represented by the word and return their sememe list separately.\n\n\n```python\n\u003e\u003e\u003e hownet_dict.get_sememes_by_word(word = '苹果', display='list', merge=False, expanded_layer=-1, K=None)\n[{'sense': No.244396|apple|苹果,\n  'sememes': {PatternValue|样式值, SpeBrand|特定牌子, able|能, bring|携带, computer|电脑}},\n {'sense': No.244397|apple|苹果, \n  'sememes': {fruit|水果}},\n {'sense': No.244398|IPHONE|苹果,\n  'sememes': {PatternValue|样式值, SpeBrand|特定牌子, able|能, bring|携带, communicate|交流, tool|用具}},\n {'sense': No.244399|apple|苹果,\n  'sememes': {PatternValue|样式值, SpeBrand|特定牌子, able|能, bring|携带, communicate|交流, tool|用具}},\n {'sense': No.244400|iphone|苹果,\n  'sememes': {PatternValue|样式值, SpeBrand|特定牌子, able|能, bring|携带, communicate|交流, tool|用具}},\n {'sense': No.244401|apple|苹果, \n  'sememes': {fruit|水果, reproduce|生殖, tree|树}},\n {'sense': No.244402|malus pumila|苹果,\n  'sememes': {fruit|水果, reproduce|生殖, tree|树}},\n {'sense': No.244403|orchard apple tree|苹果,\n  'sememes': {fruit|水果, reproduce|生殖, tree|树}}]\n```\n\nBy changing  `display` , the sememes of a sense can be displayed in list form(`list`), dictionary form(`dict`), tree node form(`tree`) and visualization form(`visual`).\n```python\n# Get the sememes in the form of dictionary\n\u003e\u003e\u003e hownet_dict.get_sememes_by_word(word='苹果',display='dict')[0]\n{'sense': No.244396|apple|苹果, 'sememes': {'role': 'sense', 'name': No.244396|apple|苹果, 'children': [{'role': 'None', 'name': computer|电脑, 'children': [{'role': 'modifier', 'name': PatternValue|样式值, 'children': [{'role': 'CoEvent', 'name': able|能, 'children': [{'role': 'scope', 'name': bring|携带, 'children': [{'role': 'patient', 'name': '$'}]}]}]}, {'role': 'patient', 'name': SpeBrand|特定牌子}]}]}}\n\n# Get the sememes in the form of tree node (get the root node of the sememe tree)\n\u003e\u003e\u003e d.get_sememes_by_word(word='苹果',display='tree')[0]\n{'sense': No.244396|apple|苹果, 'sememes': Node('/No.244396|apple|苹果', role='sense')}\n\n# Visualize the sememes (Set K to control the num of visualized tree to print)\n\u003e\u003e\u003e d.get_sememes_by_word(word='苹果',display='visual',K=2)\nFind 8 result(s)\nDisplay #0 sememe tree\n[sense]No.244396|apple|苹果\n└── [None]computer|电脑\n    ├── [modifier]PatternValue|样式值\n    │   └── [CoEvent]able|能\n    │       └── [scope]bring|携带\n    │           └── [patient]$\n    └── [patient]SpeBrand|特定牌子\n\nDisplay #1 sememe tree\n[sense]No.244397|apple|苹果\n└── [None]fruit|水果\n```\n\nBesides, when `display=='list'` , you can choose to merge all the sememe lists into one and limit the expand layer of the sememe trees by changing the parameter `expanded_layer`(-1 means expanding all layers).\n\n\n```python\n\u003e\u003e\u003e hownet_dict.get_sememes_by_word(word = '苹果', display='list', merge=True, expanded_layer=-1, K=None)\n{PatternValue|样式值, SpeBrand|特定牌子, able|能, bring|携带, communicate|交流, computer|电脑, fruit|水果,\n reproduce|生殖, tool|用具, tree|树}\n```\n\n\n#### Get Relationship Between Two Sememes \n\nYou can get the relationship between two sememes by inputting the words (English or Chinese) that represent the sememes. You can choose to show the triplets of (sememe1, relation, sememe2).\n\n\n```python\n\u003e\u003e\u003e relations = hownet_dict.get_sememe_relation('FormValue','圆', return_triples=False)\n\u003e\u003e\u003e print(relations)\n'hyponym'\n\n\u003e\u003e\u003e triples = hownet_dict.get_sememe_relation('FormValue','圆', return_triples=True)\n\u003e\u003e\u003e print(triples)\n[(FormValue|形状值, 'hyponym', round|圆)]\n```\n\n\n#### Get Related Sememes with a Sememe\n\nYou can search all the sememes that have a certain relation with a sememe. Similarly, a sememe should be represented by a word (English or Chinese), but the relation must be in lowercase English. \n\n\n```python\n\u003e\u003e\u003e triples = hownet_dict.get_related_sememes('FormValue', relation = 'hyponym',return_triples=True)\n\u003e\u003e\u003e print(triples)\n[(FormValue|形状值, 'hyponym', round|圆), (FormValue|形状值, 'hyponym', unformed|不成形), (AppearanceValue|外观值, 'hyponym', FormValue|形状值), (FormValue|形状值, 'hyponym', angular|角), (FormValue|形状值, 'hyponym', square|方), (FormValue|形状值, 'hyponym', netlike|网), (FormValue|形状值, 'hyponym', formed|成形)]\n```\n\n### Advanced Features\n\n#### 1: Sememe-based Word Similarity and Similar Words\n\n\nThe implementation is based on the paper:\n\n\n\u003e Jiangming Liu, Jinan Xu, Yujie Zhang. An Approach of Hybrid Hierarchical Structure for Word Similarity Computing by HowNet. In Proceedings of IJCNLP 2013. [[pdf](https://www.aclweb.org/anthology/I13-1120.pdf)]\n\n\n##### Extra Initialization\n\nBecause there are some files required to be loaded for similarity calculation, the initialization overhead will be larger than before.\n\n To begin with, you can initialize the `hownet_dict` object as follows:\n\n\n```python\n\u003e\u003e\u003e hownet_dict_advanced = OpenHowNet.HowNetDict(init_sim=True)\nInitializing OpenHowNet succeeded!\nInitializing similarity calculation succeeded!\n```\n\n\nYou can also postpone the initialization of similarity calculation until use.\n\n\n```python\n\u003e\u003e\u003e hownet_dict.initialize_similarity_calculation()\nInitializing similarity calculation succeeded!\n```\n\n##### Get senses that have exactly the same sememes\n\nYou can get senses that have the same sememe-based definition with a sense.\n\n```python\n\u003e\u003e\u003e s = hownet_dict_advanced.get_sense('苹果')[0]\n\u003e\u003e\u003e hownet_dict_advanced.get_sense_synonyns(s)[:10]\n[No.110999|pear|山梨, No.111007|hawthorn|山楂, No.111009|haw|山楂树, No.111010|hawthorn|山楂树, No.111268|Chinese hawthorn|山里红, No.122955|Pistacia vera|开心果树, No.122956|pistachio|开心果树, No.122957|pistachio tree|开心果树, No.135467|almond tree|扁桃, No.154699|fig|无花果]\n```\n\n##### Get top-K nearest words for a word\n\nThe package search for senses that are represented by the given word,  obtains the nearest top-K senses, and returns the corresponding words. Note that the language of the given word should be set. \n\nYou can also set the POS of words, choose to output the similarity, and merge all words belonging to difference senses into a single list, etc. Please see the [documentation](https://openhownet.readthedocs.io/) for more information. \n\nIf the input word is not in HowNet, the api returns an empty list.\n\n\n```python\n\u003e\u003e\u003e hownet_dict_advanced.get_nearest_words('苹果', language='zh',K=5)\n{No.244396|apple|苹果: ['IBM', '东芝', '华为', '戴尔', '索尼'],\n No.244397|apple|苹果: ['丑橘', '乌梅', '五敛子', '凤梨', '刺梨'],\n No.244398|IPHONE|苹果: ['OPPO', '华为', '苹果', '智能手机', '彩笔'],\n No.244399|apple|苹果: ['OPPO', '华为', '苹果', '智能手机', '彩笔'],\n No.244400|iphone|苹果: ['OPPO', '华为', '苹果', '智能手机', '彩笔'],\n No.244401|apple|苹果: ['山梨', '山楂', '山楂树', '山里红', '开心果树'],\n No.244402|malus pumila|苹果: ['山梨', '山楂', '山楂树', '山里红', '开心果树'],\n No.244403|orchard apple tree|苹果: ['山梨', '山楂', '山楂树', '山里红', '开心果树']}\n\u003e\u003e\u003e hownet_dict_advanced.get_nearest_words('苹果', language='zh',K=5, merge=True)\n['IBM', '东芝', '华为', '戴尔', '索尼']\n```\n\n\n##### Calculate the similarity between two words\n\n\nIf either of the two given words does not exist in HowNet,  it will return `-1`.\n\n\n```python\n\u003e\u003e\u003e print('The similarity of 苹果 and 梨 is {}.'.format(hownet_dict_advanced.calculate_word_similarity('苹果','梨')))\nThe similarity of 苹果 and 梨 is 1.0.\n```\n\n#### 2: BabelNet Synset Dictionary\n\nThis package integrates query function for information of synsets in BabelNet (BabelNet synset). [BabelNet](https://babelnet.org/) is a multilingual encyclopedia dictionary composed of BabelNet synsets, each of which contains some multilingual synonyms that have the same meaning. The following work annotates sememes for some BabelNet synsets, and the function in this part is based on its annotation results.\n\n\u003e **Towards Building a Multilingual Sememe Knowledge Base: Predicting Sememes for BabelNet Synsets**. *Fanchao Qi, Liang Chang, Maosong Sun, Sicong Ouyang and Zhiyuan Liu*. AAAI-20. [[pdf](https://arxiv.org/pdf/1912.01795.pdf)] [[code](https://github.com/thunlp/BabelNet-Sememe-Prediction)]\n\n##### Extra Initialization\nTo begin with, you should initialize the BabelNet synset dictionary:\n\n```python\n\u003e\u003e\u003e hownet_dict.initialize_babelnet_dict()\nInitializing BabelNet synset Dict succeeded!\n# Or you can initialize when create the HowNetDict instance\n\u003e\u003e\u003e hownet_dict_advanced = HowNetDict(init_babel=True)\nInitializing OpenHowNet succeeded!\nInitializing BabelNet synset Dict succeeded!\n```\n\n##### BabelNet synset information\nThe following API allows you to query the rich information in a BabelNet synset (Chinese and English synonyms, definitions, picture urls, etc.).\n\n```python\n\u003e\u003e\u003e syn_list = hownet_dict_advanced.get_synset('黄色')\n\u003e\u003e\u003e print(\"{} results are retrieved and take the first one as an example\".format(len(syn_list)))\n3 results are retrieved and take the first one as an example\n\n\u003e\u003e\u003e syn_example = syn_list[0]\n\u003e\u003e\u003e print(\"Synset: {}\".format(syn_example))\nSynset: bn:00113968a|yellow|黄\n\n\u003e\u003e\u003e print(\"English synonyms: {}\".format(syn_example.en_synonyms))\nEnglish synonyms: ['yellow', 'yellowish', 'xanthous']\n\n\u003e\u003e\u003e print(\"Chinese synonyms: {}\".format(syn_example.zh_synonyms))\nChinese synonyms: ['黄', '黄色', '淡黄色+的', '黄色+的', '微黄色', '微黄色+的', '黄+的', '淡黄色']\n\n\u003e\u003e\u003e print(\"English glosses: {}\".format(syn_example.en_glosses))\nEnglish glosses: ['Of the color intermediate between green and orange in the color spectrum; of something resembling the color of an egg yolk', 'Having the colour of a yolk, a lemon or gold.']\n\n\u003e\u003e\u003e print(\"Chinese glosses: {}\".format(syn_example.zh_glosses))\nChinese glosses: ['像丝瓜花或向日葵花的颜色。']\n```\n\n##### BabelNet synset relations\nYou can get the related BabelNet synsets with a given synset.\n\n```python\n\u003e\u003e\u003e related_synsets = syn_example.get_related_synsets()\n\u003e\u003e\u003eprint(\"There are {} synsets that have relation with the {}, they are: \".format(len(related_synsets), syn_example))\nThere are 6 synsets that have relation with the bn:00113968a|yellow|黄, they are: \n\n\u003e\u003e\u003eprint(related_synsets)\n[bn:00099663a|chromatic|彩色, bn:00029925n|egg_yolk|蛋黄, bn:00092876v|resemble|相似, bn:00020726n|color|颜色, bn:00020748n|visible_spectrum|可见光, bn:00081866n|yellow|黄色]\n```\n\n##### Get sememe annotations of a BabelNet synset\nYou can get the sememes of BabelNet synsets by inputting the word in the BabelNet synsets:\n\n```python\n\u003e\u003e\u003e print(hownet_dict_advanced.get_sememes_by_word_in_BabelNet('黄色'))\n[{'synset': bn:00113968a|yellow|黄, 'sememes': [yellow|黄]}, {'synset': bn:00101430a|dirty|淫秽的, 'sememes': [lascivious|淫, dirty|龊, despicable|卑劣, BadSocial|坏风气]}, {'synset': bn:00081866n|yellow|黄色, 'sememes': [yellow|黄]}]\n\n\u003e\u003e\u003e print(hownet_dict_advanced.get_sememes_by_word_in_BabelNet('黄色',merge=True))\n[lascivious|淫, despicable|卑劣, BadSocial|坏风气, dirty|龊, yellow|黄]\n```\n\nFor more detailed instructions, please refer to the [documentation](https://openhownet.readthedocs.io/).\n\n## Citation\n\nIf the code or data help you, please cite the following paper:\n\n```\n@article{qi2019openhownet,\n  title={Openhownet: An open sememe-based lexical knowledge base},\n  author={Qi, Fanchao and Yang, Chenghao and Liu, Zhiyuan and Dong, Qiang and Sun, Maosong and Dong, Zhendong},\n  journal={arXiv preprint arXiv:1901.09957},\n  year={2019}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunlp%2Fopenhownet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthunlp%2Fopenhownet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunlp%2Fopenhownet/lists"}