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

Refactor lookup-by-value, fix a bug, and add unit tests #374

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

lukhnos
Copy link
Contributor

@lukhnos lukhnos commented Oct 4, 2023

@shuang886 I refactored the code introduced in #372 and I fixed an issue. While the parseless db uses prefix match for looking up keys by value, the actual parseless LM shouldn't use prefixes.

To reproduce the issue, edit manually data.txt to make the term 鑰匙圈 have a higher score than 鑰匙 (say -1.0), then try to add the phrase 鑰匙系統 via the system service. It turns out that without the fix, the reading ㄧㄠˋ-ㄕˊ-ㄑㄩㄢ-ㄒㄧˋ-ㄊㄨㄥˇ is added. It's just that 鑰匙圈 normally has a score way lower than 鑰匙, and so this bug doesn't manifest itself easily.

This also fixes a bug that while ParselessPhraseDB's reverse lookup uses
prefix match, actual lookup-by-value in ParselessLM shouldn't use prefix
match.
@zonble zonble merged commit 46c1684 into master Oct 4, 2023
1 check passed
@lukhnos lukhnos deleted the dev/add-unit-tests branch October 5, 2023 12:54
lukhnos added a commit to openvanilla/fcitx5-mcbopomofo that referenced this pull request Nov 3, 2023
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