Giter Site home page Giter Site logo

prosody_prediction's Introduction

Prosody Prediction

韵律预测模型:给定一个句子,输出停顿的位置。

例子:

今天天气真好
PW(韵律词) ['今天', '天气', '真好']
PPH(韵律短语) ['今天', '天气真好']
IPH(语调短语) ['今天天气真好']

Note : all scripts must be run in prosody_prediction.

Requirements

推荐使用虚拟环境。

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

Quickstart

  1. 下载预训练模型

链接: https://pan.baidu.com/s/1YWH65bM-NGZYOAoK8C3rBQ 密码: 6r1w

  1. 运行交互式命令行进行测试
python demo.py

API

  1. 指定模型进行预测, 参考demo.py
net1 = ProsodyNet(args.model_dir, 'pw')
words, pos = tokenize(text)
tags = net.inference(words, pos)
  1. 使用wrapper.py同时预测韵律词,韵律短语,语调短语边界。只能用于预训练标贝数据集。
    • model_dir: 预训练模型路径,例如pretrained/biaobei
from core.inference.wrapper import ProsodyPred
prosody_pred = ProsodyPred(model_dir)
(pws, pphs, iphs), words = self.prosody_pred.predict(text)

Training

实验记录

如果你要自己训练,评测模型,构建数据集,请查看 training-guide.md

FAQ

  1. 运行交互式命令行进行测试时遇到:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 0: invalid continuation byte

解决方法(暂时): 这个错误通常发生在输入文字后又删除, 重启保证一次输对。

TODO

See todo.md

Reference

See ref.md

prosody_prediction's People

Contributors

zeqiang-lai avatar

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.