ALwrity + Wordpress + Wix + GSC integration
This commit is contained in:
@@ -91,7 +91,7 @@ class DependencyManager:
|
||||
return len(missing_packages) == 0, missing_packages
|
||||
|
||||
def setup_spacy_model(self) -> bool:
|
||||
"""Set up spaCy English model (production-optimized)."""
|
||||
"""Set up spaCy English model."""
|
||||
print("🧠 Setting up spaCy model...")
|
||||
|
||||
try:
|
||||
@@ -107,30 +107,42 @@ class DependencyManager:
|
||||
print(f"✅ spaCy model '{model_name}' is available")
|
||||
return True
|
||||
except OSError:
|
||||
print(f"⚠️ spaCy model '{model_name}' not found")
|
||||
print(" Skipping spaCy setup in production mode")
|
||||
return True # Don't fail for missing spaCy in production
|
||||
# Model not found - try to download it
|
||||
print(f"⚠️ spaCy model '{model_name}' not found, downloading...")
|
||||
try:
|
||||
subprocess.check_call([
|
||||
sys.executable, "-m", "spacy", "download", model_name
|
||||
])
|
||||
print(f"✅ spaCy model '{model_name}' downloaded successfully")
|
||||
return True
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"❌ Failed to download spaCy model: {e}")
|
||||
print(" Please download manually with: python -m spacy download en_core_web_sm")
|
||||
return False
|
||||
|
||||
except ImportError:
|
||||
print("⚠️ spaCy not installed - skipping model setup")
|
||||
return True # Don't fail for missing spaCy
|
||||
return True # Don't fail for missing spaCy package
|
||||
|
||||
return True
|
||||
|
||||
def setup_nltk_data(self) -> bool:
|
||||
"""Set up NLTK data (production-optimized)."""
|
||||
"""Set up NLTK data."""
|
||||
print("📚 Setting up NLTK data...")
|
||||
|
||||
try:
|
||||
import nltk
|
||||
|
||||
# Only download essential data
|
||||
essential_data = ['punkt', 'stopwords']
|
||||
# Essential NLTK data packages
|
||||
essential_data = [
|
||||
('punkt_tab', 'tokenizers/punkt_tab'), # Updated tokenizer
|
||||
('stopwords', 'corpora/stopwords'),
|
||||
('averaged_perceptron_tagger', 'taggers/averaged_perceptron_tagger')
|
||||
]
|
||||
|
||||
for data_package in essential_data:
|
||||
for data_package, path in essential_data:
|
||||
try:
|
||||
nltk.data.find(f'tokenizers/{data_package}' if data_package == 'punkt'
|
||||
else f'corpora/{data_package}')
|
||||
nltk.data.find(path)
|
||||
print(f" ✅ {data_package}")
|
||||
except LookupError:
|
||||
print(f" ⚠️ {data_package} - downloading...")
|
||||
@@ -139,12 +151,19 @@ class DependencyManager:
|
||||
print(f" ✅ {data_package} downloaded")
|
||||
except Exception as e:
|
||||
print(f" ⚠️ {data_package} download failed: {e}")
|
||||
# Try fallback for punkt_tab -> punkt
|
||||
if data_package == 'punkt_tab':
|
||||
try:
|
||||
nltk.download('punkt', quiet=True)
|
||||
print(f" ✅ punkt (fallback) downloaded")
|
||||
except:
|
||||
pass
|
||||
|
||||
print("✅ NLTK data setup complete")
|
||||
return True
|
||||
|
||||
except ImportError:
|
||||
print("⚠️ NLTK not installed - skipping data setup")
|
||||
return True # Don't fail for missing NLTK
|
||||
return True # Don't fail for missing NLTK package
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user