def addFile(path, properties, index): manageFiles.parameters['path'] = path inputList = manageFiles.read() idx = getProp(index, inputList) corpus = {} for property in properties: corpus[property] = getProp(property, inputList) return idx, corpus, len(inputList)
import manageFiles import processor import score import recommender processor.parameters['index'] = "codigo" processor.parameters['properties'] = ["desc","titulo","area_atuacao"] processor.parameters['new_path'] = reachrAPI.getJobToRecommend() processor.parameters['current_path'] = reachrAPI.getAllJobs() print(processor.parameters['new_path']) print(processor.parameters['current_path']) score.parameters['properties'] = ["desc","titulo","area_atuacao"] score.parameters['weights'] = {"desc":0.3, "titulo":0.6, "area_atuacao":0.1} score.parameters['input'] = processor.run() recommender.parameters['threshold'] = 0.2 recommender.parameters['selection-step'] = 2 recommender.parameters['key'] = processor.parameters['index'] recommender.parameters['inner-list'] = 'processo_seletivo' recommender.parameters['candidates-list'] = 'candidatos' recommender.parameters['input-jobs'] = manageFiles.read(processor.parameters['current_path']) recommender.parameters['input-similars'] = score.run() ret = reachrAPI.postJobRecommendation(recommender.run()) print(ret)
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)
import setup setup.load() import manageFiles 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]}
def getAllJobs(): #response = requests.get(parameters['url']) #return response; obj = manageFiles.read(root + "/support/vagas.json") return manageFiles.write(obj)
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'