Spaces:
Sleeping
Sleeping
Daryl Fung
commited on
Commit
·
0b8e9c2
1
Parent(s):
f1a4ffa
remove one more index for ending character for keyphrase
Browse files- app.py +1 -0
- keyphrase_extraction.py +1 -1
app.py
CHANGED
@@ -14,6 +14,7 @@ from word import show_gram_plot
|
|
14 |
|
15 |
nlp = spacy.load("en_core_web_sm")
|
16 |
|
|
|
17 |
def greet(name, descriptions):
|
18 |
os.makedirs(f'results/{name}', exist_ok=True)
|
19 |
outputs = []
|
|
|
14 |
|
15 |
nlp = spacy.load("en_core_web_sm")
|
16 |
|
17 |
+
|
18 |
def greet(name, descriptions):
|
19 |
os.makedirs(f'results/{name}', exist_ok=True)
|
20 |
outputs = []
|
keyphrase_extraction.py
CHANGED
@@ -42,7 +42,7 @@ def get_top_key_phrases(text, top_n, save_output):
|
|
42 |
|
43 |
def display_key_phrases(text, save_output):
|
44 |
doc = nlp(text)
|
45 |
-
key_phrases = [{'start': chunk.start_char, 'end': chunk.end_char, 'label': str(round(phrase.rank, 2))} for phrase in doc._.phrases for chunk in phrase.chunks]
|
46 |
|
47 |
# generate displacy html #
|
48 |
max_rank = float(key_phrases[0]['label'])
|
|
|
42 |
|
43 |
def display_key_phrases(text, save_output):
|
44 |
doc = nlp(text)
|
45 |
+
key_phrases = [{'start': chunk.start_char, 'end': chunk.end_char-1, 'label': str(round(phrase.rank, 2))} for phrase in doc._.phrases for chunk in phrase.chunks]
|
46 |
|
47 |
# generate displacy html #
|
48 |
max_rank = float(key_phrases[0]['label'])
|