Skip to content

Commit

Permalink
Merge pull request #1751 from sw5678/master
Browse files Browse the repository at this point in the history
  • Loading branch information
a3957273 committed Apr 13, 2024
2 parents edc23a8 + f6c5a04 commit a429902
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/core/operations/RAKE.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,17 @@ class RAKE extends Operation {
phrases = phrases.filter(subArray => subArray.length > 0);

// Remove duplicate phrases
const uniquePhrases = [...new Set(phrases.map(function (phrase) {
return phrase.join(" ");
}))];
phrases = uniquePhrases.map(function (phrase) {
return phrase.split(" ");
});

phrases = phrases.unique();

Check warning on line 105 in src/core/operations/RAKE.mjs

View workflow job for this annotation

GitHub Actions / main

Trailing spaces not allowed

Check warning on line 105 in src/core/operations/RAKE.mjs

View workflow job for this annotation

GitHub Actions / main

Trailing spaces not allowed
// Generate word_degree_matrix and populate
const wordDegreeMatrix = Array.from(Array(tokens.length), _ => Array(tokens.length).fill(0));
phrases.forEach(function (phrase) {
phrase.forEach(function (word1) {
phrase.forEach(function (word2) {
const wordDegreeMatrix = Array(tokens.length).fill().map(() => Array(tokens.length).fill(0));
for (const phrase of phrases) {
for (const word1 of phrase) {
for (const word2 of phrase) {
wordDegreeMatrix[tokens.indexOf(word1)][tokens.indexOf(word2)]++;
});
});
});
}
}
}

// Calculate degree score for each token
const degreeScores = Array(tokens.length).fill(0);
Expand Down

0 comments on commit a429902

Please sign in to comment.