<commit_before>from database.mysql import Database


class Bulk(Database):
    def __init__(self,config,language):
        Database.__init__(self,config)
        self.connect()
        self.setLanguages()
        self.setPosses()
        self.setProperties()
        self.setEntryRelations()
        self.setSenseRelations()

        self.language_id = self.languages[language]
        self.keymap = {
            "ontolex:LexicalEntry": "",
            "lexinfo:partOfSpeech": "",
            "lexinfo:abbreviationFor": "",
            "lexinfo:initialismFor": "",
            "lexinfo:acronymFor": "",
            "lexinfo:hypernym": "",
            "ontolex:reference": "",
            "lexinfo:pertainsTo": "" }
        self.pos_id = None


    def setRow(self,row):
        for key in self.keymap:
            self.keymap[key] = self.__validateRowInput(row,key)

        if not self.keymap["ontolex:LexicalEntry"] or not self.keymap["lexinfo:partOfSpeech"] :
            raise ValueError("error adding row: lexicalEntry and partOfSpeech are required")

        if self.keymap["lexinfo:partOfSpeech"] not in self.posses:
            raise ValueError("error adding row: invalid partOfSpeech: " + self.keymap["lexinfo:partOfSpeech"])

        self.pos_id = self.posses[self.keymap["lexinfo:partOfSpeech"]]

    def storeRow(self):
        self.__setLexicalEntryID()
        self.__setContractions()

        # senses
        self.__setReference()
        self.__setHypernym()
        self.__setPertainsTo()<commit_msg>bulk, fix problem with not resetting lexicalSenseID<commit_after>from database.mysql import Database


class Bulk(Database):
    def __init__(self,config,language):
        Database.__init__(self,config)
        self.connect()
        self.setLanguages()
        self.setPosses()
        self.setProperties()
        self.setEntryRelations()
        self.setSenseRelations()

        self.language_id = self.languages[language]
        self.keymap = {
            "ontolex:LexicalEntry": "",
            "lexinfo:partOfSpeech": "",
            "lexinfo:abbreviationFor": "",
            "lexinfo:initialismFor": "",
            "lexinfo:acronymFor": "",
            "lexinfo:hypernym": "",
            "ontolex:reference": "",
            "lexinfo:pertainsTo": "" }
        self.pos_id = None
        self.lexicalEntryID = None
        self.lexicalSenseID = None

    def setRow(self,row):
        """ Validates and sets keymap for provided row."""
        for key in self.keymap:
            self.keymap[key] = self.__validateRowInput(row,key)

        if not self.keymap["ontolex:LexicalEntry"] or not self.keymap["lexinfo:partOfSpeech"] :
            raise ValueError("error adding row: lexicalEntry and partOfSpeech are required")

        if self.keymap["lexinfo:partOfSpeech"] not in self.posses:
            raise ValueError("error adding row: invalid partOfSpeech: " + self.keymap["lexinfo:partOfSpeech"])

        self.pos_id = self.posses[self.keymap["lexinfo:partOfSpeech"]]
        self.lexicalEntryID = None
        self.lexicalSenseID = None

    def storeRow(self):
        self.__setLexicalEntryID()
        self.__setContractions()

        # senses
        self.__setReference()
        self.__setHypernym()
        #self.__setPertainsTo()
{'fraction_non_alphanumeric': 0.11687519072322246, 'fraction_numerical': 0.0, 'mean_word_length': 2.498399146211313, 'pattern_counts': {'":': 16, '<': 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': '5852969', 'n_tokens_mistral': 1001, 'n_tokens_neox': 976, 'n_words': 166}