text-clustering/text_clustering.py
def process_text(text, stem=True):
    """ Tokenize text and stem words removing punctuation """
    text = text.translate(string.punctuation)
    tokens = word_tokenize(text)

    if stem:
        stemmer = PorterStemmer()
        tokens = [stemmer.stem(t) for t in tokens]

    return tokens
 Tokenize text and stem words removing punctuation 
Tokenize text and stem words removing punctuation
Tokenize text and stem words removing punctuation
def process_text(text, stem=True):
    text = text.translate(string.punctuation)
    tokens = word_tokenize(text)
    if stem:
        stemmer = PorterStemmer()
        tokens = [stemmer.stem(t) for t in tokens]
    return tokens
def process_text ( text , stem = True ) : text = text . translate ( string . punctuation ) tokens = word_tokenize ( text ) if stem : stemmer = PorterStemmer ( ) tokens = [ stemmer . stem ( t ) for t in tokens ] return tokens
Tokenize text and stem words removing punctuation
Tokenize text and stem words removing punctuation
""" Tokenize text and stem words removing punctuation """
text
stem