Skip to content

fix(ime_pinyin): fix letter count wrong when using some dictionary - #6752

Merged
kisvegabor merged 1 commit into
lvgl:masterfrom
squi2rel:patch-1
Aug 29, 2024
Merged

kisvegabor merged 1 commit into
lvgl:masterfrom
squi2rel:patch-1

Conversation

@squi2rel

Copy link
Copy Markdown
Contributor

When I'm using custom dictionary, I noticed some letter just can't match anything. I check the built-in dictionary and found
image
and my dictionary
image
the algorithm is depends on the next letter, so I got this:
image
and I can't type all word start with 'h'.

The Documentation was not mentioned about this, so maybe use the real letter to calculate index is a better way?

Notes

@liamHowatt liamHowatt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Interesting! Letters with no phrases have an empty string entry as a placeholder to bridge the next letter. I confirmed that "h..." phrases don't work if the "i" placeholder is removed, and your fix works.

I tested in a debugger to see if there are any consequences for leaving parts of py_num and py_pos as the initial zero value and it looks totally fine.

Thank you!

Are you able to confirm if this part is correct? A dictionary will never have i, u, or v?

    if(*py_str == '\0')    return NULL;
    if(*py_str == 'i')     return NULL;
    if(*py_str == 'u')     return NULL;
    if(*py_str == 'v')     return NULL;
    if(*py_str == ' ')     return NULL;

@squi2rel

Copy link
Copy Markdown
Contributor Author

Interesting! Letters with no phrases have an empty string entry as a placeholder to bridge the next letter. I confirmed that "h..." phrases don't work if the "i" placeholder is removed, and your fix works.

I tested in a debugger to see if there are any consequences for leaving parts of py_num and py_pos as the initial zero value and it looks totally fine.

Thank you!

Are you able to confirm if this part is correct? A dictionary will never have i, u, or v?

    if(*py_str == '\0')    return NULL;
    if(*py_str == 'i')     return NULL;
    if(*py_str == 'u')     return NULL;
    if(*py_str == 'v')     return NULL;
    if(*py_str == ' ')     return NULL;

These part are right. In fact, there are no Chinese characters starting with 'i', 'u' or 'v'.

@kisvegabor
kisvegabor merged commit beb3c52 into lvgl:master Aug 29, 2024
@kisvegabor

Copy link
Copy Markdown
Member

Thank you! 😊

@squi2rel
squi2rel deleted the patch-1 branch August 29, 2024 07:49
@squi2rel
squi2rel restored the patch-1 branch August 29, 2024 10:07
kisvegabor pushed a commit to kisvegabor/lvgl_fork that referenced this pull request Sep 2, 2024
kisvegabor pushed a commit to kisvegabor/lvgl_fork that referenced this pull request Oct 1, 2024
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.

3 participants