1def fix_Plan(location):
2 letters_only = re.sub("[^a-zA-Z]", # Search for all non-letters
3 " ", # Replace all non-letters with spaces
4 location) # Column and row to search
5
6 words = letters_only.lower().split()
7 stops = set(stopwords.words("english"))
8 meaningful_words = [w for w in words if not w in stops]
9 return (" ".join(meaningful_words))
10
11col_Plan = fix_Plan(train["Plan"][0])
12num_responses = train["Plan"].size
13clean_Plan_responses = []
14
15for i in range(0,num_responses):
16 clean_Plan_responses.append(fix_Plan(train["Plan"][i]))