Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复部分变调失效的情况 #184

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions lib/core/pinyin/handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ export const getPinyin = (
} else {
const char = word[i];
let pinyin: string = '';
if (!match || match.index > i + 1) {
pinyin = getSepecialChangeTone(char, word[i - 1], word[i + 1]);
} else {
pinyin = getSingleWordPinyin(char);
}
pinyin = getSepecialChangeTone(char, word[i - 1], word[i + 1]);
list[i] = {
origin: char,
result: pinyin,
Expand Down
5 changes: 5 additions & 0 deletions test/special.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ describe('special change tone', () => {
const result = pinyin('说不说');
expect(result).to.be.equal('shuō bu shuō');
});

it('[special change tone]一会儿', () => {
const result = pinyin('一会儿');
expect(result).to.be.equal('yí huì er');
});
});
Loading