forked from gooberinc/goober
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:
|
||||
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
|
||||
|
||||
# Save memory data to MEMORY_FILE
|
||||
|
|
|
@ -8,6 +8,7 @@ import sysconfig
|
|||
import ast
|
||||
import json
|
||||
import re
|
||||
from spacy.util import is_package
|
||||
import importlib.metadata
|
||||
|
||||
# import shutil
|
||||
|
@ -19,6 +20,13 @@ except ImportError:
|
|||
psutilavaliable = False
|
||||
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():
|
||||
if os.path.exists(".git"):
|
||||
return True
|
||||
|
@ -260,6 +268,7 @@ def start_checks():
|
|||
print(f"{YELLOW}{(_('checks_disabled'))}{RESET}")
|
||||
return
|
||||
print(_('running_prestart_checks'))
|
||||
check_for_model()
|
||||
iscloned()
|
||||
check_missing_translations()
|
||||
check_requirements()
|
||||
|
|
|
@ -5,9 +5,7 @@ from modules.volta.main import _
|
|||
import spacy
|
||||
from spacy.tokens import Doc
|
||||
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():
|
||||
try:
|
||||
|
@ -22,6 +20,10 @@ def 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):
|
||||
doc = nlp(sentence)
|
||||
sentiment_score = doc._.polarity # from spacytextblob
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue