<commit_before>import numpy as np


fsize = 10

class MemFunc():
    """Creates the specific membership function and is used to continue the process"""

    def __init__(self, name,specs=[], fMemFunc = False, stage0Op = False):

        #Get the specs of how to define the membership functions
        self.specs = specs
        self.memFuncName = name

        if fMemFunc and stage0Op:
            self.fMemFunc = getattr(self,fMemFunc)
            self.stage0Op = stage0Op

        self.memFunc = getattr(self,name)


    #The to_string function to show the name of the membership function
    # when trying to print
    def __repr__(self):
        return self.memberFuncName

    def forceTri(self,fSet):
        #Force it to be traingular
        mems, domain = zip(*fSet)

        maxIndex = np.argmax(mems)

        #Init the varibles, if something goes wrong everything is 0
        a,b,c = 0,0,0

        for i in range(maxIndex, len(mems)):
            if mems[i] == 0:
                c = domain[i]
                break;
            c = domain[i]

        for i in range(maxIndex,0,-1):
            if mems[i] == 0:
                a = domain[i]
            a = domain[i]

        b = domain[maxIndex]

        return [a,b,c]


    def normilize(self,input):
        # xi - min(X) / max(X) - min(X)
        pass

    def fMem(self,input):

        #Create a fuzzy number from the number that is passed in
        fNum = MemFunc("tri",[input - fsize / 2, input, (input + fsize / 2 )])

        #Collet the new fuzzy set thats created
        newFSet = []

        #That nice trick to be able to quicly add operators
        operators = {"mul": np.multiply,
                     "min": min}


        #Convert the operator string to the actual op
        # Weird thing to do but its a little safer than just letting the user
        # pass in a random op, at least for now
        op = operators[self.stage0Op]


        #Iterate throught the set
        for i in range(input - fsize // 2, (input + fsize // 2 ) + 1):
            newFSet.append((op(fNum.memFunc(i),self.fMemFunc(i)),i))


        return self.forceTri(newFSet)


<commit_msg>changing from forcive tri to standard type 2<commit_after>import numpy as np


fsize = 10

class MemFunc():
    """Creates the specific membership function and is used to continue the process"""

    def __init__(self, name,specs=[], fMemFunc = False, stage0Op = False):

        #Get the specs of how to define the membership functions
        self.specs = specs
        self.memFuncName = name

        if fMemFunc and stage0Op:
            self.fMemFunc = getattr(self,fMemFunc)
            self.stage0Op = stage0Op

        self.memFunc = getattr(self,name)


    #The to_string function to show the name of the membership function
    # when trying to print
    def __repr__(self):
        return self.memberFuncName

    def forceTri(self,fSet):
        #Force it to be traingular
        mems, domain = zip(*fSet)

        maxIndex = np.argmax(mems)

        #Init the varibles, if something goes wrong everything is 0
        a,b,c = 0,0,0

        for i in range(maxIndex, len(mems)):
            if mems[i] == 0:
                c = domain[i]
                break;
            c = domain[i]

        for i in range(maxIndex,0,-1):
            if mems[i] == 0:
                a = domain[i]
            a = domain[i]

        b = domain[maxIndex]

        return [a,b,c]



    def fMem(self,input):

        #Create a fuzzy number from the number that is passed in
        fNum = MemFunc("tri",[input - fsize / 2, input, (input + fsize / 2 )])

        #Collet the new fuzzy set thats created
        newFSet = []

        #That nice trick to be able to quicly add operators
        operators = {"mul": np.multiply,
                     "min": min}


        #Convert the operator string to the actual op
        # Weird thing to do but its a little safer than just letting the user
        # pass in a random op, at least for now
        op = operators[self.stage0Op]


        #Iterate throught the set
        for i in range(input - fsize // 2, (input + fsize // 2 ) + 1):
            newFSet.append((op(fNum.memFunc(i),self.fMemFunc(i)),i))


        return self.forceTri(newFSet)



{'fraction_non_alphanumeric': 0.09225700164744646, 'fraction_numerical': 0.009649329253942103, 'mean_word_length': 1.9069767441860466, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4570475', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1254, 'n_words': 446}