Skip to content

Conversation

@taooceros
Copy link
Member

@taooceros taooceros commented Oct 18, 2020

  1. This pull request add acronym support for fuzzysearch. Link to Acronym search (or more feature) for programs #136
  2. This pr adds mapping from translated text to original text, allowing better highlighted text display for people using pinyin search (or potential future translation).

@taooceros
Copy link
Member Author

I originally want to do it as the way I have done before, but then I change my mind and decide to write a straight-forward search for the acronyms and query, which will make retrieve metadata easier and support the case capital letter and space both exist.

Because it is a straightforward loop, the performance should be good.

@taooceros taooceros marked this pull request as draft October 18, 2020 13:28
@taooceros
Copy link
Member Author

I think the test case need update

@taooceros taooceros marked this pull request as ready for review October 19, 2020 03:52
@taooceros
Copy link
Member Author

taooceros commented Oct 19, 2020

If this pull request has been approved, #183 should remove the part that create acronym before the pinyin. However, in order to achieve a correct matchdata highlight, IAlphabet may need to return an extra bool value suggesting whether the string is translated, since one Chinese character will project to multiple letter in pinyin form.

@jjw24 jjw24 added enhancement New feature or request review in progress Indicates that a review is in progress for this PR labels Dec 21, 2020
@taooceros
Copy link
Member Author

I am not sure how we should implement the data match for translated data, since the length change in translation...... should we simply don't highlight data when the string has been translated? Or return an extra string for matching data, which make it the same length as the original string.
Or create an extra class for mapping the index of translated string to original string, and create highlighted index based on that.

…performance, but seems satisfying.

It requires at most n times loop (n: number of translated charater) mapping once.
@taooceros
Copy link
Member Author

@jjw24 please take a try on the new mapping class, and it allow us to even highlight text when using full pinyin. However, it will take another loop to do the mapping every time, not sure if it will be possible to optimize it more.

@jjw24
Copy link
Member

jjw24 commented Dec 22, 2020

just need some clarification:

  • is this acronym support for cases where 'vsc' gets 'visual studio code'?
  • essentially it identifies first letter of every word?
  • should 'vs' for 'visual studio code' match?
  • currently this pr even match 'v' for 'visual studio code' which is a bit excessive

@taooceros
Copy link
Member Author

just need some clarification:

  • is this acronym support for cases where 'vsc' gets 'visual studio code'?
  • essentially it identifies first letter of every word?
  • should 'vs' for 'visual studio code' match?
  • currently this pr even match 'v' for 'visual studio code' which is a bit excessive

It matches the first letter of a word seperated from whitespace or upper letter. So vsc will match both "visual studio code" or "Visual Studio Code" or "visualStudioCode" or "VisualStudioCode".
Not sure whether we should make vs match for visual studio code. I think you are right that a small panalty should be added for unmatched after query finish, while a larger panalty has been added for unmatches before query end.

@jjw24
Copy link
Member

jjw24 commented Jan 31, 2021

Just reworking scoring to be based on percentage of total acronyms so code doesn't bring up long strings. Will push up the branch for you to take a look

@taooceros
Copy link
Member Author

Thank you!

if (char.IsUpper(stringToCompare[compareStringIndex]) ||
char.IsNumber(stringToCompare[compareStringIndex]) ||
char.IsWhiteSpace(stringToCompare[compareStringIndex]) ||
spaceMet)
Copy link
Member

Choose a reason for hiding this comment

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

@taooceros what's this 'spaceMet' variable trying to solve and is this needed for translation?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is used to mark character after space to be acronym even when it is lower case.

Copy link
Member

Choose a reason for hiding this comment

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

Ok cool, I thought so as well. I am thinking of using substring index = 0 to replace this, since the start of substring char is always acronym

Copy link
Member Author

Choose a reason for hiding this comment

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

Have we split the string to compare? I think we only split the query string.

Copy link
Member

Choose a reason for hiding this comment

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

Oh we didn't, lol ok nvm then

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively then, we can go back an index to check if it is space

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that's feasible.

@jjw24
Copy link
Member

jjw24 commented Feb 1, 2021

please look at the updates and let me know if good to merge in here:
https://github.com/taooceros/Flow.Launcher/pull/4/files

@taooceros
Copy link
Member Author

please look at the updates and let me know if good to merge in here:
https://github.com/taooceros/Flow.Launcher/pull/4/files

Great! I will take a look soon.

@taooceros taooceros added this to the 1.7.0 milestone Feb 2, 2021
@taooceros
Copy link
Member Author

@jjw24 any further change we need to make for this PR?

@taooceros taooceros requested a review from jjw24 February 2, 2021 07:15
@jjw24
Copy link
Member

jjw24 commented Feb 2, 2021

Let me take a final look in 2hrs

Copy link
Member

@jjw24 jjw24 left a comment

Choose a reason for hiding this comment

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

Great work @taooceros 👍

@jjw24 jjw24 removed the review in progress Indicates that a review is in progress for this PR label Feb 2, 2021
@jjw24 jjw24 merged commit 9feb266 into Flow-Launcher:dev Feb 2, 2021
@taooceros taooceros deleted the AcronymFuzzy branch June 29, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Acronym search (or more feature) for programs

2 participants