petronny / pinyin-completion

complete path name based upon the pinyin acronym of Chinese characters
GNU General Public License v3.0
63 stars 13 forks source link

Miss a LICENSE #18

Closed Freed-Wu closed 8 months ago

Freed-Wu commented 9 months ago

Miss a LICENSE will affect packaging https://github.com/NixOS/nixpkgs/issues/262218.

Freed-Wu commented 9 months ago

If you are busy to do, can you add me to collaborators? @petronny

petronny commented 9 months ago

Hi, as you can see that this repository is forked from https://github.com/adaptee/pinyin-completion. We may need the permission of the original author to add or change the license.

If you are busy to do, can you add me to collaborators?

Sure.

Freed-Wu commented 9 months ago

I found a LICENSE: https://aur.archlinux.org/packages/pinyin-completion:

Licenses: GPL3

petronny commented 9 months ago

I found a LICENSE: https://aur.archlinux.org/packages/pinyin-completion

This is my mistake. I will file an issue to the original repository.

petronny commented 9 months ago

https://github.com/adaptee/pinyin-completion/issues/4

Freed-Wu commented 8 months ago

I refactor the code to avoid the problem comes from original repo.

Now this plugin use pypinyin to get the pinyin of every word. We don't need to maintain any extra code except shell plugins.

I have added unit tests and CI/CD to make sure it can work.

Currently, pypinyin can work but not fast:

% hyperfine -r 10 'pypinyin 你好'
Benchmark 1: pypinyin 你好
  Time (mean ± σ):     613.4 ms ±   4.9 ms    [User: 465.2 ms, System: 147.6 ms]
  Range (min … max):   604.5 ms … 619.2 ms    10 runs
% hyperfine -r 10 'echo 你好|pinyin-tool'
Benchmark 1: echo 你好|pinyin-tool
  Time (mean ± σ):     435.1 ms ±  10.1 ms    [User: 382.1 ms, System: 53.3 ms]
  Range (min … max):   425.7 ms … 461.7 ms    10 runs

I have researched alternative tools:

And if pypinyin supports:

it should be faster.

However, the above features should be upstream's works and it is not directly related to us.

petronny commented 8 months ago

Now this plugin use pypinyin to get the pinyin of every word. We don't need to maintain any extra code except shell plugins.

This is a great idea. However, I believe pypinyin is using ngram models so the speed will be slow.

We can write a new script with pypinyin to generate a pinyin_initial.json file and rewrite the pinyin-comp with other languages like go or rust to bypass the copyright issue.

Freed-Wu commented 8 months ago

We can write a new script with pypinyin

I agree. And the new script also can be contributed to upstream, because I think not only this repo need it. A cache named pinyin_initial.json store all character's pinyin's initial alphabet can accelerate all projects depends on pypinyin: https://github.com/mozillazg/python-pinyin/issues/310

Currently, can you enable pre-commit.ci?

petronny commented 8 months ago

Currently, can you enable pre-commit.ci?

Done.