예제 #1
0
def thread_initVar(self_class, dataset, end_function):
    error = False
    msg = None

    try:
        info = Env.Info()
        env_obj = Env.setupEnv([__file__, sys.argv[0], os.getcwd()], info)
        self_class._env_obj = env_obj
        self_class._database = env_obj.Database
        self_class._wordsBag = env_obj.WordsBag
        self_class._Freq = env_obj.Frequency

        request = query.Request(env_obj.Database, env_obj.WordsBag,
                                env_obj.Frequency, env_obj.getMatrixFolder())
        request.load(dataset)
        self_class._request = request

    except Exception as e:
        error = True
        msg = e, format_exc()

    end_function(error=error, e=msg)
예제 #2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


#%%
import environment as Env
import sys, os

from querySystem.matrixOp import *
from querySystem.kmoy import *

import scipy.sparse as scs
import numpy as np
from random import randint

info = Env.Info()
'''
wordsBagInfo = Env.WordsBagInfo(ignore=True) 
info = Env.Info(wordsBagInfo=wordsBagInfo)
'''

env_obj = Env.setupEnv([__file__, sys.argv[0], os.getcwd()], info)
database = env_obj.Database
wordsBag = env_obj.WordsBag
Freq = env_obj.Frequency

def test():
    m, n = 10, 5
    A = np.zeros((m, n))

    nrand = randint(10, 30)