text_plain_output_1.png image_output_1.png
from nltk.corpus import stopwords

import nltk

import re

nltk.download('punkt')
nltk.download('stopwords')
nltk.download('averaged_perceptron_tagger')
nltk.download('wordnet')

def Lower(text):
    return text.lower()

def Tokenisation(text):
    return nltk.word_tokenize(text)

test = Tokenisation('Hello there. How! are you ? this super notebook is about nlp')

Stpwrd_List = stopwords.words('english')

def StopWordsAlphaText(tokenized_text):
    filtred_text = []
    for word in tokenized_text:
        word = word.strip('!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')
        val = re.search('^[a-zA-Z][a-zA-Z0-9]*$', word)
        if word not in Stpwrd_List and val is not None:
            filtred_text.append(word)
    return filtred_text

StopWordsAlphaText(test)