Last active
May 6, 2022 08:36
-
-
Save julienreszka/8f2f747f6319d04e30f3dc3802971064 to your computer and use it in GitHub Desktop.
Revisions
-
julienreszka revised this gist
May 6, 2022 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,11 @@ function wordFreq(string) { var words = string.replace(/[.]/g, '').split(/\s/); var freqMap = {}; words.forEach(function(w) { var lowerWord = w.toLowerCase() if (!freqMap[lowerWord]) { freqMap[lowerWord] = 0; } freqMap[lowerWord] += 1; }); var mostCommonWordsInEnglish =[ -
julienreszka revised this gist
Apr 1, 2022 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -110,9 +110,13 @@ function wordFreq(string) { "most", "us" ] var mostCommonWordsInFrench = [ "le", "de", "un", "et", "être", "il", "avoir", "ne", "je", "son", "que", "se", "qui", "en", "ce", "dans", "du", "elle", "au", "de", "ce", "le", "pour", "pas", "que", "vous", "par", "sur", "faire", "plus", "dire", "me", "on", "mon", "lui", "nous", "comme", "mais", "pouvoir", "avec", "tout", "y", "aller", "voir", "en", "bien", "où", "sans", "tu", "ou", "leur", "homme", "si", "deux", "mari", "moi", "vouloir", "te", "femme", "venir", "quand", "grand", "celui", "si", "notre", "devoir", "là", "jour", "prendre", "même", "votre", "tout", "rien", "encore", "petit", "aussi", "quelque", "dont", "tout", "mer", "trouver", "donner", "temps", "ça", "peu", "même", "falloir", "sous", "parler", "alors", "main", "chose", "ton", "mettre", "vie", "savoir", "yeux", "passer", "autre", "après" ] return Object.keys(freqMap).map(k=>{return {word: k,freq:freqMap[k]}}) .filter((w)=>w.freq > 1 && !mostCommonWordsInEnglish.includes(w.word) && !mostCommonWordsInFrench.includes(w.word)) .sort((a,b)=>b.freq-a.freq); } -
julienreszka revised this gist
Apr 1, 2022 . 1 changed file with 104 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,111 @@ function wordFreq(string) { freqMap[w] += 1; }); var mostCommonWordsInEnglish =[ "the", "be", "to", "of", "and", "a", "in", "that", "have", "I", "it", "for", "not", "on", "with", "he", "as", "you", "do", "at", "this", "but", "his", "by", "from", "they", "we", "say", "her", "she", "or", "an", "will", "my", "one", "all", "would", "there", "their", "what", "so", "up", "out", "if", "about", "who", "get", "which", "go", "me", "when", "make", "can", "like", "time", "no", "just", "him", "know", "take", "people", "into", "year", "your", "good", "some", "could", "them", "see", "other", "than", "then", "now", "look", "only", "come", "its", "over", "think", "also", "back", "after", "use", "two", "how", "our", "work", "first", "well", "way", "even", "new", "want", "because", "any", "these", "give", "day", "most", "us" ] return Object.keys(freqMap).map(k=>{return {word: k,freq:freqMap[k]}}) .filter((w)=>w.freq > 1 && !mostCommonWordsInEnglish.includes(w.word)) .sort((a,b)=>b.freq-a.freq); } -
julienreszka revised this gist
Apr 1, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,8 @@ function wordFreq(string) { }); return Object.keys(freqMap).map(k=>{return {word: k,freq:freqMap[k]}}) .filter((w)=>w.freq > 1) .sort((a,b)=>b.freq-a.freq); } wordFreq(document.body.innerText) -
julienreszka created this gist
Feb 16, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ function wordFreq(string) { var words = string.replace(/[.]/g, '').split(/\s/); var freqMap = {}; words.forEach(function(w) { if (!freqMap[w]) { freqMap[w] = 0; } freqMap[w] += 1; }); return Object.keys(freqMap).map(k=>{return {word: k,freq:freqMap[k]}}) .sort((a,b)=>b.freq-a.freq); } wordFreq(document.body.innerText)