gpt4 book ai didi

python - 我应该使用什么数据结构进行情绪分析?

转载 作者:行者123 更新时间:2023-11-28 22:52:13 25 4
gpt4 key购买 nike

我正在尝试制作 Bayesian Belief Network ,这样我就可以用它来执行 Sentiment Analysis在文字上。我想知道我应该使用哪种数据结构在 Python 中对其进行编码?链接列表?有什么建议吗?

最佳答案

Guido 写了一个 essay关于使用字典在 Python 中实现图形。他给出了以下示例:

Few programming languages provide direct support for graphs as a datatype, and Python is no exception. However, graphs are easily built outof lists and dictionaries. For instance, here's a simple graph (Ican't use drawings in these columns, so I write down the graph'sarcs):

A -> B
A -> C
B -> C
B -> D
C -> D
D -> C
E -> F
F -> C

This graph has six nodes (A-F) and eight arcs. It can be represented by the following Python data structure:

graph = {'A': ['B', 'C'],
'B': ['C', 'D'],
'C': ['D'],
'D': ['C'],
'E': ['F'],
'F': ['C']}

关于python - 我应该使用什么数据结构进行情绪分析?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20701264/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com