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

feat(Search): Support pinyin search (#33) #40

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

y122972
Copy link

@y122972 y122972 commented Aug 31, 2022

resolves #33.

Copy link
Member

@renbaoshuo renbaoshuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢您的贡献。以下是一些改进建议:

  1. https://github.com/creeperyang/pinyin 不支持多音字,需要在 https://github.com/OIerDb-ng/OIerDb-data-generator 中特殊处理(可能需要维护一份作姓氏时与其他用途时读音不同的汉字的列表);
  2. 建议与现有的拼音首字母查询功能做一个整合(现在生成的数据中已经包含了拼音首字母信息,可以考虑移动至前端处理以节省流量);
  3. 人名中生僻字的转换准确度未知,需要另行测试;
  4. 按拼音搜索时建议按照匹配度返回结果。

src/components/Search.tsx Outdated Show resolved Hide resolved
src/components/Search.tsx Outdated Show resolved Hide resolved
src/components/Search.tsx Outdated Show resolved Hide resolved
src/components/Search.tsx Outdated Show resolved Hide resolved
src/libs/OIerDb.ts Outdated Show resolved Hide resolved
src/libs/OIerDb.ts Outdated Show resolved Hide resolved
(oier) =>
oier.name === input ||
oier.initials === input ||
(input && oier.pinyin.includes(input))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑一种情况:

# 姓名 拼音
1 王五 wangwu
2 吴六 wuliu

此时大部分人的期望结果为「吴六」,但返回结果中「王五」会排在「吴六」之前。

@netlify
Copy link

netlify bot commented Sep 1, 2022

Deploy Preview for oierdb ready!

Name Link
🔨 Latest commit 5410d65
🔍 Latest deploy log https://app.netlify.com/sites/oierdb/deploys/63106cae74c1760008c48b08
😎 Deploy Preview https://deploy-preview-40--oierdb.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@y122972
Copy link
Author

y122972 commented Sep 1, 2022

生僻字和多音字(名)的中文字典比较大, 搞的话估计得手动维护一份仅满足所有选手的字典

拼音首字母和拼音功能确实重复, 首字母是在https://github.com/OIerDb-ng/OIerDb-data-generator生成的吗, 不懂python

  • 按拼音搜索时建议按照匹配度返回结果。

@y122972 y122972 closed this Sep 1, 2022
@y122972 y122972 reopened this Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

可以在里面加入姓名全拼
2 participants