rbughao commited on
Commit
41ba0d5
1 Parent(s): bf9ae17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
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
- response = urllib.request.urlopen(message)
21
- html = response.read().decode('utf8')
22
- cleantext = BeautifulSoup(html).text
23
- #cleantext = BeautifulSoup(html,'lxml').text
24
- text = re.sub(CLEANR,'', cleantext)
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