ALwrity + Wordpress + Wix + GSC integration

This commit is contained in:
ajaysi
2025-10-08 10:13:14 +05:30
parent 14dfb2e5c0
commit 3bab3450dc
147 changed files with 19815 additions and 17053 deletions

View File

@@ -13,28 +13,35 @@ from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
from nltk.tag import pos_tag
from textstat import flesch_reading_ease, flesch_kincaid_grade
import spacy
class EnhancedLinguisticAnalyzer:
"""Advanced linguistic analysis for persona creation and improvement."""
def __init__(self):
"""Initialize the linguistic analyzer."""
"""Initialize the linguistic analyzer with required spaCy dependency."""
self.nlp = None
self.spacy_available = False
# spaCy is REQUIRED for high-quality persona generation
try:
# Try to load spaCy model
import spacy
self.nlp = spacy.load("en_core_web_sm")
except OSError:
logger.warning("spaCy model not found. Install with: python -m spacy download en_core_web_sm")
self.spacy_available = True
logger.info("SUCCESS: spaCy model loaded successfully - Enhanced linguistic analysis available")
except ImportError as e:
logger.error(f"ERROR: spaCy is REQUIRED for persona generation. Install with: pip install spacy && python -m spacy download en_core_web_sm")
raise ImportError("spaCy is required for enhanced persona generation. Install with: pip install spacy && python -m spacy download en_core_web_sm") from e
except OSError as e:
logger.error(f"ERROR: spaCy model 'en_core_web_sm' is REQUIRED. Download with: python -m spacy download en_core_web_sm")
raise OSError("spaCy model 'en_core_web_sm' is required. Download with: python -m spacy download en_core_web_sm") from e
# Download required NLTK data
try:
nltk.data.find('tokenizers/punkt')
nltk.data.find('tokenizers/punkt_tab') # Updated for newer NLTK versions
nltk.data.find('corpora/stopwords')
nltk.data.find('taggers/averaged_perceptron_tagger')
except LookupError:
logger.warning("NLTK data not found. Downloading required data...")
nltk.download('punkt', quiet=True)
nltk.download('punkt_tab', quiet=True) # Updated for newer NLTK versions
nltk.download('stopwords', quiet=True)
nltk.download('averaged_perceptron_tagger', quiet=True)
@@ -625,5 +632,4 @@ class EnhancedLinguisticAnalyzer:
clauses = len(re.findall(r'[,;]', sentence)) + 1
total_clauses += clauses
return total_clauses / len(sentences) if sentences else 0
a
return total_clauses / len(sentences) if sentences else 0