From f22f681992c753c69cd1360212368271e8daccf0 Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Fri, 21 May 2021 14:13:40 +0800 Subject: [PATCH] more docs (#636) --- doc/src/alignment.md | 21 ++++++++++++++++ doc/src/chinese_syllable.md | 21 +++++++++++++++- doc/src/decoding.md | 6 +++++ doc/src/tts_text_front_end.md | 47 +++++++++++++++++++++++++---------- doc/src/vad.md | 32 ++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 14 deletions(-) create mode 100644 doc/src/alignment.md create mode 100644 doc/src/decoding.md create mode 100644 doc/src/vad.md diff --git a/doc/src/alignment.md b/doc/src/alignment.md new file mode 100644 index 00000000..fa63894f --- /dev/null +++ b/doc/src/alignment.md @@ -0,0 +1,21 @@ +# Alignment + +我们首先从建模的角度理解一下对齐。语音识别任务,需要对输入音频序列 X = [x1,x2,x3...,xt...,xT] (通常是 fbank 或 mfcc 等音频特征)和输出的标注数据文本序列 Y = [y1,y2,y3...,yu...,yU] 关系进行建模,其中 X 的长度一般大于 Y 的长度。如果能够知道yu和xt的对应关系,就可以将这类任务变成语音帧级别上的分类任务,即对每个时刻 xt 进行分类得到 yu。 + +## MFA + + + + + +## CTC Alignment + + + + + +## Reference + +* [ctc alignment](https://mp.weixin.qq.com/s/4aGehNN7PpIvCh03qTT5oA) +* [时间戳和N-Best](https://mp.weixin.qq.com/s?__biz=MzU2NjUwMTgxOQ==&mid=2247483956&idx=1&sn=80ce595238d84155d50f08c0d52267d3&chksm=fcaacae0cbdd43f62b1da60c8e8671a9e0bb2aeee94f58751839b03a1c45b9a3889b96705080&scene=21#wechat_redirect) + diff --git a/doc/src/chinese_syllable.md b/doc/src/chinese_syllable.md index 676ecb53..b7fd9322 100644 --- a/doc/src/chinese_syllable.md +++ b/doc/src/chinese_syllable.md @@ -48,4 +48,23 @@ ## Zhuyin * [Bopomofo](https://en.wikipedia.org/wiki/Bopomofo) -* [Zhuyin table](https://en.wikipedia.org/wiki/Zhuyin_table) \ No newline at end of file +* [Zhuyin table](https://en.wikipedia.org/wiki/Zhuyin_table) + + + +## Tone sandhi + +* https://zh.wikipedia.org/wiki/%E8%AE%8A%E8%AA%BF + +* https://github.com/mozillazg/python-pinyin/issues/133 + + pypinyin关于变调错误的评估 + + + +## tools + +* https://github.com/KuangDD/phkit +* https://github.com/mozillazg/python-pinyin +* https://github.com/Kyubyong/g2pC +* https://github.com/kakaobrain/g2pM \ No newline at end of file diff --git a/doc/src/decoding.md b/doc/src/decoding.md new file mode 100644 index 00000000..ade06c4c --- /dev/null +++ b/doc/src/decoding.md @@ -0,0 +1,6 @@ +# Decoding + +## Reference + +* [时间戳和N-Best](https://mp.weixin.qq.com/s?__biz=MzU2NjUwMTgxOQ==&mid=2247483956&idx=1&sn=80ce595238d84155d50f08c0d52267d3&chksm=fcaacae0cbdd43f62b1da60c8e8671a9e0bb2aeee94f58751839b03a1c45b9a3889b96705080&scene=21#wechat_redirect) + diff --git a/doc/src/tts_text_front_end.md b/doc/src/tts_text_front_end.md index 6eb9ae5d..fe0f7e24 100644 --- a/doc/src/tts_text_front_end.md +++ b/doc/src/tts_text_front_end.md @@ -46,11 +46,18 @@ stopwords(["zh"]) # Chinese 文本正则化 文本正则化主要是讲非标准词(NSW)进行转化,比如: -数字、电话号码: 10086 -> 一千零八十六/幺零零八六 -时间,比分: 23:20 -> 二十三点二十分/二十三比二十 -分数、小数、百分比: 3/4 -> 四分之三,3.24 -> 三点一四, 15% -> 百分之十五 -符号、单位: ¥ -> 元, kg -> 千克 -网址、文件后缀: www. -> 三W点 +1. 数字、电话号码: 10086 -> 一千零八十六/幺零零八六 +2. 时间,比分: 23:20 -> 二十三点二十分/二十三比二十 +3. 分数、小数、百分比: 3/4 -> 四分之三,3.24 -> 三点一四, 15% -> 百分之十五 +4. 符号、单位: ¥ -> 元, kg -> 千克 +5. 网址、文件后缀: www. -> 三W点 + +其他转换: + +1. 简体和繁体转换:中国语言 -> 中國語言 +2. 半角和全角准换:, -> , + +### tools * https://github.com/google/re2 @@ -64,13 +71,16 @@ stopwords(["zh"]) # Chinese This is a ChiNese Text Normalization (CNTN) tool for Text-to-speech system, which is based on [sparrowhawk](https://github.com/google/sparrowhawk). +* [Simplified and Traditional Chinese Characters converter](https://github.com/berniey/hanziconv) +* [Halfwidth and Fullwidth](https://zh.wikipedia.org/wiki/%E5%85%A8%E5%BD%A2%E5%92%8C%E5%8D%8A%E5%BD%A2) + ## Word Segmentation(分词) 分词之所以重要可以通过这个例子来说明: -广州市长隆马戏欢迎你 -> 广州市 长隆 马戏 欢迎你 -如果没有分词错误会导致句意完全不正确:  +广州市长隆马戏欢迎你 -> 广州市 长隆 马戏 欢迎你 +如果没有分词错误会导致句意完全不正确: 广州 市长 隆马戏 欢迎你 分词常用方法分为最大前向匹配(基于字典)和基于CRF的分词方法。用CRF的方法相当于是把这个任务转换成了序列标注,相比于基于字典的方法好处是对于歧义或者未登录词有较强的识别能力,缺点是不能快速fix bug,并且性能略低于词典。 @@ -103,11 +113,14 @@ stopwords(["zh"]) # Chinese ## Part of Speech(词性预测) 词性解释 + +``` n/名词 np/人名 ns/地名 ni/机构名 nz/其它专名 m/数词 q/量词 mq/数量词 t/时间词 f/方位词 s/处所词 v/动词 a/形容词 d/副词 h/前接成分 k/后接成分 i/习语 j/简称 r/代词 c/连词 p/介词 u/助词 y/语气助词 e/叹词 o/拟声词 g/语素 w/标点 x/其它 +``` @@ -117,7 +130,10 @@ e/叹词 o/拟声词 g/语素 w/标点 x/其它 传统方法是使用字典,但是对于未登录词就很难解决。基于模型的方法是使用 [Phonetisaurus](https://github.com/AdolfVonKleist/Phonetisaurus)。 论文可以参考 - WFST-based Grapheme-to-Phoneme Conversion: Open Source Tools for Alignment, Model-Building and Decoding -当然这个问题也可以看做是序列标注用CRF或者基于神经网络的模型都可以做。 基于神经网络工具: [g2pM](https://github.com/kakaobrain/g2pM)。 +当然这个问题也可以看做是序列标注用CRF或者基于神经网络的模型都可以做。 基于神经网络工具: + +* https://github.com/kakaobrain/g2pM +* https://github.com/Kyubyong/g2p @@ -126,20 +142,23 @@ e/叹词 o/拟声词 g/语素 w/标点 x/其它 ToBI(an abbreviation of tones and break indices) is a set of conventions for transcribing and annotating the prosody of speech. 中文主要关注break。 - 韵律等级结构: -音素 -> 音节 -> 韵律词(Prosody Word, PW) -> 韵律短语(prosody phrase, PPH) -> 语调短句(intonational phrase, IPH) -> 子句子 -> 主句子 -> 段落 -> 篇章 +``` +音素 -> 音节 -> 韵律词(Prosody Word, PW) -> 韵律短语(prosody phrase, PPH) -> 语调短句(intonational phrase, IPH) -> 子句子 -> 主句子 -> 段落 -> 篇章 LP -> LO -> L1(#1) -> L2(#2) -> L3(#3) -> L4(#4) -> L5 -> L6 -> L7 +``` + + 主要关注 PW, PPH, IPH | | 停顿时长 | 前后音高特征 | | --- | ----------| --- | -| 韵律词边界 | 不停顿或从听感上察觉不到停顿 | 无 | +| 韵律词边界 | 不停顿或从听感上察觉不到停顿 | 无 | | 韵律短语边界 | 可以感知停顿,但无明显的静音段 | 音高不下倾或稍下倾,韵末不可做句末 | | 语调短语边界 | 有较长停顿 | 音高下倾比较完全,韵末可以作为句末 | -常用方法使用的是级联CRF,首先预测如果是PW,再继续预测是否是PPH,再预测是否是IPH +常用方法使用的是级联CRF,首先预测如果是PW,再继续预测是否是PPH,再预测是否是IPH @@ -155,7 +174,7 @@ LP -> LO -> L1(#1) -> L2(#2) -> L3(#3) -> L4(#4) -> L5 -> L6 -> L7 -## 基于神经网络的前端文本分析模型 +## 基于神经网络的前端文本分析模型 最近这两年基本都是基于 BERT,所以这里记录一下相关的论文: @@ -167,6 +186,8 @@ LP -> LO -> L1(#1) -> L2(#2) -> L3(#3) -> L4(#4) -> L5 -> L6 -> L7 + + ## 总结 总结一下,文本分析各个模块的方法: diff --git a/doc/src/vad.md b/doc/src/vad.md new file mode 100644 index 00000000..56fe9587 --- /dev/null +++ b/doc/src/vad.md @@ -0,0 +1,32 @@ +# VAD + +## Endpoint Detection + +### Kaldi + + **Kaldi**使用规则方式,制定了五条规则,只要满足其中一条则认为是检测到了 endpoint。 + +1. 识别出文字之前,检测到了 5s 的静音; +2. 识别出文字之后,检测到了 2s 的静音; +3. 解码到概率较小的 final state,且检测到了 1s 的静音; +4. 解码到概率较大的 final state,且检测到了 0.5s 的静音; +5. 已经解码了 20s。 + +### CTC + +将连续的长 blank 标签,视为非语音区域。非语音区域满足一定的条件,即可认为是检测到了 endpoint。同时,参考 Kaldi 的 `src/online2/online-endpoint.h`,制定了以下三条规则: + +1. 识别出文字之前,检测到了 5s 的静音; +2. 识别出文字之后,检测到了 1s 的静音; +3. 已经解码了 20s。 + +只要满足上述三条规则中的任意一条, 就认为检测到了 endpoint。 + + + +## Reference + +* [Endpoint 检测](https://mp.weixin.qq.com/s?__biz=MzU2NjUwMTgxOQ==&mid=2247484024&idx=1&sn=12da2ee76347de4a18856274ba6ba61f&chksm=fcaacaaccbdd43ba6b3e996bbf1e2ac6d5f1b449dfd80fcaccfbbe0a240fa1668b931dbf4bd5&scene=21#wechat_redirect) +* Kaldi: *https://github.com/kaldi-asr/kaldi/blob/6260b27d146e466c7e1e5c60858e8da9fd9c78ae/src/online2/online-endpoint.h#L132-L150* +* End-to-End Automatic Speech Recognition Integrated with CTC-Based Voice Activity Detection: *https://arxiv.org/pdf/2002.00551.pdf* + -- GitLab