<commit_before>from pymongo import MongoClient
from gensim import corpora, models, similarities
import gensim
import recom as r

db = MongoClient().projects.project 

class Project(object):

    def __init__(self, name = ''):
        self.bow = []
        self.name = name

    def add2bow(self, doc):
        docbow = r.entry2bow(doc)
        self.bow = [(e,f+h) for e,f in self.bow for g,h in docbow if e == g] 
        self.bow += [(g,h) for g,h in docbow for e in [e for e,f in self.bow] if  g != e ]
    
    def subfrombow(self, doc):
        pass

    def save(self):
        db.save(self)
        
    def load(self, name=''):
        p = db.find_one({'name': name})
        self.bow = p.bow
        self.name = p.name
        

    
        <commit_msg>working add2bow<commit_after>from pymongo import MongoClient
from gensim import corpora, models, similarities
import gensim
import recom as r

db = MongoClient().projects.project

class Project(object):

    def __init__(self, name = ''):
        self.bow = []
        self.name = name

    def add2bow(self, doc):
        docbow = r.entry2bow(doc)
        self.bow = [(e,f+h) for e,f in self.bow for g,h in docbow if e == g]
        self.bow += [(g,h) for g,h in docbow for e in [e for e,f in self.bow] if  g != e] if self.bow != [] else docbow
        
    def subfrombow(self, doc):
        pass

    def save(self):
        db.save(self)

    def load(self, name=''):
        p = db.find_one({'name': name})
        self.bow = p.bow
        self.name = p.name
{'fraction_non_alphanumeric': 0.12655737704918033, 'fraction_numerical': 0.003278688524590164, 'mean_word_length': 2.152892561983471, 'pattern_counts': {'":': 0, '<': 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': '700744', 'n_tokens_mistral': 541, 'n_tokens_neox': 518, 'n_words': 161}