pathwise.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:watlink 作者: dustalov 项目源码 文件源码
def isas(path):
    G = nx.DiGraph()

    with open(path, newline='') as f:
        reader = csv.reader(f, delimiter='\t')

        for row in reader:
            if len(row) > 1 and row[0] and row[1]:
                G.add_edge(sanitize(row[0]), sanitize(row[1]))

    # Note that we store the sense inventory as an attribute of G.
    # TODO: nx.DiGraph subclass?
    G.senses = defaultdict(list)

    for node in G.nodes():
        G.senses[node.rsplit('#', 1)[0]].append(node)

    return G
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号