sinatools.synonyms.synonyms_generator¶
-
sinatools.synonyms.synonyms_generator.
extend_synonyms
(synset, level)¶ This method receives a set of one or more synonyms and a level number, then extends this set with additional synonyms. The more synonyms in the input, the more accurate in the results. Each synonym in the output is assigned a fuzzy value to indicate how much it is likely to be a synonymy. You can try the demo online. Read the article for more details.
- Parameters
- Returns
- A list of lists, where each list could be contains:
-
- synonym: Synonym related to the given synset (set of synonyms).
- fuzzy_value: The synonyms strength as a percentage out of 100.
- Return type
list (
list
)
Example:
from sinatools.synonyms.synonyms_generator import extend_synonyms extend_synonyms('ممر | طريق',2) [["مَسْلَك","61%"],["سبيل","61%"],["وَجْه","30%"],["نَهْج", "30%"],["نَمَطٌ","30%"],["مِنْهَج","30%"],["مِنهاج", "30%"],["مَوْر","30%"],["مَسَار","30%"],["مَرصَد", "30%"],["مَذْهَبٌ","30%"],["مَدْرَج","30%"],["مَجَاز","30%"]]
Note
The models should be installed using (download_files -f synonyms) command.
-
sinatools.synonyms.synonyms_generator.
evaluate_synonyms
(synset, level)¶ This method receives a set of synonyms and a level number, then evaluates how much each of these input synonyms is really a synonym (i.e., how much it belongs to the set). You can try the demo online.
- Parameters
- Returns
- A list of lists, where each list could be contains:
-
- synonym: The input synonym.
- fuzzy_value: The synonyms strength as a percentage out of 100.
- Return type
list (
list
)
Example:
from sinatools.synonyms.synonyms_generator import evaluate_synonyms evaluate_synonyms('ممر | طريق | مَسْلَك | سبيل') [["مَسْلَك","61%"],["سبيل","60%"],["طريق","40%"],["ممر", "40%"]]