kill me
This commit is contained in:
parent
378aca4b0e
commit
6db0081fab
3 changed files with 14 additions and 13 deletions
|
@ -26,16 +26,6 @@ def load_memory():
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# If MEMORY_LOADED_FILE does not exist, load default data and mark as loaded
|
|
||||||
if not os.path.exists(MEMORY_LOADED_FILE):
|
|
||||||
try:
|
|
||||||
with open(DEFAULT_DATASET_FILE, "r") as f:
|
|
||||||
default_data = json.load(f)
|
|
||||||
data.extend(default_data)
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
with open(MEMORY_LOADED_FILE, "w") as f:
|
|
||||||
f.write("Data loaded")
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
# Save memory data to MEMORY_FILE
|
# Save memory data to MEMORY_FILE
|
||||||
|
|
|
@ -8,6 +8,7 @@ import sysconfig
|
||||||
import ast
|
import ast
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
from spacy.util import is_package
|
||||||
import importlib.metadata
|
import importlib.metadata
|
||||||
|
|
||||||
# import shutil
|
# import shutil
|
||||||
|
@ -19,6 +20,13 @@ except ImportError:
|
||||||
psutilavaliable = False
|
psutilavaliable = False
|
||||||
print(RED, _('missing_requests_psutil'), RESET)
|
print(RED, _('missing_requests_psutil'), RESET)
|
||||||
|
|
||||||
|
def check_for_model():
|
||||||
|
if is_package("en_core_web_sm"):
|
||||||
|
print("Model is installed.")
|
||||||
|
else:
|
||||||
|
print("Model is not installed.")
|
||||||
|
|
||||||
|
|
||||||
def iscloned():
|
def iscloned():
|
||||||
if os.path.exists(".git"):
|
if os.path.exists(".git"):
|
||||||
return True
|
return True
|
||||||
|
@ -260,6 +268,7 @@ def start_checks():
|
||||||
print(f"{YELLOW}{(_('checks_disabled'))}{RESET}")
|
print(f"{YELLOW}{(_('checks_disabled'))}{RESET}")
|
||||||
return
|
return
|
||||||
print(_('running_prestart_checks'))
|
print(_('running_prestart_checks'))
|
||||||
|
check_for_model()
|
||||||
iscloned()
|
iscloned()
|
||||||
check_missing_translations()
|
check_missing_translations()
|
||||||
check_requirements()
|
check_requirements()
|
||||||
|
|
|
@ -5,9 +5,7 @@ from modules.volta.main import _
|
||||||
import spacy
|
import spacy
|
||||||
from spacy.tokens import Doc
|
from spacy.tokens import Doc
|
||||||
from spacytextblob.spacytextblob import SpacyTextBlob
|
from spacytextblob.spacytextblob import SpacyTextBlob
|
||||||
nlp = spacy.load("en_core_web_sm")
|
|
||||||
nlp.add_pipe("spacytextblob")
|
|
||||||
Doc.set_extension("polarity", getter=lambda doc: doc._.blob.polarity)
|
|
||||||
|
|
||||||
def check_resources():
|
def check_resources():
|
||||||
try:
|
try:
|
||||||
|
@ -22,6 +20,10 @@ def check_resources():
|
||||||
|
|
||||||
check_resources()
|
check_resources()
|
||||||
|
|
||||||
|
nlp = spacy.load("en_core_web_sm")
|
||||||
|
nlp.add_pipe("spacytextblob")
|
||||||
|
Doc.set_extension("polarity", getter=lambda doc: doc._.blob.polarity)
|
||||||
|
|
||||||
def is_positive(sentence):
|
def is_positive(sentence):
|
||||||
doc = nlp(sentence)
|
doc = nlp(sentence)
|
||||||
sentiment_score = doc._.polarity # from spacytextblob
|
sentiment_score = doc._.polarity # from spacytextblob
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue