Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,17 +6,16 @@
|
|
6 |
@author: Hamza Farooq
|
7 |
"""
|
8 |
|
9 |
-
|
10 |
-
from spacy.lang.en.stop_words import STOP_WORDS
|
11 |
from string import punctuation
|
12 |
from collections import Counter
|
13 |
from heapq import nlargest
|
14 |
import os
|
15 |
-
|
16 |
from sentence_transformers import SentenceTransformer, CrossEncoder, util
|
17 |
import datetime
|
18 |
|
19 |
-
|
20 |
import streamlit as st
|
21 |
import matplotlib.pyplot as plt
|
22 |
from wordcloud import WordCloud
|
@@ -180,18 +179,18 @@ def main():
|
|
180 |
for token in text.lower().split():
|
181 |
token = token.strip(string.punctuation)
|
182 |
|
183 |
-
if len(token) > 0
|
184 |
tokenized_doc.append(token)
|
185 |
return tokenized_doc
|
186 |
|
187 |
|
188 |
def search(query):
|
189 |
# q = [str(userinput)]
|
190 |
-
doc = nlp(str(userinput))
|
191 |
|
192 |
-
ent_html = displacy.render(doc, style="ent", jupyter=False)
|
193 |
# Display the entity visualization in the browser:
|
194 |
-
st.markdown(
|
195 |
##### BM25 search (lexical search) #####
|
196 |
bm25_scores = bm25.get_scores(bm25_tokenizer(query))
|
197 |
top_n = np.argpartition(bm25_scores, -5)[-5:]
|
|
|
6 |
@author: Hamza Farooq
|
7 |
"""
|
8 |
|
9 |
+
|
|
|
10 |
from string import punctuation
|
11 |
from collections import Counter
|
12 |
from heapq import nlargest
|
13 |
import os
|
14 |
+
|
15 |
from sentence_transformers import SentenceTransformer, CrossEncoder, util
|
16 |
import datetime
|
17 |
|
18 |
+
|
19 |
import streamlit as st
|
20 |
import matplotlib.pyplot as plt
|
21 |
from wordcloud import WordCloud
|
|
|
179 |
for token in text.lower().split():
|
180 |
token = token.strip(string.punctuation)
|
181 |
|
182 |
+
if len(token) > 0:
|
183 |
tokenized_doc.append(token)
|
184 |
return tokenized_doc
|
185 |
|
186 |
|
187 |
def search(query):
|
188 |
# q = [str(userinput)]
|
189 |
+
# doc = nlp(str(userinput))
|
190 |
|
191 |
+
# ent_html = displacy.render(doc, style="ent", jupyter=False)
|
192 |
# Display the entity visualization in the browser:
|
193 |
+
st.markdown(query, unsafe_allow_html=True)
|
194 |
##### BM25 search (lexical search) #####
|
195 |
bm25_scores = bm25.get_scores(bm25_tokenizer(query))
|
196 |
top_n = np.argpartition(bm25_scores, -5)[-5:]
|