-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat(Search): Support pinyin search (#33) #40
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢您的贡献。以下是一些改进建议:
- https://github.com/creeperyang/pinyin 不支持多音字,需要在 https://github.com/OIerDb-ng/OIerDb-data-generator 中特殊处理(可能需要维护一份作姓氏时与其他用途时读音不同的汉字的列表);
- 建议与现有的拼音首字母查询功能做一个整合(现在生成的数据中已经包含了拼音首字母信息,可以考虑移动至前端处理以节省流量);
- 人名中生僻字的转换准确度未知,需要另行测试;
- 按拼音搜索时建议按照匹配度返回结果。
src/components/Search.tsx
Outdated
(oier) => | ||
oier.name === input || | ||
oier.initials === input || | ||
(input && oier.pinyin.includes(input)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑一种情况:
# | 姓名 | 拼音 |
---|---|---|
1 | 王五 | wangwu |
2 | 吴六 | wuliu |
此时大部分人的期望结果为「吴六」,但返回结果中「王五」会排在「吴六」之前。
Co-authored-by: Baoshuo Ren <[email protected]>
Co-authored-by: Baoshuo Ren <[email protected]>
Co-authored-by: Baoshuo Ren <[email protected]>
Co-authored-by: Baoshuo Ren <[email protected]>
Co-authored-by: Baoshuo Ren <[email protected]>
✅ Deploy Preview for oierdb ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
生僻字和多音字(名)的中文字典比较大, 搞的话估计得手动维护一份仅满足所有选手的字典 拼音首字母和拼音功能确实重复, 首字母是在https://github.com/OIerDb-ng/OIerDb-data-generator生成的吗, 不懂python
|
a923cbe
to
38224fb
Compare
resolves #33.