Created
November 4, 2020 08:33
-
-
Save oscar-defelice/3c1e8c90610b466d19129375fbe1715f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tokenise(text) { | |
text = text.toLowerCase(); | |
var splitted_text = text.split(' '); | |
var tokens = []; | |
splitted_text.forEach(element => { | |
if (word2index[element] != undefined) { | |
tokens.push(word2index[element]); | |
} | |
}); | |
while (tokens.length < maxLen) { | |
tokens.push(0); | |
} | |
return tokens.slice(0,maxLen); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment