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

多音字在组词和随机生成词语时,根据传入的音调过滤 #302

Open
nww57 opened this issue Jan 25, 2025 · 1 comment
Open
Labels
help wanted Extra attention is needed

Comments

@nww57
Copy link

nww57 commented Jan 25, 2025

现在的:
多音字:好(Hǎo|Hào)
调用cnchar.words("好")后:[ "爱好","好奇", "好多", "好孩子",...]
期望:
cnchar.words("好|hao3") :["好多", "好孩子",...]
cnchar.words("好|hao4") :["爱好","好奇",...]

随机生成词语时:
cnchar.random.words(options?: {
number?: number; // 生成数量 默认1
length?: number; // 词语长度 默认不限制
match?: string; // 查找包含match的词语
}): string;
match查找时也能根据字+音调查找

@theajack
Copy link
Owner

theajack commented Mar 5, 2025

感谢指出 可以做但是这个可能会不准确 因为离线词库的方式不太可能完全cover住所有多音词组

@theajack theajack added the help wanted Extra attention is needed label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants