jaifar530 commited on
Commit
2d4b661
·
unverified ·
1 Parent(s): 10b1af0

if word.isalpha()

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -72,7 +72,7 @@ def extract_features(text):
72
  words = word_tokenize(text)
73
  sentences = sent_tokenize(text)
74
 
75
- avg_word_length = sum(len(word) for word in words) / len(words)
76
  avg_sent_length = sum(len(sent) for sent in sentences) / len(sentences)
77
  punctuation_count = len([char for char in text if char in '.,;:?!'])
78
  stopword_count = len([word for word in words if word in stopwords.words('english')])
 
72
  words = word_tokenize(text)
73
  sentences = sent_tokenize(text)
74
 
75
+ avg_word_length = sum(len(word) for word in words if word.isalpha()) / len(words)
76
  avg_sent_length = sum(len(sent) for sent in sentences) / len(sentences)
77
  punctuation_count = len([char for char in text if char in '.,;:?!'])
78
  stopword_count = len([word for word in words if word in stopwords.words('english')])