basefunctions/classifier.py
def categorize_rawdata(self, data, purpose):
        '''function coordinating the whole classification process'''

        if purpose == 'cashbook':#filter empty category rows in cashbook and add categories
            data.loc[data['cat'].isna(), 'cat'] = data[data['cat'].isna()]['text'].apply(self.fixedvalue_categorizer)
        else:
            data["cat"] = data['text'].apply(self.fixedvalue_categorizer)  ## do categorization based on search words

        #adaptions for personal needs
        data.loc[(data['cat'] == 'Einzahlung Gemein-\nschaftkonto')&(data['val'] > 0), 'cat'] = self.langdict['acctransfer'][1]
        data.loc[(data['cat'] == self.langdict['acctransfer'][0])&(data['val'] > 0), 'cat'] = self.langdict['acctransfer'][1]
        data = self.assign_maincats(data) # assign main categories to every subcategory

        #do machine classification if unclear categories exist after fixed-value categorization
        if data['cat'].str.contains(self.langdict['noncategory'][0]).any():
            data = self.machineclassifier.machine_categorizer(data, self.langdict['noncategory'][0])
        else:
            pass

        return data
function coordinating the whole classification process
function coordinating the whole classification process
function coordinating the whole classification process
def categorize_rawdata(self, data, purpose):
        if purpose == 'cashbook':
            data.loc[data['cat'].isna(), 'cat'] = data[data['cat'].isna()]['text'].apply(self.fixedvalue_categorizer)
        else:
            data["cat"] = data['text'].apply(self.fixedvalue_categorizer)  
        data.loc[(data['cat'] == 'Einzahlung Gemein-\nschaftkonto')&(data['val'] > 0), 'cat'] = self.langdict['acctransfer'][1]
        data.loc[(data['cat'] == self.langdict['acctransfer'][0])&(data['val'] > 0), 'cat'] = self.langdict['acctransfer'][1]
        data = self.assign_maincats(data) 
        if data['cat'].str.contains(self.langdict['noncategory'][0]).any():
            data = self.machineclassifier.machine_categorizer(data, self.langdict['noncategory'][0])
        else:
            pass
        return data
def categorize_rawdata ( self , data , purpose ) : if purpose == 'cashbook' : data . loc [ data [ 'cat' ] . isna ( ) , 'cat' ] = data [ data [ 'cat' ] . isna ( ) ] [ 'text' ] . apply ( self . fixedvalue_categorizer ) else : data [ "cat" ] = data [ 'text' ] . apply ( self . fixedvalue_categorizer ) data . loc [ ( data [ 'cat' ] == 'Einzahlung Gemein-\nschaftkonto' ) & ( data [ 'val' ] > 0 ) , 'cat' ] = self . langdict [ 'acctransfer' ] [ 1 ] data . loc [ ( data [ 'cat' ] == self . langdict [ 'acctransfer' ] [ 0 ] ) & ( data [ 'val' ] > 0 ) , 'cat' ] = self . langdict [ 'acctransfer' ] [ 1 ] data = self . assign_maincats ( data ) if data [ 'cat' ] . str . contains ( self . langdict [ 'noncategory' ] [ 0 ] ) . any ( ) : data = self . machineclassifier . machine_categorizer ( data , self . langdict [ 'noncategory' ] [ 0 ] ) else : pass return data
function coordinating the whole classification process
function coordinating the whole classification process
'''function coordinating the whole classification process''' #filter empty category rows in cashbook and add categories ## do categorization based on search words #adaptions for personal needs # assign main categories to every subcategory #do machine classification if unclear categories exist after fixed-value categorization
self
data
purpose