Spaces:
Running
Running
jaifar530
commited on
if word.isalpha()
Browse files
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')])
|