hmnshudhmn24's picture
Upload 28 files
36e43c0 verified
raw
history blame contribute delete
620 Bytes
from .text_preprocessor import TextPreprocessor
from .emotion_classifier import EmotionClassifier
from .shift_detector import ShiftDetector
from .explanation_engine import ExplanationEngine
class EmotionShiftPipeline:
def __init__(self):
self.p = TextPreprocessor(); self.c = EmotionClassifier()
self.d = ShiftDetector(); self.e = ExplanationEngine()
def __call__(self, conv):
emotions = [self.c.classify(self.p.clean(t)) for t in conv]
shifts = self.d.detect(emotions)
return {'emotions': emotions, 'shifts': shifts, 'explanations': [self.e.explain(s) for s in shifts]}