I have this code but it doesn't seem to work.
Thanks
class textanalysis(object): Class Analysis(object): def _init_(self, text): #enlever la ponctuation formater = text.replace(',','').replace('.','').replace('!','').replace('?','') #transformer en minuscule formater = formater.lower() self.fmt = formater def freqall(self): mots = self.fmt.split(' ') #creer un dictionnaire dico = {} for word in set(mots): #set est utiliser pour qu'il n'y ait pas de repetitions dico[word] = self.fmt.count(word) return dico def freq0f(self, word): freqdico = self.freqall() if word in freqdico: return frqdico[word] else: return 0If I enter a text, I receive an error:
Error:" TypeError: textanalysis() takes no arguments "
Anyone can help me fix the error?Thanks
Output:
buran write May-12-2024, 06:26 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.