-
-
Notifications
You must be signed in to change notification settings - Fork 365
Double pinyin query #2427
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
base: dev
Are you sure you want to change the base?
Double pinyin query #2427
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
{"ian", "m"} | ||
}); | ||
|
||
private static string ToDoublePin(string fullPinyin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to use ReadOnlySpan
as we have quite a few slicing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
73c4a69
to
22f6ad7
Compare
@VictoriousRaptor what's the status of this pr? |
POC. I'm using it daily and so far so good. Since there're many double pinyin mappings we should make it user configurable. Is it acceptable to allow users to edit a json file that defines the mapping? |
well I can't think anything better...maybe I do want this to be plugin-able, but can't think of a good way to design the api. |
0c01c95
to
f673000
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs:240
- [nitpick] The inline comment 'For developing' is vague. Consider clarifying whether UseDoublePinyin is intended for development only or should be enabled in production.
public bool UseDoublePinyin { get; set; } = true; //For developing
Flow.Launcher.Infrastructure/StringMatcher.cs:71
- The condition has been inverted compared to the original usage of !CanBeTranslated. Please verify that using ShouldTranslate(query) yields the intended translation logic.
if (_alphabet is not null && _alphabet.ShouldTranslate(query))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
Flow.Launcher.Infrastructure/PinyinAlphabet.cs:64
- [nitpick] Consider renaming the variable 'dp' to a more descriptive name like 'doublePinyin' for clarity.
string dp = _settings.UseDoublePinyin ? ToDoublePin(resultList[i]) : resultList[i];
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs:240
- [nitpick] The inline comment '//For developing' is ambiguous; consider clarifying or removing it if the flag is intended for production use.
public bool UseDoublePinyin { get; set; } = true; //For developing
Flow.Launcher.Infrastructure/StringMatcher.cs:71
- The condition has been changed from negating CanBeTranslated to using ShouldTranslate directly; please verify that the new logic correctly reflects the intended translation behavior.
if (_alphabet is not null && _alphabet.ShouldTranslate(query))
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs:240
- [nitpick] Consider updating or removing the 'For developing' comment if this setting is expected to be part of production to avoid confusion.
public bool UseDoublePinyin { get; set; } = true; //For developing
Flow.Launcher.Infrastructure/PinyinAlphabet.cs:165
- When fullPinyin.Length is >= 2 but the first two characters do not match any key in the 'first' dictionary, no conversion is applied, which may result in an empty result. Consider adding a fallback to handle cases when the initial conversion is not matched.
if (fullPinyin.Length >= 2)
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
No description provided.