Git Product home page Git Product logo

nlg-metrics's Introduction

衡量生成文本质量的方法集

快速开始

把待检测文件整理成如下格式:

[
  {"ref": str, "hyps": [str, str, ...]},
  {...},
  ...
]

命令行方法

查看用法

python run.py -h

或者查看run.sh的例子

python run.py --input=input_path --output=output_path --metrics="['rouge-1', 'bleu', 'self-bleu']"

当前支持的方法有rouge-l, rouge-2, rouge-l, bleu, self-bleu, meteor, ppl

其中,如果选择ppl,则需要增加命令行参数--ppl_model_path=model_path,这个path为模型文件(bert模型)

如果第一次使用meteor,需要去nltk 下载带中文的wordnet数据 Open Multilingual Wordnet (omw) 以及 wordnet ,放入/root/nltk_data/corpora/中解压

python调用

from metrics import Metrics

inputs = json.load(...)

model = Metrics(metrics=["bleu", "rouge-l", "ppl"], path=...)
results = model.calc(inputs=inputs)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.