Update app.py
Browse files
app.py
CHANGED
@@ -82,7 +82,7 @@ def preprocess_plain_text(text, window_size=3):
|
|
82 |
text = re.sub(r"@\S+", " ", text) # mentions
|
83 |
text = re.sub(r"#\S+", " ", text) # hastags
|
84 |
text = re.sub(r"\s{2,}", " ", text) # over spaces
|
85 |
-
|
86 |
|
87 |
# break into lines and remove leading and trailing space on each
|
88 |
lines = [line.strip() for line in text.splitlines()]
|
@@ -217,7 +217,7 @@ def clear_search_text():
|
|
217 |
|
218 |
|
219 |
url_text = st.text_input("Please Enter a url here",
|
220 |
-
value="https://
|
221 |
key='text_url', on_change=clear_search_text)
|
222 |
|
223 |
st.markdown(
|
@@ -228,7 +228,7 @@ st.markdown(
|
|
228 |
upload_doc = st.file_uploader("Upload a .txt, .pdf, .docx file", key="upload")
|
229 |
|
230 |
search_query = st.text_input("Please Enter your search query here",
|
231 |
-
value="
|
232 |
|
233 |
if validators.url(url_text):
|
234 |
# if input is URL
|
|
|
82 |
text = re.sub(r"@\S+", " ", text) # mentions
|
83 |
text = re.sub(r"#\S+", " ", text) # hastags
|
84 |
text = re.sub(r"\s{2,}", " ", text) # over spaces
|
85 |
+
text = re.sub("[^.,!?%$A-Za-z0-9]+", " ", text) # special characters except .,!?
|
86 |
|
87 |
# break into lines and remove leading and trailing space on each
|
88 |
lines = [line.strip() for line in text.splitlines()]
|
|
|
217 |
|
218 |
|
219 |
url_text = st.text_input("Please Enter a url here",
|
220 |
+
value="https://en.wikipedia.org/wiki/Virat_Kohli",
|
221 |
key='text_url', on_change=clear_search_text)
|
222 |
|
223 |
st.markdown(
|
|
|
228 |
upload_doc = st.file_uploader("Upload a .txt, .pdf, .docx file", key="upload")
|
229 |
|
230 |
search_query = st.text_input("Please Enter your search query here",
|
231 |
+
value="Who is Virat Kohli?", key="text_input")
|
232 |
|
233 |
if validators.url(url_text):
|
234 |
# if input is URL
|