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
# Reuters-21578 dataset downloader and parser | |
# | |
# Author: Eustache Diemert <[email protected]> | |
# http://scikit-learn.org/stable/auto_examples/applications/plot_out_of_core_classification.html | |
# | |
# Modified by @herrfz, get pandas DataFrame from the orig SGML | |
# License: BSD 3 clause | |
from __future__ import print_function |
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
from nltk import word_tokenize | |
from nltk.corpus import reuters | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from nltk.stem.porter import PorterStemmer | |
import re | |
from nltk.corpus import stopwords | |
cachedStopWords = stopwords.words("english") | |
def tokenize(text): |
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
import os | |
import time | |
import string | |
import pickle | |
from operator import itemgetter | |
from nltk.corpus import stopwords as sw | |
from nltk.corpus import wordnet as wn | |
from nltk import wordpunct_tokenize |