Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,14 +16,13 @@ The following links are the detailed references:
|
|
16 |
4. https://en.wikipedia.org/wiki/Dale%E2%80%93Chall_readability_formula
|
17 |
"""
|
18 |
|
19 |
-
def measure_readability(message,history):
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
vline1 = "==== Content Info ==== " + os.linesep
|
28 |
vline2 = "Character Count "+str(textstat.char_count(text, ignore_spaces=True)) + os.linesep
|
29 |
vline3 = "Lexicon Count "+str(textstat.lexicon_count(text, removepunct=True)) + os.linesep
|
|
|
16 |
4. https://en.wikipedia.org/wiki/Dale%E2%80%93Chall_readability_formula
|
17 |
"""
|
18 |
|
19 |
+
def measure_readability(message,history):
|
20 |
+
if "https://" in message:
|
21 |
+
response = urllib.request.urlopen(message)
|
22 |
+
html = response.read().decode('utf8')
|
23 |
+
cleantext = BeautifulSoup(html).text
|
24 |
+
#cleantext = BeautifulSoup(html,'lxml').text
|
25 |
+
text = re.sub(CLEANR,'', cleantext)
|
|
|
26 |
vline1 = "==== Content Info ==== " + os.linesep
|
27 |
vline2 = "Character Count "+str(textstat.char_count(text, ignore_spaces=True)) + os.linesep
|
28 |
vline3 = "Lexicon Count "+str(textstat.lexicon_count(text, removepunct=True)) + os.linesep
|