← 返回首页
状态:已完成

【Python 代码】构建情感图谱节点类,包含语义属性(如情感类型、强度、实体名称)的初始化与存储结构

class EmotionNode: def __init__(self, emotion_type: str, intensity: float, entity_name: str): self.emotion_type = emotion_type self.intensity = intensity self.entity_name = entity_name def get_attributes(self): return { "emotion_type": self.emotion_type, "intensity": self.intensity, "entity_name": self.entity_name }