add segment with keyword issue (#3351)

Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
Jyong 2024-04-11 16:57:02 +08:00 • committed by GitHub
commit 1f302990c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 89 additions and 80 deletions

View file

@ -48,6 +48,9 @@ class Jieba(BaseKeyword):
text = texts[i]
if keywords_list:
keywords = keywords_list[i]
if not keywords:
keywords = keyword_table_handler.extract_keywords(text.page_content,
self._config.max_keywords_per_chunk)
else:
keywords = keyword_table_handler.extract_keywords(text.page_content, self._config.max_keywords_per_chunk)
self._update_segment_keywords(self.dataset.id, text.metadata['doc_id'], list(keywords))