<commit_before>import nltk
import csv

class YouTubeParser():

    def __init__(self):
        pass

    def parse(self, text):
        allWords = nltk.tokenize.word_tokenize(text)
        allWordDist = nltk.FreqDist(w.lower() for w in allWords)

        stopwords = nltk.corpus.stopwords.words('english')
        allWordExceptStopDist = nltk.FreqDist(w.lower() for w in allWords if w not in stopwords)

        mostCommon = allWordExceptStopDist.most_common(50)

        for word, occurrences in mostCommon:
            print(word)<commit_msg>Strip punctuation<commit_after>import nltk
import csv
from nltk.tokenize import RegexpTokenizer


class YouTubeParser():

    def __init__(self):
        pass

    def parse(self, text):
        tokenizer = RegexpTokenizer(r'\w+')
        allWords = tokenizer.tokenize(text)
        allWordDist = nltk.FreqDist(w.lower() for w in allWords)

        stopwords = nltk.corpus.stopwords.words('english')
        allWordExceptStopDist = nltk.FreqDist(w.lower() for w in allWords if w not in stopwords)

        mostCommon = allWordExceptStopDist.most_common(50)

        for word, occurrences in mostCommon:
            print(word)
{'fraction_non_alphanumeric': 0.08803418803418804, 'fraction_numerical': 0.003418803418803419, 'mean_word_length': 2.9965870307167237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4125368', 'n_tokens_mistral': 394, 'n_tokens_neox': 364, 'n_words': 88}