Example #1
0
	def __init__(self, DocPath=None, text=None):
		if text is None:
			self.DocPath = DocPath
			self.DocText = DocReader.Reader(self.DocPath)
			tfres = WordCount.get_term_one_list(WordCount.map(self.DocText))
			self.DocTermList = tfres
			self.ParseResume()
		else:
			self.DocText = text
			self.DocTermList = WordCount.get_term_one_list(WordCount.map(self.DocText))
			print(self.DocTermList)
			self.ParseText()
			self.ParseResume()
Example #2
0
 def __init__(self, DocPath=None, text=None):
     if text is None:
         self.DocPath = DocPath
         self.DocText = DocReader.Reader(self.DocPath)
         tfres = WordCount.get_term_one_list(WordCount.map(self.DocText))
         self.DocTermList = tfres
         self.ParseResume()
     else:
         self.DocText = text
         self.DocTermList = WordCount.get_term_one_list(
             WordCount.map(self.DocText))
         print(self.DocTermList)
         self.ParseText()
         self.ParseResume()
Example #3
0
	def getSpecializationUserListByText(self):    #сопоставляет специализацию и ЛЮБОЙ ТЕКСТ
		i = 0
		self.specializationIdList = []
		specdict = self.ProceedSpecList(self.SpecializationDict)

		tfrestmp = WordCount.get_term_one_list(WordCount.map(self.tmptext))[0]
		# langs = self.documents.DocProgLangs
		self.progLangs = self.documents.DocProgLangs
		for val in tfrestmp:
			#self.progLangs |= Document.GetProgLangsFromText(val[0])
			res = self.getSpecialization(specdict, val[0])
			if res is not None:
				i += 1
				self.specializationIdList.append(res)
				if i > 100: break
		self.GetImportantSpecializations(self.specializationIdList)
Example #4
0
def user(request, _id):

	template = loader.get_template('suggesting_system/user.html')
	FindedUser = User.objects.get(id = _id)
	t1 = time.time()
	hhapi = hhAPI(FindedUser)

	info = hhapi.CreateQuery(GitHubAPI.GetLanguages(FindedUser.gitHub))

	textList = []
	doctitleList = []
	for vac in info:
		textList.append(vac.description)
		doctitleList.append(vac.vacancy_Id)
		# print(vac.description + ' ' + vac.name)

	allDict = hhapi.docdict
	i = 0
	BIGTextData = ''
	for i in range(len(textList)):
		BIGTextData += textList[i]
		allDict.update(dict(zip([doctitleList[i]], [textList[i]])))
		i += 1

	# print(allDict)
	vacancyTerms = WordCount.get_term_one_list(WordCount.map(BIGTextData))
	print("vacancy terms = ")
	print(vacancyTerms[1])
	print("hhDATA = ")
	print(hhapi.documents.DocTermList[1])
	print("terms = ")
	test = dict(list(hhapi.documents.DocTermList[1].items()) +  list(vacancyTerms[1].items()))
	print("test = ")
	print (test)

	documentWords, documentTitles, allwords = NMF.ConvertData(allDict, test)
	print("doc worlds = ")
	print(documentWords)
	tmp = NMF.CreateMatrix(allwords, documentWords)
	# print(tmp[0])
	# print(tmp[1])
	test = NMF.calculate(tmp[0])

	print(documentTitles)
	WeightMatrix = test[0]
	HeightMatrix = test[1]
	topp, pn, res = NMF.prepareToVis(WeightMatrix, HeightMatrix, documentTitles, tmp[1])
	print("fin res" + str(res))
	finalres = []
	a = "ssss"
	for val in res:
		try:
			idVac = int(val[1])
		except:
			idVac = 0
		print("idvac = " + str(idVac))
		print(val[0])
		if idVac != 0 and int(val[0]) > 3:
			print("appending...")
			finalres.append(VacancyCache.objects.filter(vacancy_Id=idVac)[0])
	info = finalres

	# print(topp['kinect'])

	#info = Competition("test", ["course1", "course2"], ["c", "c++"], ["soft1", "soft2", "soft3"], None)
	#info = Document(FindedUser.resumeField._get_path())
	#tmp = EduStandartsParser.printresult()
	#parm = hhAPI.get_data_from_user_model(FindedUser)
	t2 = time.time()
	print("working time = " + str(t2 - t1))
	descrs = []
	context = RequestContext(request, {'FindedUser': FindedUser, "info": info, "descrs": descrs})
	return HttpResponse(template.render(context))
Example #5
0
def user(request, _id):

    template = loader.get_template('suggesting_system/user.html')
    FindedUser = User.objects.get(id=_id)
    t1 = time.time()
    hhapi = hhAPI(FindedUser)

    info = hhapi.CreateQuery(GitHubAPI.GetLanguages(FindedUser.gitHub))

    textList = []
    doctitleList = []
    for vac in info:
        textList.append(vac.description)
        doctitleList.append(vac.vacancy_Id)
        # print(vac.description + ' ' + vac.name)

    allDict = hhapi.docdict
    i = 0
    BIGTextData = ''
    for i in range(len(textList)):
        BIGTextData += textList[i]
        allDict.update(dict(zip([doctitleList[i]], [textList[i]])))
        i += 1

    # print(allDict)
    vacancyTerms = WordCount.get_term_one_list(WordCount.map(BIGTextData))
    print("vacancy terms = ")
    print(vacancyTerms[1])
    print("hhDATA = ")
    print(hhapi.documents.DocTermList[1])
    print("terms = ")
    test = dict(
        list(hhapi.documents.DocTermList[1].items()) +
        list(vacancyTerms[1].items()))
    print("test = ")
    print(test)

    documentWords, documentTitles, allwords = NMF.ConvertData(allDict, test)
    print("doc worlds = ")
    print(documentWords)
    tmp = NMF.CreateMatrix(allwords, documentWords)
    # print(tmp[0])
    # print(tmp[1])
    test = NMF.calculate(tmp[0])

    print(documentTitles)
    WeightMatrix = test[0]
    HeightMatrix = test[1]
    topp, pn, res = NMF.prepareToVis(WeightMatrix, HeightMatrix,
                                     documentTitles, tmp[1])
    print("fin res" + str(res))
    finalres = []
    a = "ssss"
    for val in res:
        try:
            idVac = int(val[1])
        except:
            idVac = 0
        print("idvac = " + str(idVac))
        print(val[0])
        if idVac != 0 and int(val[0]) > 3:
            print("appending...")
            finalres.append(VacancyCache.objects.filter(vacancy_Id=idVac)[0])
    info = finalres

    # print(topp['kinect'])

    #info = Competition("test", ["course1", "course2"], ["c", "c++"], ["soft1", "soft2", "soft3"], None)
    #info = Document(FindedUser.resumeField._get_path())
    #tmp = EduStandartsParser.printresult()
    #parm = hhAPI.get_data_from_user_model(FindedUser)
    t2 = time.time()
    print("working time = " + str(t2 - t1))
    descrs = []
    context = RequestContext(request, {
        'FindedUser': FindedUser,
        "info": info,
        "descrs": descrs
    })
    return HttpResponse(template.render(context))