Exemple #1
0
 def POST(self):
     input_string = web.input()
     try:
         cv = make_text(input_string['content'])
     except:
         cv = make_text(input_string['textfield'])
     related_docs = cv_comparer.best_matches(cv, jobs_dictionary, index_dictionary, 7)
     job_info = [cv_comparer.run_query("SELECT job_title, job_description FROM test.job_results WHERE search_id = " + str(search_id)) for search_id in related_docs[1:]]
     title_description = dict((entry[0][0], entry[0][1]) for entry in job_info if entry)
     web.header('Content-Type', 'application/json')
     #similarity_matrix = dict((item,best_matches(item, all_jobs_dictionary, 6)) for item in related_docs[1:])
     return json.dumps(title_description, ensure_ascii=False)
Exemple #2
0
 def get_all_job_info(self):
     sql_query = "SELECT * FROM test.job_results"
     return dict((job_id, {'job_id': job_id, 'search_term' : search.decode('utf-8', 'ignore'), 'location_term' : location.decode('utf-8', 'ignore'), 'job_title' : title.decode('utf-8', 'ignore'), 'job_description' : description.decode('utf-8', 'ignore')}) for (job_id, search, location, title, description) in cv_comparer.run_query(sql_query))
Exemple #3
0
def get_job_by_id(jid):
  """
  Method was desired to get a job without instantiating a full jobSearch object
  as it makes a big ass dictionary
  """
  sql_query = "SELECT * FROM test.job_results WHERE search_id = " + str(jid)
  job_dict = dict((job_id, {'job_id': job_id, 'search_term' : search.decode('utf-8', 'ignore'), 'location_term' : location.decode('utf-8', 'ignore'), 'job_title' : title.decode('utf-8', 'ignore'), 'job_description' : description.decode('utf-8', 'ignore')}) for (job_id, search, location, title, description) in cv_comparer.run_query(sql_query))
  job_dict['warnings'] = lint_job_advert(job_dict['job_description'])
  return job_dict
Exemple #4
0
    return string.encode('ascii', 'ignore')

urls = (
    '/', 'index', 
    '/about', 'about',
    '/contact', 'contact'
)

home_render = web.template.render('templates/')

app = web.application(urls, globals())

my_form = web.form.Form(web.form.Textarea('content', class_='textfield', id='textfield', rows=20, columns=60, description='Post your CV in here:'),)


jobs_dictionary = dict((line[0], line[1].strip().replace('\n', ' ')) for line in cv_comparer.run_query('SELECT search_id, job_description FROM test.job_results'))
i = 0
index_dictionary = {}
for key in jobs_dictionary.keys():
    if len(jobs_dictionary[key].strip().replace('\n', ' ').split(' ')) > 15:
        i += 1
        index_dictionary[i] = key
    else:
        del jobs_dictionary[key]
        index_dictionary[i] = False

#similarity_matrix = make_similarity_matrix(all_jobs_dictionary)

class index:
    def GET(self):
        form = my_form()