textlint-rule / textlint-rule-unexpanded-acronym

textlint rule that check unexpanded acronym.
MIT License
9 stars 3 forks source link

Fix bugs to ignore Capital letter at the beginning of the Sentence #6

Closed donganzh-zz closed 4 years ago

donganzh-zz commented 5 years ago

Hi, @azu As I was using this rule on my documents, I found a bug that if there is a capital letter at the beginning of the sentence and there is an explanation to an acronym right after it, the rule won't extract the right acronym for the comparison. Here is an example:

In the Amazon Web Service, it can be short as AWS.

In this case, previously the rule will extract IAWS to compare with AWS because "the" is an acronymJoiningWords, which generates an error message.

In order to fix it, I first reverse the AcronymCreater array and loop using reduce and add the first character to beginning on every iteration and finally join on every iteration and push to result array

{"S", "WS", "AWS", "IAWS"}

Then check this array using isWordSatidfy method and push the good ones to expandedAcronymList to compare with AWS.

I added this test case in the textlint-rule-unexpanded-acronym-test.js and it passed all the previous test as well.

I also update the array-includes package to the latest version.

Cheers!

donganzh-zz commented 5 years ago

Changes fixed

donganzh-zz commented 5 years ago

@azu hello, could you please review my changes? thanks

parkas2018 commented 5 years ago

I have the following sentence where the acronym "AWS" is being reported as unexpanded. Will this PR fix this issue?

This topic describes the process to setup this tool, which you can use for deploying the application on either Azure or Amazon Web Services (AWS)
amimas commented 4 years ago

Hello, any update on this PR?

azu commented 4 years ago

I've published https://github.com/textlint-rule/textlint-rule-unexpanded-acronym/releases/tag/1.2.4