Prompt: In python language, write a function that give that find the total number of alphanumeric characters in the original input text, the total number of unique numeric characters in the original...



Prompt:
In python language, write a function that give that find the total number of alphanumeric characters in the original input text, the total number of unique numeric characters in the original input text, remove all non alphabetic characters, convert all text to lowercase, the total number of words after preprocessing, the total number of unique words after preprocessing.



code:


sampleText = "The university was built in 1854.
The university`s enrollment is approximately 19000 undergraduate students and 8600 graduate students.[5]"




# Your function should return 4 variables: alphaNumCount, uniqueNumCount, wordCount, uniqueWordCount



def textPreprocessing(textString):



alphaNumCount, uniqueNumCount, wordCount, uniqueWordCount = (0, 0, 0, 0)


#YOUR CODE HERE:




def test(sampleText):



alphaNumCount, uniqueNumCount, wordCount, uniqueWordCount = textPreprocessing(sampleText)

print("Total number of alphanumeric characters in the original input text: ", alphaNumCount)

print("Total number of unique numeric characters in the original input text: ", uniqueNumCount)

print("Total number of words after preprocessing", wordCount)

print("Total number of unique words after preprocessing", uniqueWordCount)



test(sampleText)





Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here