上传者: 38621630 
                                    |
                                    上传时间: 2022-11-22 20:46:45
                                    |
                                    文件大小: 77KB
                                    |
                                    文件类型: PDF
                                
                            
                                
                            
                                networkx
书中代码实现
书中p165,networkx和matplotlib结合使用可视化wordnet的网络结构(语义网络)
import networkx as nx
import matplotlib
from nltk.corpus import wordnet as wn
def traverse(graph, start, node):
    graph.depth[node.name] = node.shortest_path_distance(start)
    for child in node.hyponyms():
        graph.add_edge