zoukankan      html  css  js  c++  java
  • 实验二

    1.tagger-master中的loader.py实现从文件中加载词向量。

    pretrained = set([#关注的是这里,打开词嵌入文件。
    line.rstrip().split()[0].strip()
    for line in codecs.open(ext_emb_path, 'r', 'utf-8')
    if len(ext_emb_path) > 0
    ])

     2.Tagger-master如何处理evaluate中写入文件,显示精度、召回率、F1值等:

    y_preds = f_eval(*input).argmax(axis=1)
    predictions.append(new_line)
    with codecs.open(output_path, 'w', 'utf8') as f:
            f.write("
    ".join(predictions))

    写入的score文件内容:

    processed 121289 tokens with 9809 phrases; found: 9505 phrases; correct: 8296.
    accuracy:  96.92%; precision:  87.28%; recall:  84.58%; FB1:  85.91
             Chemical: precision:  91.75%; recall:  87.95%; FB1:  89.81  5162
              Disease: precision:  81.97%; recall:  80.47%; FB1:  81.21  4343

    再从文件中读取并返回:

    eval_lines = [l.rstrip() for l in codecs.open(scores_path, 'r', 'utf8')]
    # F1 on all entities
    return float(eval_lines[1].strip().split()[-1])

    3.Att-NER如何处理evaluate中写入文件,显示精度、召回率、F1值等:

    y_preds = f_eval(*input).argmax(axis=1)
    predictions.append(new_line)
    #write to file 
    with codecs.open(filename, 'w', 'utf8') as f:
        f.write("
    ".join(predictions))
    #读取
    return get_perf(filename)
  • 相关阅读:
    Vue 监听子组件事件
    延时队列
    AES加密
    centos7.9 iftop 工具源码安装
    angular pass get paragrams by router
    Android chrome console in PC
    powershell 运行带路径的exe
    win下 nrm ls报错
    windows10 安装 node 16 解决node-sass node-gyp报错
    位图和布隆过滤器
  • 原文地址:https://www.cnblogs.com/BlueBlueSea/p/10732083.html
Copyright © 2011-2022 走看看