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

import nltk

import pandas as pd

import re

train_df = pd.read_csv('/kaggle/input/commonlitreadabilityprize/train.csv')
train_df.drop(train_df[(train_df.target == 0) & (train_df.standard_error == 0)].index, inplace=True)
train_df.reset_index(drop=True, inplace=True)
test_df = pd.read_csv('/kaggle/input/commonlitreadabilityprize/test.csv')
submission_df = pd.read_csv('/kaggle/input/commonlitreadabilityprize/sample_submission.csv')

excerpt1 = train_df['excerpt'].min()

e = re.sub('[^a-zA-Z]', ' ', excerpt1)
e = e.lower()
e = nltk.word_tokenize(e)
e = [word for word in e if not word in set(stopwords.words('english'))]
lemma = nltk.WordNetLemmatizer()
e = [lemma.lemmatize(word) for word in e]
e = ' '.join(e)
print(e)