diff --git a/data-computer/v1/lda.py b/data-computer/v1/lda.py index b694728..85e207e 100755 --- a/data-computer/v1/lda.py +++ b/data-computer/v1/lda.py @@ -11,39 +11,16 @@ num_topics = 5 # Number of topics num_iterations=100 # "epochs" ====> shall it depends of number of docs ? number of topics ? -stopwords_lists = ['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', "you're", "you've", "you'll", "you'd", - 'your', 'yours', 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', "she's", 'her', 'hers', - 'herself', 'it', "it's", 'its', 'itself', 'they', 'them', 'their', 'theirs', 'themselves', 'what', 'which', - 'who', 'whom', 'this', 'that', "that'll", 'these', 'those', 'am', 'is', 'are', 'was', 'were', 'be', 'been', - 'being', 'have', 'has', 'had', 'having', 'do', 'does', 'did', 'doing', 'a', 'an', 'the', 'and', 'but', 'if', - 'or', 'because', 'as', 'until', 'while', 'of', 'at', 'by', 'for', 'with', 'about', 'against', 'between', 'into', - 'through', 'during', 'before', 'after', 'above', 'below', 'to', 'from', 'up', 'down', 'in', 'out', 'on', 'off', - 'over', 'under', 'again', 'further', 'then', 'once', 'here', 'there', 'when', 'where', 'why', 'how', 'all', 'any', - 'both', 'each', 'few', 'more', 'most', 'other', 'some', 'such', 'no', 'nor', 'not', 'only', 'own', 'same', 'so', - 'than', 'too', 'very', 's', 't', 'can', 'will', 'just', 'don', "don't", 'should', "should've", 'now', 'd', 'll', - 'm', 'o', 're', 've', 'y', 'ain', 'aren', "aren't", 'couldn', "couldn't", 'didn', "didn't", 'doesn', "doesn't", - 'hadn', "hadn't", 'hasn', "hasn't", 'haven', "haven't", 'isn', "isn't", 'ma', 'mightn', "mightn't", 'mustn', - "mustn't", 'needn', "needn't", 'shan', "shan't", 'shouldn', "shouldn't", 'wasn', "wasn't", 'weren', "weren't", - 'won', "won't", 'wouldn', "wouldn't", 'au', 'aux', 'avec', 'ce', 'ces', 'dans', 'de', 'des', 'du', 'elle', 'en', - 'et', 'eux', 'il', 'ils', 'je', 'la', 'le', 'les', 'leur', 'lui', 'ma', 'mais', 'me', 'meme', 'mes', 'moi', 'mon', - 'ne', 'nos', 'notre', 'nous', 'on', 'ou', 'par', 'pas', 'pour', 'qu', 'que', 'qui', 'sa', 'se', 'ses', 'son', 'sur', - 'ta', 'te', 'tes', 'toi', 'ton', 'tu', 'un', 'une', 'vos', 'votre', 'vous', 'c', 'd', 'j', 'l', 'm', 'n', 's', 't', - 'y', 'ete', 'etee', 'etees', 'etes', 'etant', 'etante', 'etants', 'etantes', 'suis', 'es', 'est', 'sommes', 'etes', 'sont', - 'serai', 'seras', 'sera', 'serons', 'serez', 'seront', 'serais', 'serait', 'serions', 'seriez', 'seraient', 'etais', 'etait', - 'etions', 'etiez', 'etaient', 'fus', 'fut', 'fumes', 'futes', 'furent', 'sois', 'soit', 'soyons', 'soyez', 'soient', 'fusse', - 'fusses', 'fut', 'fussions', 'fussiez', 'fussent', 'ayant', 'ayante', 'ayantes', 'ayants', 'eu', 'eue', 'eues', 'eus', 'ai', 'as', - 'avons', 'avez', 'ont', 'aurai', 'auras', 'aura', 'aurons', 'aurez', 'auront', 'aurais', 'aurait', 'aurions', 'auriez', 'auraient', - 'avais', 'avait', 'avions', 'aviez', 'avaient', 'eut', 'eumes', 'eutes', 'eurent', 'aie', 'aies', 'ait', 'ayons', 'ayez', 'aient', - 'eusse', 'eusses', 'eut', 'eussions', 'eussiez', 'eussent'] +#stopwords +with open('./v1/stopwords/en.json','r') as f_in: + stopwords =json.load(f_in) -stopwords = stopwords_lists - +#normalize text def remove_accents(text): normalized_text = unicodedata.normalize("NFD", text) text_with_no_accent = re.sub("[\u0300-\u036f]", "", normalized_text) return text_with_no_accent - def uniformize(text): # del accents text = remove_accents(text) @@ -54,7 +31,7 @@ return text.lower() - +#tokenize def tokenize(text): tokens = [word for word in text.replace("'"," ").split() if word not in stopwords and len(word)>2] return tokens @@ -70,7 +47,7 @@ # training LDA texts = [tokenize(uniformize(line["value"])) for line in all_data] -dictionary = corpora.Dictionary(texts) # Dictionary from texts : corpus is [ [(num_token,numb_token),...] , [....] ]. The list represent docs of corpus +dictionary = corpora.Dictionary(texts) # Create a tf dictionary, but replace text by an id : [ [(id_token,numb_token),...] , [....] ]. The list represent docs of corpus corpus = [dictionary.doc2bow(text) for text in texts] lda_model = models.LdaModel(corpus, num_topics=num_topics, id2word=dictionary,iterations=num_iterations) diff --git a/data-computer/v1/stopwords/en.json b/data-computer/v1/stopwords/en.json new file mode 100644 index 0000000..af7c866 --- /dev/null +++ b/data-computer/v1/stopwords/en.json @@ -0,0 +1 @@ +["able", "about", "above", "abroad", "according", "accordingly", "across", "actually", "adj", "after", "afterwards", "again", "against", "ago", "ahead", "ain", "all", "allow", "allows", "almost", "alone", "along", "alongside", "already", "also", "although", "always", "amid", "amidst", "among", "amongst", "and", "another", "any", "anybody", "anyhow", "anyone", "anything", "anyway", "anyways", "anywhere", "apart", "appear", "appreciate", "appropriate", "are", "aren", "around", "aside", "ask", "asking", "associated", "available", "away", "awfully", "back", "backward", "backwards", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "begin", "behind", "being", "believe", "below", "beside", "besides", "best", "better", "between", "beyond", "both", "brief", "but", "came", "can", "cannot", "cant", "caption", "cause", "causes", "certain", "certainly", "changes", "clearly", "co", "com", "come", "comes", "concerning", "consequently", "consider", "considering", "contain", "containing", "contains", "corresponding", "could", "couldn", "course", "currently", "dare", "daren", "definitely", "described", "despite", "did", "didn", "different", "directly", "does", "doesn", "doing", "done", "don", "down", "downwards", "during", "each", "edu", "eight", "eighty", "either", "else", "elsewhere", "end", "ending", "enough", "entirely", "especially", "etc", "even", "ever", "evermore", "every", "everybody", "everyone", "everything", "everywhere", "exactly", "example", "except", "fairly", "far", "farther", "few", "fewer", "fifth", "first", "five", "followed", "following", "follows", "for", "forever", "former", "formerly", "forth", "forward", "found", "four", "from", "further", "furthermore", "get", "gets", "getting", "given", "gives", "goes", "going", "gone", "got", "gotten", "greetings", "had", "hadn", "half", "happens", "hardly", "has", "hasn", "have", "haven", "having", "hello", "help", "hence", "her", "here", "hereafter", "hereby", "herein", "hereupon", "hers", "herself", "him", "himself", "his", "hither", "hopefully", "how", "howbeit", "however", "hundred", "ignored", "immediate", "inasmuch", "inc", "inc", "indeed", "indicate", "indicated", "indicates", "inner", "inside", "insofar", "instead", "into", "inward", "isn", "its", "itself", "just", "keep", "keeps", "kept", "know", "known", "knows", "last", "lately", "later", "latter", "latterly", "least", "less", "lest", "let", "like", "liked", "likely", "likewise", "little", "look", "looking", "looks", "low", "lower", "ltd", "made", "mainly", "make", "makes", "many", "may", "maybe", "mayn", "mean", "meantime", "meanwhile", "merely", "might", "mightn", "mine", "minus", "miss", "more", "moreover", "most", "mostly", "mrs", "much", "must", "mustn", "myself", "name", "namely", "near", "nearly", "necessary", "need", "needn", "needs", "neither", "never", "neverf", "neverless", "nevertheless", "new", "next", "nine", "ninety", "nobody", "non", "none", "nonetheless", "noone", "noone", "nor", "normally", "not", "nothing", "notwithstanding", "novel", "now", "nowhere", "obviously", "off", "often", "okay", "old", "once", "one", "ones", "only", "onto", "opposite", "other", "others", "otherwise", "ought", "oughtn", "our", "ours", "ourselves", "out", "outside", "over", "overall", "own", "particular", "particularly", "past", "per", "perhaps", "placed", "please", "plus", "possible", "presumably", "probably", "provided", "provides", "que", "quite", "rather", "really", "reasonably", "recent", "recently", "regarding", "regardless", "regards", "relatively", "respectively", "right", "round", "said", "same", "saw", "say", "saying", "says", "second", "secondly", "see", "seeing", "seem", "seemed", "seeming", "seems", "seen", "self", "selves", "sensible", "sent", "serious", "seriously", "seven", "several", "shall", "shan", "she", "should", "shouldn", "since", "six", "some", "somebody", "someday", "somehow", "someone", "something", "sometime", "sometimes", "somewhat", "somewhere", "soon", "sorry", "specified", "specify", "specifying", "still", "sub", "such", "sup", "sure", "take", "taken", "taking", "tell", "tends", "than", "thank", "thanks", "thanx", "that", "thats", "the", "their", "theirs", "them", "themselves", "then", "thence", "there", "thereafter", "thereby", "therefore", "therein", "theres", "thereupon", "these", "they", "thing", "things", "think", "third", "thirty", "this", "thorough", "thoroughly", "those", "though", "three", "through", "throughout", "thru", "thus", "till", "together", "too", "took", "toward", "towards", "tried", "tries", "truly", "try", "trying", "twice", "two", "under", "underneath", "undoing", "unfortunately", "unless", "unlike", "unlikely", "until", "unto", "upon", "upwards", "use", "used", "useful", "uses", "using", "usually", "value", "various", "versus", "very", "via", "viz", "want", "wants", "was", "wasn", "way", "welcome", "well", "went", "were", "weren", "what", "whatever", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby", "wherein", "whereupon", "wherever", "whether", "which", "whichever", "while", "whilst", "whither", "who", "whoever", "whole", "whom", "whomever", "whose", "why", "will", "willing", "wish", "with", "within", "without", "wonder", "won", "would", "wouldn", "yes", "yet", "you", "your", "yours", "yourself", "yourselves", "zero", "uucp", "www", "amount", "bill", "bottom", "call", "computer", "con", "couldnt", "cry", "describe", "detail", "due", "eleven", "empty", "fifteen", "fifty", "fill", "find", "fire", "forty", "front", "full", "give", "hasnt", "herse", "himse", "interest", "itse\u201d", "mill", "move", "myse\u201d", "part", "put", "show", "side", "sincere", "sixty", "system", "ten", "thick", "thin", "top", "twelve", "twenty", "abst", "accordance", "act", "added", "adopted", "affected", "affecting", "affects", "announce", "anymore", "apparently", "approximately", "arent", "arise", "auth", "beginning", "beginnings", "begins", "biol", "briefly", "date", "effect", "etal", "fix", "gave", "giving", "heres", "hes", "hid", "home", "immediately", "importance", "important", "index", "information", "invention", "itd", "keys", "largely", "lets", "line", "means", "million", "mug", "nay", "necessarily", "nos", "noted", "obtain", "obtained", "omitted", "ord", "owing", "page", "pages", "poorly", "possibly", "potentially", "predominantly", "present", "previously", "primarily", "promptly", "proud", "quickly", "ran", "readily", "ref", "refs", "related", "research", "resulted", "resulting", "results", "run", "sec", "section", "shed", "shes", "showed", "shown", "showns", "shows", "significant", "significantly", "similar", "similarly", "slightly", "somethan", "specifically", "state", "states", "stop", "strongly", "substantially", "successfully", "sufficiently", "suggest", "thered", "thereof", "therere", "thereto", "theyd", "theyre", "thou", "thoughh", "thousand", "throug", "til", "tip", "ups", "usefully", "usefulness", "vol", "vols", "wed", "whats", "wheres", "whim", "whod", "whos", "widely", "words", "world", "youd", "youre"] \ No newline at end of file diff --git a/data-computer/v1/stopwords/fr.json b/data-computer/v1/stopwords/fr.json new file mode 100644 index 0000000..e86310d --- /dev/null +++ b/data-computer/v1/stopwords/fr.json @@ -0,0 +1 @@ +["abord", "afin", "aie", "ainsi", "allaient", "allo", "allo", "allons", "apres", "assez", "attendu", "aucun", "aucune", "aujourd", "auquel", "aura", "auront", "aussi", "autre", "autres", "aux", "auxquelles", "auxquels", "avaient", "avais", "avait", "avant", "avec", "avoir", "ayant", "bah", "beaucoup", "bien", "bigre", "boum", "bravo", "brrr", "car", "ceci", "cela", "celle", "celleci", "cellela", "celles", "cellesci", "cellesla", "celui", "celuici", "celuila", "cent", "cependant", "certain", "certaine", "certaines", "certains", "certes", "ces", "cet", "cette", "ceux", "ceuxci", "ceuxla", "chacun", "chaque", "cher", "chere", "cheres", "chers", "chez", "chiche", "chut", "cinq", "cinquantaine", "cinquante", "cinquantieme", "cinquieme", "clac", "clic", "combien", "comme", "comment", "compris", "concernant", "contre", "couic", "crac", "dans", "debout", "dedans", "dehors", "dela", "depuis", "derriere", "des", "des", "desormais", "desquelles", "desquels", "dessous", "dessus", "deux", "deuxieme", "deuxiemement", "devant", "devers", "devra", "different", "differente", "differentes", "differents", "dire", "divers", "diverse", "diverses", "dix", "dixhuit", "dixieme", "dixneuf", "dixsept", "doit", "doivent", "donc", "dont", "douze", "douzieme", "dring", "duquel", "durant", "effet", "elle", "ellememe", "elles", "ellesmemes", "encore", "entre", "envers", "environ", "est", "etant", "etaient", "etais", "etait", "etant", "etc", "ete", "etre", "etre", "euh", "eux", "euxmemes", "excepte", "facon", "fais", "faisaient", "faisant", "fait", "feront", "flac", "floc", "font", "gens", "hein", "helas", "hem", "hep", "hola", "hop", "hormis", "hors", "hou", "houp", "hue", "hui", "huit", "huitieme", "hum", "hurrah", "ils", "importe", "jusqu", "jusque", "laquelle", "las", "lequel", "les", "les", "lesquelles", "lesquels", "leur", "leurs", "longtemps", "lorsque", "lui", "luimeme", "maint", "mais", "malgre", "meme", "memes", "merci", "mes", "mien", "mienne", "miennes", "miens", "mille", "mince", "moi", "moimeme", "moins", "mon", "moyennant", "neanmoins", "neuf", "neuvieme", "nombreuses", "nombreux", "non", "nos", "notre", "notre", "notres", "nous", "nousmemes", "nul", "ohe", "ole", "olle", "ont", "onze", "onzieme", "ore", "ouf", "ouias", "oust", "ouste", "outre", "paf", "pan", "par", "parmi", "partant", "particulier", "particuliere", "particulierement", "pas", "passe", "pendant", "personne", "peu", "peut", "peuvent", "peux", "pff", "pfft", "pfut", "pif", "plein", "plouf", "plus", "plusieurs", "plutot", "pouah", "pour", "pourquoi", "premier", "premiere", "premierement", "pres", "proche", "psitt", "puisque", "quand", "quant", "quanta", "quantasoi", "quarante", "quatorze", "quatre", "quatrevingt", "quatrieme", "quatriemement", "que", "quel", "quelconque", "quelle", "quelles", "quelque", "quelques", "quelqu", "quels", "qui", "quiconque", "quinze", "quoi", "quoique", "revoici", "revoila", "rien", "sacrebleu", "sans", "sapristi", "sauf", "seize", "selon", "sept", "septieme", "sera", "seront", "ses", "sien", "sienne", "siennes", "siens", "sinon", "six", "sixieme", "soi", "soimeme", "soit", "soixante", "son", "sont", "sous", "stop", "suis", "suivant", "sur", "surtout", "tac", "tant", "tel", "telle", "tellement", "telles", "tels", "tenant", "tes", "tic", "tien", "tienne", "tiennes", "tiens", "toc", "toi", "toimeme", "ton", "touchant", "toujours", "tous", "tout", "toute", "toutes", "treize", "trente", "tres", "trois", "troisieme", "troisiemement", "trop", "tsoin", "tsouin", "une", "unes", "uns", "vais", "vas", "vers", "via", "vif", "vifs", "vingt", "vivat", "vive", "vives", "vlan", "voici", "voila", "vont", "vos", "votre", "votre", "votres", "vous", "vousmemes", "zut", "alors", "aucuns", "bon", "devrait", "dos", "droite", "debut", "essai", "faites", "fois", "force", "haut", "ici", "juste", "maintenant", "mine", "mot", "nommes", "nouveaux", "parce", "parole", "personnes", "piece", "plupart", "seulement", "soyez", "sujet", "tandis", "valeur", "voie", "voient", "etat", "etions"] \ No newline at end of file