Open dnnrly opened 4 years ago
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
Possibly, although I'd prefer to avoid copyright issues from copying the algorithm. What does the license say?
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
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.
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
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.
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?
No, I think that's it. I look forward to your PR!
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.
Cool! Are you ready to raise a PR yet?
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:
(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!
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.
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 :)
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:
Additional context How would this work with other languages?