Spaces:
Running
Running
update
Browse files- text_analysis.py +6 -1
text_analysis.py
CHANGED
|
@@ -1,7 +1,12 @@
|
|
| 1 |
import spacy
|
| 2 |
from collections import Counter
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def analyze_text(text):
|
| 7 |
doc = nlp(text)
|
|
|
|
| 1 |
import spacy
|
| 2 |
from collections import Counter
|
| 3 |
|
| 4 |
+
try:
|
| 5 |
+
nlp = spacy.load("ru_core_news_lg")
|
| 6 |
+
except OSError:
|
| 7 |
+
import spacy.cli
|
| 8 |
+
spacy.cli.download("ru_core_news_lg")
|
| 9 |
+
nlp = spacy.load("ru_core_news_lg")
|
| 10 |
|
| 11 |
def analyze_text(text):
|
| 12 |
doc = nlp(text)
|