UNPKG

arpabet-and-ipa-convertor-ts

Version:

Typescript code to convert between Arpabet and IPA phonetic transcriptions

54 lines (53 loc) 2.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var to_arpabet_1 = require("./to-arpabet"); describe('PhoneticAlphabet2ARPAbet', function () { it('Monosyllable and ()', function () { // 单音节及() var result = to_arpabet_1.toArpabet('faʊ(hh)nd'); expect(result).toEqual('F AW1 N D'); }); it('Double syllable', function () { // ri'trai 双音节 var result = to_arpabet_1.toArpabet('riˈtraɪ'); expect(result).toEqual('R IY0 T R AY1'); }); it('Trisyllable', function () { // ˈɛniˌwʌn, -wən 三音节 var result = to_arpabet_1.toArpabet('ˈɛniˌwʌn'); expect(result).toEqual('EH1 N IY0 W AH2 N'); }); it('kʊd', function () { var result = to_arpabet_1.toArpabet('kʊd'); expect(result).toEqual('K UH1 D'); }); it('wilkinsn Double syllable', function () { // wilkinsn 双音节 var result = to_arpabet_1.toArpabet("'wilkinsn"); expect(result).toEqual('W IY1 L K IY0 N S N'); }); it('Edge test wrong position of accent mark', function () { // 边缘测试 重音标识位置不对 expect(function () { to_arpabet_1.toArpabet("wilkins'n"); }).toThrow('ns\' The accent mark is inappropriate, and the previous syllable of \' has no vowels!'); // ns\' 重音标识不合适,\'前一个音节没有元音! }); it('Edge test Wrong accent mark and no vowel', function () { // 边缘测试 重音标识不对,并没有元音 expect(function () { to_arpabet_1.toArpabet("wilkia'ʊsn"); }).toThrow('There is an unrecognized phonetic transcription a'); // 存在不能识别的音标 a }); it('Edge test Find the completeness of the last syllable', function () { // 边缘测试 最后一个音节美音找完整 expect(function () { to_arpabet_1.toArpabet("wilki'sna"); }).toThrow('There is an unrecognized phonetic transcription a'); // 存在不能识别的音标 a }); it('Edge test. An incomplete syllable in the middle is connected to a proper phonetic symbol.', function () { // 边缘测试 中间一个不完整的音节连带到做好匹配不到合适的音标 expect(function () { to_arpabet_1.toArpabet("wilki'san"); }).toThrow('There is an unrecognized phonetic transcription an'); // 存在不能识别的音标 an }); });