Skip to content

Commit

Permalink
fix: 修复 琢 的音频顺序 #207
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Aug 1, 2024
1 parent 524ec30 commit 434648a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/words-7.php
Original file line number Diff line number Diff line change
Expand Up @@ -6284,7 +6284,7 @@
'' => ' wéi ',
'' => ' tiǎn ',
'' => ' chù ',
'' => ' zuó ',
'' => ' zhuó ',
'' => ' běng ',
'' => ' chēng ',
'' => '',
Expand Down
1 change: 1 addition & 0 deletions sources/pathes/chars.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
U+55EF: ǹ # 嗯
U+2E81: fǎn # ⺁
U+7422: zhuó,zuó # 琢
2 changes: 1 addition & 1 deletion src/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function when(bool $condition, callable $callback): static
return $this;
}

public function convert(string $string, ?callable $beforeSplit = null): Collection
public function convert(string $string, callable $beforeSplit = null): Collection
{
// 把原有的数字和汉字分离,避免拼音转换时被误作声调
$string = preg_replace_callback('~[a-z0-9_-]+~i', function ($matches) {
Expand Down
3 changes: 3 additions & 0 deletions tests/PinyinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ public function test_issues()
// https://github.com/overtrue/pinyin/issues/200
$this->assertPinyin(['', 'ōu'], Pinyin::sentence('仆区'));

// https://github.com/overtrue/pinyin/issues/207
$this->assertPinyin(['zhuó'], Pinyin::sentence(''));

// https://github.com/overtrue/pinyin/issues/195
$this->assertSame([
'' => ['ni3'],
Expand Down

0 comments on commit 434648a

Please sign in to comment.