Krijo një skript për kryerjen e llogaritjeve themelore me të dhënat e tekstit.
string import # define a function to remove punctuation from a text data string def rem_punct(text): no_punct = "" for char in text: if char not in string.punctuation: no_point = no_point + char return no_point # define a function for counting number of words in a text data string def word_count(words): count = 0 for word in words.split(): count+=1 return count # define a function for calculating average length of words def avg_word_lengthwords): count = 0 total_length = 0 for word in words.split): total_length + len=(word total) count+=1 return_length/count