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

如何获得对应的汉字分词数组? #332

Open
lfyfly opened this issue Apr 25, 2022 · 3 comments
Open

如何获得对应的汉字分词数组? #332

lfyfly opened this issue Apr 25, 2022 · 3 comments
Assignees
Labels

Comments

@lfyfly
Copy link

lfyfly commented Apr 25, 2022

console.log(
  pinyin("他说:“钱还是要还的。”", {
    segment: true,
    group: true,
  })
);  
// 返回   [ [ 'tā' ], [ 'shuō' ], [ ':“' ], [ 'qián' ], [ 'háishì' ], [ 'yào' ], [ 'huán' ], [ 'de' ], [ '。”' ] ]
// 如何获得  [ [ '他' ], [ '说' ], [ ':“' ], [ '钱' ], [ '还是' ], [ '要' ], [ '还' ], [ '的' ], [ '。”' ] ]
@lfyfly
Copy link
Author

lfyfly commented Apr 25, 2022

在 class NodePinyin 的 convert 方法把 phrases 也 return 出来就好了

@lfyfly lfyfly closed this as completed Apr 25, 2022
@hotoo hotoo reopened this Apr 27, 2022
@hotoo
Copy link
Owner

hotoo commented Apr 27, 2022

这个在现有数据结构下无法完成,应该只能新增 API 来完成了。

@hotoo hotoo self-assigned this Apr 27, 2022
@hotoo hotoo added the TODO label Apr 27, 2022
@zhaoleicpp
Copy link

我编译的时候发现本工程用的是nodejieba,这个结巴就是分词的。虽然我没法用,但是对你肯定有帮助。你直接用结巴就行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants