import setup setup.load() import manageFiles import recommender recommender.parameters['threshold'] = 0.2 recommender.parameters['selection-step'] = 3 recommender.parameters['key'] = 'codigo' recommender.parameters['inner-list'] = 'processo_seletivo' recommender.parameters['candidates-list'] = 'candidatos' root = '/home/mnf/reachr/projects/RecommenderSystem/test' manageFiles.parameters['path'] = root + '/support/vagas.json' recommender.parameters['input-jobs'] = manageFiles.read() manageFiles.parameters['path'] = root + '/support/similiars.json' recommender.parameters['input-similars'] = manageFiles.read() output = recommender.run() print(output) manageFiles.parameters['path'] = root + '/support/recommendation.json' manageFiles.write(output)
manageFiles.parameters['path'] = './support/vagas.json' inputList = manageFiles.read() # Le o arquivo corpus = [] for doc in inputList: # captura a descrição corpus.append(doc["desc"]) import preprocessor preprocessor.parameters['corpus'] = corpus X, Z = preprocessor.run() print(X) print(Z) output_file = [] for i in range(0, X.shape[0]): output = {"titulo": "", "texto": "", "tokens": []} output["titulo"] = 'Código: {} - Título: {}'.format( inputList[i]["codigo"], inputList[i]["titulo"]) output["texto"] = corpus[i] for j in range(0, X.shape[1]): if X[i, j] > 0: token = {"item": Z[j], "tfidf": X[i, j]} output['tokens'].append(token) output_file.append(output) manageFiles.parameters['path'] = './support/processed.json' manageFiles.write(output_file)
import setup setup.load() import manageFiles import processor import similarity root = '/home/mnf/reachr/projects/RecommenderSystem/test' processor.parameters['index'] = "codigo" processor.parameters['properties'] = ["desc", "titulo", "area_atuacao"] processor.parameters['current_path'] = root + "/support/vagas.json" processor.parameters['new_path'] = root + "/support/new_vaga.json" computed_similarity = processor.run() manageFiles.parameters['path'] = root + '/support/similiars.json' manageFiles.write(computed_similarity) #test jaccard import pandas as pd similarity.parameters['matrix'] = pd.DataFrame( [[1, 0, 1, 0, 1], [0, 0, 1, 1, 1]], columns=list('ABCDE')).transpose() print(similarity.run_jaccard())
def getAllJobs(): #response = requests.get(parameters['url']) #return response; obj = manageFiles.read(root + "/support/vagas.json") return manageFiles.write(obj)
def postJobRecommendation(data): return manageFiles.write(data)
def getJobToRecommend(): obj = manageFiles.read(root + "/support/new_vaga.json") return manageFiles.write(obj)
import setup setup.load() import manageFiles import score root = '/home/mnf/reachr/projects/RecommenderSystem/test' manageFiles.parameters['path'] = root + '/support/similiars.json' score.parameters['properties'] = ["desc", "titulo", "area_atuacao"] score.parameters['weights'] = {"desc": 0.5, "titulo": 0.4, "area_atuacao": 0.1} score.parameters['input'] = manageFiles.read() manageFiles.write(score.run())
import setup setup.load() import manageFiles expected_ret = {} # Teste Leitura ret = manageFiles.read('./support/vagas.json') print(ret) assert (isinstance(ret, list)), 'Erro ao abrir arquivo JSON' # Teste Gravação ret = manageFiles.write(ret) print(ret) assert (ret != 1), 'Erro ao gravar arquivo JSON'