Skip to content

Commit

Permalink
fix(core.gbapp): Fix in MSFT spellchecker.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Dec 22, 2020
1 parent ff8e99f commit eaaae13
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,23 +841,22 @@ export class GBMinService {
keepTextList = keepTextList.concat(result);
}
});

let textProcessed = GBConversationalService.removeDiacriticsAndPunctuation(text);
if (keepTextList) {
keepTextList = keepTextList.filter(p => p.trim() !== '');
let i = 0;
await CollectionUtil.asyncForEach(keepTextList, item => {

let it = GBConversationalService.removeDiacriticsAndPunctuation(item);

if (text.toLowerCase().indexOf(item.toLowerCase()) != -1) {
const replacementToken = GBAdminService['getNumberIdentifier']();
if (textProcessed.toLowerCase().indexOf(it.toLowerCase()) != -1) {
const replacementToken = 'X' + GBAdminService['getNumberIdentifier']().substr(0,4);
replacements[i] = { text: item, replacementToken: replacementToken };
i++;
text = text.replace(new RegExp(item.trim(), 'gi'), `${replacementToken}`);
textProcessed = textProcessed.replace(new RegExp(it.trim(), 'gi'), `${replacementToken}`);
}
});
}
text = await min.conversationalService.spellCheck(min, text);
text = await min.conversationalService.spellCheck(min, textProcessed);

// Detects user typed language and updates their locale profile if applies.

Expand Down

0 comments on commit eaaae13

Please sign in to comment.