Skip to content

Commit

Permalink
Fixed #106
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Apr 25, 2022
1 parent 13cf803 commit 8086f15
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 30 deletions.
2 changes: 1 addition & 1 deletion data/words-1.php
Expand Up @@ -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 ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'倈子' => ' lái zǐ ',
'倍僪' => ' bèi yù ',
'倍儿' => ' bèi er ',
'倍切' => ' bèi qiē ',
);
2 changes: 1 addition & 1 deletion data/words-2.php
@@ -1,5 +1,6 @@
<?php
return array (
'倍切' => ' bèi qiē ',
'倍处' => ' bèi chǔ ',
'倍称' => ' bèi chèn ',
'倏歘' => ' shū xū ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'横议' => ' hèng yì ',
'横话' => ' hèng huà ',
'横财' => ' hèng cái ',
'横逆' => ' hèng nì ',
);
2 changes: 1 addition & 1 deletion data/words-3.php
@@ -1,5 +1,6 @@
<?php
return array (
'横逆' => ' hèng nì ',
'樵子' => ' qiáo zǐ ',
'橡子' => ' xiàng zǐ ',
'檃栝' => ' yǐn kuò ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'顷危' => ' qīng wēi ',
'顷宫' => ' qīng gōng ',
'首都' => ' shǒu dū ',
'姓曾' => ' xìng zēng ',
);
2 changes: 1 addition & 1 deletion data/words-4.php
@@ -1,5 +1,6 @@
<?php
return array (
'姓曾' => ' xìng zēng ',
'曾姓' => ' zēng xìng ',
'𠀀' => ' hē ',
'𠀁' => ' qī ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'𦙈' => ' zuì ',
'𦙉' => ' zuǎn ',
'𦙊' => ' qì ',
'𦙋' => ' dū ',
);
2 changes: 1 addition & 1 deletion data/words-5.php
@@ -1,5 +1,6 @@
<?php
return array (
'𦙋' => ' dū ',
'𦙙' => ' shuǐ ',
'𦙜' => ' nǎ ',
'𦙝' => ' xī ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'㧥' => ' xiǎn ',
'㧦' => ' xuàn ',
'㧨' => ' qiú ',
'㧩' => ' pèi ',
);
2 changes: 1 addition & 1 deletion data/words-6.php
@@ -1,5 +1,6 @@
<?php
return array (
'㧩' => ' pèi ',
'㧪' => ' guǐ ',
'㧫' => ' ér ',
'㧬' => ' gǒng ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'宑' => ' jǐng ',
'宒' => ' zhūn ',
'宓' => ' mì ',
'宔' => ' zhǔ ',
);
2 changes: 1 addition & 1 deletion data/words-7.php
@@ -1,5 +1,6 @@
<?php
return array (
'宔' => ' zhǔ ',
'宕' => ' dàng ',
'宖' => ' hóng ',
'宗' => ' zōng ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'竘' => ' qǔ ',
'站' => ' zhàn ',
'竚' => ' zhù ',
'竛' => ' líng ',
);
2 changes: 1 addition & 1 deletion data/words-8.php
@@ -1,5 +1,6 @@
<?php
return array (
'竛' => ' líng ',
'竜' => ' lóng ',
'竝' => ' bìng ',
'竞' => ' jìng ',
Expand Down Expand Up @@ -7999,5 +8000,4 @@
'騘' => ' cōng ',
'騙' => ' piàn ',
'騚' => ' qián ',
'騛' => ' fēi ',
);
1 change: 1 addition & 0 deletions data/words-9.php
@@ -1,5 +1,6 @@
<?php
return array (
'騛' => ' fēi ',
'騜' => ' huáng ',
'騝' => ' qián ',
'騞' => ' huō ',
Expand Down
1 change: 1 addition & 0 deletions sources/pathes/words.txt
Expand Up @@ -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í
57 changes: 35 additions & 22 deletions tests/PinyinTest.php
Expand Up @@ -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('鄂尔多斯'));
Expand Down Expand Up @@ -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));
Expand All @@ -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));
}
}

0 comments on commit 8086f15

Please sign in to comment.