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

Attempt to guess an abbreviation when a predefined one doesn't exist #13

Open
dnnrly opened this issue Jan 27, 2020 · 14 comments
Open

Attempt to guess an abbreviation when a predefined one doesn't exist #13

dnnrly opened this issue Jan 27, 2020 · 14 comments
Labels
help wanted Extra attention is needed

Comments

@dnnrly
Copy link
Owner

dnnrly commented Jan 27, 2020

Is your feature request related to a problem? Please describe.
At the moment, there is a defined list of abbreviations that are looked up. Where an abbreviation isn't present, it just won't be abbreviated.

Describe the solution you'd like
It would be good if the tool could attempt to shorten words taht it doesn't already know about.

A couple of different strategies we could explore:

  • Match only parts of words
  • Remove all vowels

Additional context
How would this work with other languages?

@dnnrly dnnrly added the help wanted Extra attention is needed label Jan 27, 2020
@trampfox
Copy link

As a first implementation of this feature, what about something similar the abbreviate function in R for the unmatched words? https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/abbreviate

@dnnrly
Copy link
Owner Author

dnnrly commented Mar 21, 2020

Possibly, although I'd prefer to avoid copyright issues from copying the algorithm. What does the license say?

@VishalVatsal97
Copy link

VishalVatsal97 commented Aug 2, 2020

Hi, I was exploring this issue and tried to implement the removing all vowels strategy. I was thinking whether we should notify user that we are guessing the abbreviation or not?

Example : abbreviate original herewego
Guessing abbreviation

@dnnrly
Copy link
Owner Author

dnnrly commented Aug 2, 2020

I would be cautious about that. I think people will be consuming the output directly and we don't want them to be concerned with filtering out log entries. Could an option be to use a CLI param to select the algorithm used?

Maybe we could have something to check if it's a known abbreviation? That might be a separate PR though.

@VishalVatsal97
Copy link

VishalVatsal97 commented Aug 2, 2020

I would be cautious about that. I think people will be consuming the output directly and we don't want them to be concerned with filtering out log entries. Could an option be to use a CLI param to select the algorithm used?

Can you give an example of how the cli param should look.?.I am understanding it as :
abbreviate original herewego --algorithm/paramname removeVowel .. Apologies if I am sounding a bit naive

@dnnrly
Copy link
Owner Author

dnnrly commented Aug 2, 2020

No, that's not naive. I would probably call the parameter --strategy or something and just have a list of options available in the help. One of those strategies could be removeVowels, perhaps another could be lookupOnly. I think Cobra insists that the parameter goes before the word to abbreviate but appart from that, it looks good.

Thinking about it, it makes it easier to add new algorithms later.

@VishalVatsal97
Copy link

Ok...For lookupOnly we may need a seperate discussion on how it should be implemented...Should I go ahead with implementing removeVowel or there is something more you want to discuss?

@dnnrly
Copy link
Owner Author

dnnrly commented Aug 3, 2020

No, I think that's it. I look forward to your PR!

@VishalVatsal97
Copy link

Hi, I have implemented this but instead of using --strategy as a command I am using it as a flag with value removeVowel. This is just because I found flags easier to implement and integrate with the current structure of the project.

@dnnrly
Copy link
Owner Author

dnnrly commented Sep 10, 2020

Cool! Are you ready to raise a PR yet?

@VishalVatsal97
Copy link

#19 Raised a PR

@sperez8
Copy link

sperez8 commented Oct 13, 2022

I have another idea to propose for "guessing" an abbreviation.
How about truncating each word to its first syllable?

So the behavior would look like:

$ abbreviate original red-difference-strategy --syllabic
red-diff-stg

In this example:

  • strategy already has a known abbreviation so we use that
  • red is a one syllable word so it is left unchanged
  • difference is truncated to its first syllable

(Assuming I can find a clever way to find the first syllable of multi-syllable words)

Would this new flag be of interested? Let me know and I can work on a PR for hacktoberfest!

@dnnrly
Copy link
Owner Author

dnnrly commented Oct 13, 2022

Or red-diff-strat? I like this idea. A lot!!!

Please, feel free to raise a pull request early. Don't worry about having a full solution. Try something, see how the code feels to you.

I'm curious to see what you come up with.

@sperez8
Copy link

sperez8 commented Oct 13, 2022

Or red-diff-strat? I like this idea. A lot!!!

Oh interesting, I was thinking it would only replace words for which an abbreviation is NOT known. But that might be additional option to add later? Something to think about...

Please, feel free to raise a pull request early. Don't worry about having a full solution. Try something, see how the code feels to you.

Sounds good will do :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants