Skip to content

Commit

Permalink
Code styling in yake_keywords.py. and change `if language == 'zh-CN' …
Browse files Browse the repository at this point in the history
…or language == 'zh' or language == 'zh-TW'` to `if language[:2]=="zh"`
  • Loading branch information
ahmednasserswe committed Sep 26, 2024
1 parent 6da8a98 commit 923d43d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/model/yake_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def normalize_special_characters(self, text):

def run_chinese_segmentation_with_jieba(self, text):
return " ".join(list(jieba.cut_for_search(text)))

def run_yake(self, text: str,
language: str,
max_ngram_size: int,
Expand All @@ -62,7 +63,7 @@ def run_yake(self, text: str,
### normalize special characters
text = self.normalize_special_characters(text)
# Segmentation for mandarin
if language == 'zh-CN' or language == 'zh' or language == 'zh-TW':
if language[:2]=="zh":
text = self.run_chinese_segmentation_with_jieba(text)
# text = " ".join(list(jieba.cut_for_search(text)))
### extract keywords
Expand Down

0 comments on commit 923d43d

Please sign in to comment.