• 实践生成热词词云。
  • 绘制热词关系图。
 
import networkx as nx

def draw_word_relationship(words):
    G = nx.Graph()
    for word, freq in words.items():
        G.add_node(word)
        G.add_edge(word, "信息领域", weight=freq)
    
    pos = nx.spring_layout(G)
    nx.draw(G, pos, with_labels=True, node_color='lightblue', edge_color='gray')
    plt.show()

draw_word_relationship(words)