-
-
Notifications
You must be signed in to change notification settings - Fork 455
Pinyin library change #183
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
Conversation
…anlate to avoid cache.
|
Thanks @taooceros! If PR is ready, let us know via request review :) |
|
I think this should be ready now. You are welcome! |
| select $"{a1};{a2}" | ||
| ).ToArray(); | ||
| return combination; | ||
| return string.Concat(content.Split(';').Select(x => x.First())); |
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.
just a question, why is this code only get the first char, do you know what its used for?
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.
This is for getting the acronym for pinyin, just like our discussion in the acronym search. That should be removed once we have done the acronym search in fuzzy search.
If you are talking why this can get the first char of pinyin, it is because when I get the pinyin, I called it with WordsHelper.GetPinyin(content, ";"), which split Chinese character with ";".
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.
Hmm if this is for acronym search, could we remove this and add it in the other acronym search PR, I have a feeling we going to forget to remove this code.
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.
I have done the part of removing this in the acronym branch. I put it here because I think this will be merged earlier so that I won't like to change the behavior since on the past pinyin acronym search is done with this method.
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.
Sure as long as this acronym search code is only specific to Pinyin
|
Thank you for the reviews! @jjw24 |
| lock (IndexLock) | ||
| { // just take the reference inside the lock to eliminate query time issues. | ||
| win32 = _win32s; | ||
| uwps = _uwps; | ||
| } |
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.
Bao has removed the lock in Wox, so I think removing it won't be an issue in Flow, too.
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.
I dont suppose those two will be updated often unless a reindex is run. Can the user reindex and also query at the same time?
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.
I would consider even if they query and reindex at the same time, it won't affect each other since index only change the memory index after finishing the whole index process (which is time consuming), but assigning values should not be an issue. On the time that Flow is reindexing, the variable won't change until it finish.
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.
I have provide a small test and it seems that won't fine of querying when reindexing.
|
Pinyin changes are looking good. I think if we can rename the Alphabet class that would be sweet. Can you do me a favour, can we pull out the changes related to Programs plugin - locking and program query optimization. Let's stick to one change set per PR so it's easier/quicker to review and test. |
|
also please bump the version in Plugin.Program's plugin.json file |
|
Sure, I will rollback the changes for programs plug-ins and create a new one for it. I think if we don't include the optimization of the query, this PR won't include change for program plugin. Should we still bump the version? |
8a212a6 to
80a2f0d
Compare
|
Hmmmm you are right, I think the original implementation of the acronym search in the pinyin search is done by adding the acronym character to the front of the translated query, which will lead to the weird query translation. You can see that the current implementation is joining all the combination together including acronym into a large string. I think it doesn't allow we use Chinese query to search for pinyin result as well because of the query translation is also the one that include every combination of polyphone and acronym. The acronym part will be removed after the native acronym search has been finished, which means that the translation of query will be clean. |
yeah that's what I was thinking, once the acronym search is implemented in string matcher, this shouldnt be needed here. Is that PR ready to go? |
It should be ready to go except the highlighted data is hard to control due to the translation. Do you think it is ok when sometimes the highlighted data is not on the right place? Or maybe if it is translated, we don't include the highlight data. |
is this when translating Pinyin and matching a Chinese character program? I think the original code doesnt highlight Chinese |
Yes, it only highlights if search with acronym since they are the character that lies one the first few characters and match the chinese character. We can discuss this on #185 . |
Ok sounds good. I havent had a chance to look at 185 yet, will do so soon. Lets not forget to remove this acronym search once 185 is finished. |
|
Of course, the integration has been finished, except for the highlight, and once those two pr has been merged, I will create a new pr to do the job. |
|
Lets get rid of that white space and then we can merge this in and get a release going :) |




Moved from #179
Wox has changed the Pinyin Library to ToolGood.Words. #2962 Thank you for the change @bao-qian .
This pull request has done the same thing, but optimize a few.
It keeps the full pinyin query, which seems perform the same as current pinyin library.
It keeps using the Concurrent Dictionary as cache, instead of Wox's Memory Cache. I think changing the cache implementation should be done in separately. However, the cache for Pinyin is changed from store single chinese character to whole word.
IAlphabet interface is kept in this pull request.
I also merge the query of win32 and uwp in Program plugin into one query by adding enabled property to the IProgram interface and cast win32 and uwp to IProgram.
I have checked the previous cache storage and it actually makes the loading time quite long, so I remove the Save and Loading cache in this pull request because it seems that the library is fast enough.