

( list) a list contains sememe triples or a list contains relations. Set to False if you are not sure about the x and y. You can choose to search the sememe relation strictly by the word. You can choose to get the list of triples or just the list of the relations. Y ( str): the word #1 to search the sememe. X ( str): the word #0 to search the sememe. The function will search for the sememes by the words and get_sememe_relation ( x, y, return_triples = False, strict = True ) ¶ ( list) candidates HowNet sememes, if the target word does not exist, return an empty list. You can set to en or zh, which means search in English or Chinese strict ( bool): (The func will search both in English and Chinese, which will consume a lot of time.) you can specify the language of the target word to boost the search performance.īesides if you are not sure about the word, you can set strict to False to fuzzy match the sememe. get_sememe ( word, language = None, strict = True ) ¶ ( list) a list contains synset triples or contains synsets. Set to False if you are not sure about the x. You can choose to search the synset relation strictly by the word. You can choose to get the list of triples or just the list of the synsets. If the given word does not exist in HowNet annotations, this function will return an empty list. Get the topK nearest words of the given word, the word similarity is calculated based on HowNet annotation. get_nearest_words ( word, language = None, score = False, pos = None, merge = False, K = 10, strict = True ) ¶ ( list) All annotated English words in HowNet. Get all English words annotated in HowNet Returns: Return all the relations between synsets in BabelNet. ( list) a list of all senses get_all_synset_pos ( ) ¶ get_all_synset_relations ( ) ¶ Get the complete senses in HowNet Returns: Get all the pos of words in senses in HowNet. ( list) a list of all sememes get_all_sense_pos ( ) ¶ ( list) all the relations between sememes in HowNet. Get all the relations between sememes in HowNet. If the initialization method of word similarity calculation has not been called yet, it will also return 0.0 and print corresponding error message. If word0 or word1 does not exist in HowNet annotation, it will return -1

( float) the word similarity calculated via sememes. You can choose to search the sense strictly or not. Provides a convenient way to search information in HowNet,ĭisplay sememe trees, calculate word similarity via sememes, etc. HowNetDict ( init_sim = False, init_babel = False ) ¶ OpenHowNet.HowNetDict module ¶ HowNetDict Class ¶ class OpenHowNet.HowNetDict. get_resource ( path, mode = 'r', encoding = 'utf-8' ) ¶ Args: url (str):ĭownload url of resource file. download_file ( url, dest_file = None ) ¶ĭownload resources files from url to dest path. The HowNet resource file is openhownet_data.zip. OpenHowNet.Download module ¶ OpenHowNet.Download. Get the sememe list labeled to the synset. Return_triples( bool) : whether to return the triples or the synsets.

Relation( str) : set the relation between target synset and retrieved synsets. You can set the relation to get the synsets that have the exact relation with the synset. get_related_synsets ( relation = None, return_triples = False ) ¶ The related BabelSynsets and the corresponding relations.
