diff --git a/data/words-1.php b/data/words-1.php index 8eb125b3..45a29954 100644 --- a/data/words-1.php +++ b/data/words-1.php @@ -6648,6 +6648,7 @@ '顶门子' => ' dǐng mén zǐ ', '顶门杠' => ' dǐng mén gàng ', '朝阳区' => ' cháo yáng qū ', + '甄嬛传' => ' zhēn huán zhuàn ', '岭𫶕' => ' líng yíng ', '㞎㞎' => ' bǎ ba ', '㹴犬' => ' gěng quǎn ', @@ -7999,5 +8000,4 @@ '倈子' => ' lái zǐ ', '倍僪' => ' bèi yù ', '倍儿' => ' bèi er ', - '倍切' => ' bèi qiē ', ); diff --git a/data/words-2.php b/data/words-2.php index ca5782cf..cdbd101a 100644 --- a/data/words-2.php +++ b/data/words-2.php @@ -1,5 +1,6 @@ ' bèi qiē ', '倍处' => ' bèi chǔ ', '倍称' => ' bèi chèn ', '倏歘' => ' shū xū ', @@ -7999,5 +8000,4 @@ '横议' => ' hèng yì ', '横话' => ' hèng huà ', '横财' => ' hèng cái ', - '横逆' => ' hèng nì ', ); diff --git a/data/words-3.php b/data/words-3.php index f014561d..56a1001a 100644 --- a/data/words-3.php +++ b/data/words-3.php @@ -1,5 +1,6 @@ ' hèng nì ', '樵子' => ' qiáo zǐ ', '橡子' => ' xiàng zǐ ', '檃栝' => ' yǐn kuò ', @@ -7999,5 +8000,4 @@ '顷危' => ' qīng wēi ', '顷宫' => ' qīng gōng ', '首都' => ' shǒu dū ', - '姓曾' => ' xìng zēng ', ); diff --git a/data/words-4.php b/data/words-4.php index 223021fa..45701b67 100644 --- a/data/words-4.php +++ b/data/words-4.php @@ -1,5 +1,6 @@ ' xìng zēng ', '曾姓' => ' zēng xìng ', '𠀀' => ' hē ', '𠀁' => ' qī ', @@ -7999,5 +8000,4 @@ '𦙈' => ' zuì ', '𦙉' => ' zuǎn ', '𦙊' => ' qì ', - '𦙋' => ' dū ', ); diff --git a/data/words-5.php b/data/words-5.php index 2ce6f0cd..7af0b955 100644 --- a/data/words-5.php +++ b/data/words-5.php @@ -1,5 +1,6 @@ ' dū ', '𦙙' => ' shuǐ ', '𦙜' => ' nǎ ', '𦙝' => ' xī ', @@ -7999,5 +8000,4 @@ '㧥' => ' xiǎn ', '㧦' => ' xuàn ', '㧨' => ' qiú ', - '㧩' => ' pèi ', ); diff --git a/data/words-6.php b/data/words-6.php index 93a34cfc..909c2388 100644 --- a/data/words-6.php +++ b/data/words-6.php @@ -1,5 +1,6 @@ ' pèi ', '㧪' => ' guǐ ', '㧫' => ' ér ', '㧬' => ' gǒng ', @@ -7999,5 +8000,4 @@ '宑' => ' jǐng ', '宒' => ' zhūn ', '宓' => ' mì ', - '宔' => ' zhǔ ', ); diff --git a/data/words-7.php b/data/words-7.php index a8e46340..4d752a4e 100644 --- a/data/words-7.php +++ b/data/words-7.php @@ -1,5 +1,6 @@ ' zhǔ ', '宕' => ' dàng ', '宖' => ' hóng ', '宗' => ' zōng ', @@ -7999,5 +8000,4 @@ '竘' => ' qǔ ', '站' => ' zhàn ', '竚' => ' zhù ', - '竛' => ' líng ', ); diff --git a/data/words-8.php b/data/words-8.php index e2bebe88..14bf9751 100644 --- a/data/words-8.php +++ b/data/words-8.php @@ -1,5 +1,6 @@ ' líng ', '竜' => ' lóng ', '竝' => ' bìng ', '竞' => ' jìng ', @@ -7999,5 +8000,4 @@ '騘' => ' cōng ', '騙' => ' piàn ', '騚' => ' qián ', - '騛' => ' fēi ', ); diff --git a/data/words-9.php b/data/words-9.php index 79a54b0d..df88d30c 100644 --- a/data/words-9.php +++ b/data/words-9.php @@ -1,5 +1,6 @@ ' fēi ', '騜' => ' huáng ', '騝' => ' qián ', '騞' => ' huō ', diff --git a/sources/pathes/words.txt b/sources/pathes/words.txt index 6ccd95f2..e6473abf 100644 --- a/sources/pathes/words.txt +++ b/sources/pathes/words.txt @@ -2,5 +2,6 @@ 姓曾: xìng zēng 曾姓: zēng xìng 朝阳区: cháo yáng qū +甄嬛传: zhēn huán zhuàn 塔什库尔干: tǎ shí kù ěr gān 乌拉特前旗: wū lā tè qián qí \ No newline at end of file diff --git a/tests/PinyinTest.php b/tests/PinyinTest.php index cba671b5..895e5621 100755 --- a/tests/PinyinTest.php +++ b/tests/PinyinTest.php @@ -194,18 +194,12 @@ public function testNumberWithAlpha() $this->assertEquals('java gong cheng shi', $this->pinyin->sentence('java工程师')); } - /** - * 测试单个音的字. - * - * bug: #19 - * bug: #22 - * bug: #23 - * bug: #24 - * bug: #29 - * bug: #235 - * bug: #81 - */ - public function testSingleAccent() + public function testPhrase() + { + $this->assertEquals('bei3-jing1', $this->pinyin->phrase('北京', '-', \PINYIN_ASCII_TONE)); + } + + public function testIssues() { $this->assertEquals('a le tai', $this->pinyin->sentence('阿勒泰')); $this->assertEquals('e er duo si', $this->pinyin->sentence('鄂尔多斯')); @@ -250,6 +244,15 @@ public function testSingleAccent() // #105 #112 $this->assertEquals('ǹ', $this->pinyin->sentence('嗯', PINYIN_TONE)); + // #167 + $this->assertEquals('chǔ', $this->pinyin->sentence('褚', PINYIN_TONE)); + + // #174 + $this->assertEquals('tuò', $this->pinyin->sentence('拓', PINYIN_TONE)); + + // #146 + $this->assertEquals('zhōng wén', $this->pinyin->sentence('中、文', PINYIN_TONE)); + // #96 $this->assertEquals('shén me', $this->pinyin->sentence('什么', PINYIN_TONE)); $this->assertEquals('hái shuō shí mǒ ne ? huán gěi nǐ . hái gè pì !', $this->pinyin->sentence('还说什么呢?还给你。还个屁!', \PINYIN_TONE)); @@ -265,23 +268,33 @@ public function testSingleAccent() $this->assertEquals('mǎ wěi qū', $this->pinyin->sentence('马尾区', PINYIN_TONE)); $this->assertEquals('wèi shǒu wèi wěi', $this->pinyin->sentence('畏首畏尾', PINYIN_TONE)); $this->assertEquals('sān dū shuǐ zú zì zhì xiàn', $this->pinyin->sentence('三都水族自治县', PINYIN_TONE)); - } - public function testYu() - { $this->assertEquals(['lyu', 'xiu', 'cai'], $this->pinyin->convert('吕秀才')); $this->assertEquals(['lv', 'xiu', 'cai'], $this->pinyin->convert('吕秀才', \PINYIN_UMLAUT_V)); - } - public function testIssue175() - { + #175 $this->assertEquals('yuán', $this->pinyin->sentence('貟', PINYIN_TONE)); $this->assertEquals(['yun', 'xiu', 'cai'], $this->pinyin->name('貟秀才')); $this->assertEquals(['yun', 'xiu', 'cai'], $this->pinyin->name('贠秀才')); - } - public function testPhrase() - { - $this->assertEquals('bei3-jing1', $this->pinyin->phrase('北京', '-', \PINYIN_ASCII_TONE)); + #183 + $this->assertEquals('yín háng quàn', $this->pinyin->sentence('银行券', PINYIN_TONE)); + $this->assertEquals('xún chá', $this->pinyin->sentence('询查', PINYIN_TONE)); + + #170 + $this->assertEquals('ké', $this->pinyin->sentence('咳', PINYIN_TONE)); + $this->assertEquals('xiǎo ér fèi ké kē lì', $this->pinyin->sentence('小儿肺咳颗粒', PINYIN_TONE)); + + #151 + $this->assertEquals('gǔ tóu', $this->pinyin->sentence('骨头', PINYIN_TONE)); + + #116 + $this->assertEquals(['shan', 'mou', 'mou'], $this->pinyin->name('单某某', \PINYIN_UMLAUT_V)); + + #106 + $this->assertEquals('zhēn huán zhuàn', $this->pinyin->sentence('甄嬛传', PINYIN_TONE)); + $this->assertEquals('chuán qí', $this->pinyin->sentence('传奇', PINYIN_TONE)); + $this->assertEquals('zhuàn jì', $this->pinyin->sentence('传记', PINYIN_TONE)); + $this->assertEquals('liú mèng qián', $this->pinyin->sentence('刘孟乾', PINYIN_TONE)); } }