#!/usr/bin/python
# coding: latin-1

#------------------------------------------------------------------------------#
# Artificial Intelligence - Bayes Classification Algorithms                    #
# ============================================================================ #
# Organization: HE-Arc Engineering                                             #
# Developer(s): Etienne Frank                                                  #
#               Johan Chavaillaz                                               #
#                                                                              #
# Filename:     BayesClassification.py                                         #
# Version:      1.0                                                            #
#------------------------------------------------------------------------------#

#------------------------------------------------------------------------------#
#                                                                              #
#                               LIBRARIES IMPORT                               #
#                                                                              #
#------------------------------------------------------------------------------#

import sys

#------------------------------------------------------------------------------#
#                                                                              #
#                                   CLASSES                                    #
#                                                                              #
#------------------------------------------------------------------------------#


#------------------------------------------------------------------------------#
#                                                                              #
#                             UTILITIES FUNCTIONS                              #
#                                                                              #
#------------------------------------------------------------------------------#


#------------------------------------------------------------------------------#
#                                                                              #
#                               "MAIN" FUNCTION                                #
#                                                                              #
#------------------------------------------------------------------------------#

# If this is the main module, run this
if __name__ == '__main__':

    argsCount = len(sys.argv)
    argsIndex = 1
@@ -1658,32 +1658,704 @@
 ------------#%0A%0A%0A
+class DataFile:%0A%0A    def __init__(self, fileLine, isGood):%0A        %22%22%22%0A%0A        :rtype : object%0A        %22%22%22%0A        self.isGood = isGood%0A        self.fileLine = fileLine%0A        self.wordsCount = %7B%7D%0A%0A        self.words = fileLine.split()%0A%0A        for word in self.words:%0A            try:%0A                self.wordsCount%5Bword%5D += 1%0A            except KeyError:%0A                self.wordsCount%5Bword%5D = 1%0A%0A        self.sumWords = sum(self.wordsCount.values())%0A%0A    def __repr__(self):%0A        print(%22input : %22+self.fileLine)%0A        for key, val in self.wordsCount.items():%0A            print(str(key)+%22 %22+str(val))%0A%0A        print(str(self.sumWords))%0A        return %22%22%0A%0A%0A%0A%0A%0A%0A%0A
 #---------------
@@ -3261,12 +3261,140 @@
 rgsIndex = 1
+%0A%0A    toto = DataFile(%22coucou je suis une grosse bite et je vous emmerde Monsieur le PD n'ha n'ha n'aire%22, True)%0A    print(toto)

Add DataFile class to split words of a line and count it