mirror of
https://github.com/gchq/CyberChef
synced 2024-11-15 00:57:08 +00:00
Improved readability and efficiency of RAKE
This commit is contained in:
parent
f606d4b25f
commit
0cfb67bd06
1 changed files with 4 additions and 4 deletions
|
@ -105,10 +105,10 @@ class RAKE extends Operation {
|
||||||
|
|
||||||
// Generate word_degree_matrix and populate
|
// Generate word_degree_matrix and populate
|
||||||
const wordDegreeMatrix = Array(tokens.length).fill().map(() => Array(tokens.length).fill(0));
|
const wordDegreeMatrix = Array(tokens.length).fill().map(() => Array(tokens.length).fill(0));
|
||||||
for (let p=0; p < phrases.length; p++) {
|
for (const phrase of phrases) {
|
||||||
for (let w1=0; w1 < phrases[p].length; w1++) {
|
for (const word1 of phrase) {
|
||||||
for (let w2=0; w2 < phrases[p].length; w2++) {
|
for (const word2 of phrase) {
|
||||||
wordDegreeMatrix[tokens.indexOf(phrases[p][w1])][tokens.indexOf(phrases[p][w2])]++;
|
wordDegreeMatrix[tokens.indexOf(word1)][tokens.indexOf(word2)]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue