如何在python中存储和使用文本文件中的数据进行情绪分析?

如何在python中存储和使用文本文件中的数据进行情绪分析?,python,nltk,sentiment-analysis,lexical-analysis,Python,Nltk,Sentiment Analysis,Lexical Analysis,所以我正在写一个情感分析程序,在这个程序中,我将根据句子中使用的单词,总结文本文件中角色的情感。我将使用文本文件中的数据,该文件包含单词、情绪和情绪强度得分标题下的数据,如以下文件片段所示: adultery anger 0 adultery anticipation 0 adultery disgust 1 adultery fear 0 adultery joy 0 adultery negative 1 adultery positive

所以我正在写一个情感分析程序,在这个程序中,我将根据句子中使用的单词,总结文本文件中角色的情感。我将使用文本文件中的数据,该文件包含单词、情绪和情绪强度得分标题下的数据,如以下文件片段所示:

adultery   anger 0
adultery   anticipation     0
adultery   disgust  1
adultery   fear  0
adultery   joy  0
adultery   negative   1
adultery   positive   0
adultery   sadness  1
adultery   surprise   0
adultery   trust 0
dislike anger 1
dislike anticipation    0
dislike disgust 1
dislike fear  0
dislike joy  0
dislike negative   1
dislike positive   0
dislike sadness 0
dislike surprise   0
dislike trust 0
因此,如果我有一句话,比如:“人们不喜欢通奸”,我会为每种情绪生成一个情绪分数,如下所示:

anger = 1 ; anticipation = 0 ; disgust = 1; fear = 0; joy = 0 ; negative = 2 ; positive = 0 ; sadness = 1 ; surprise = 0 ; trust = 0.
目前,我正在考虑如何在python程序中存储情感数据。大约40万字。我在想,我可以使用字典将单词作为关键字存储,将情感和情感强度分数作为值存储在列表中,但我不确定这是否可行,因为我需要访问所有情感强度以及单词的分数。我愿意接受关于如何处理文本文件中的数据并将其存储到我的程序中的建议和想法