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

Empty strings are calculated as words, resulting in inaccurate scoring #16

Open
peterwoodworth opened this issue Dec 3, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@peterwoodworth
Copy link
Member

What is the problem?

The action will parse titles with the format (area) title into an array containing multiple empty strings.

Reproduction Steps

Submit an issue with the format (area) title, and the array of words which will be compared to keywords will be:

['', 'area', '', 'title']

Other Info

I'm not sure why the first empty string appears, but any other empty strings seem to appear when there are at least two characters adjacent to each other which used to split the string returned by the Github API.

This is set here:

if (title) {
excluded.forEach(ex => {
title.replace(ex, '');
});
this.titleIssueWords = title.split(/ |\(|\)|\./);
}
if (body) {
excluded.forEach(ex => {
body.replace(ex, '');
});
this.bodyIssueWords = body.split(/ |\(|\)|\./);
}


Additionally, the way punctuation is handled in this action isn't clear and should be more transparent.
It should also be more configurable by the user. Currently, nearly all punctuation is ignored when comparing strings to keywords:

str1 = str1.toLowerCase();
str2 = str2.toLowerCase();
// Regex for removing punctuation and replacing with empty string
str1 = str1.replace(/ |_|-|\(|\)|:|\`|\[|\]| |\./gi, '');
str2 = str2.replace(/ |_|-|\(|\)|:|\`|\[|\]| |\./gi, '');

@peterwoodworth peterwoodworth added the bug Something isn't working label Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant