Last active
October 2, 2021 16:02
-
-
Save c7x43t/2df558e6fcc2f07d3b8b9b6023904b9f to your computer and use it in GitHub Desktop.
This file contains 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
var reg=/(?:^|\s?)([\w\u00C0-\u017Fa-zA-Z-']+)(?:$|\s?)/g; | |
// __ | |
function tokenize(text){ | |
var tokens = Array.from(text.matchAll(/(?:^|\s?)([\w\u00C0-\u017Fa-zA-Z-']+)(?:$|\s?)/g)).map(e=>e[1]); | |
return tokens; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment