songhai2022
commited on
Delete get_bert_keywords.py
Browse files- get_bert_keywords.py +0 -12
get_bert_keywords.py
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
# import data manipulation libraries
|
2 |
-
from nltk.corpus import stopwords
|
3 |
-
from keybert import KeyBERT
|
4 |
-
from collections import Counter
|
5 |
-
# KeyBERT model
|
6 |
-
keybert_model = KeyBERT(model='all-MiniLM-L6-v2')
|
7 |
-
|
8 |
-
def get_bert_keywords(text, num_keywords, ignorewords):
|
9 |
-
result = keybert_model.extract_keywords(text, keyphrase_ngram_range=(
|
10 |
-
1, 1), top_n=num_keywords, stop_words=stopwords.words('english')+ignorewords)
|
11 |
-
keyberts = [keyword for keyword, score in result]
|
12 |
-
return keyberts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|