def search_text(data): documents, dictionary, lsi, index = load_docs('linkedin', APP_DATA) sims = query_docs(data, dictionary, lsi, index) #get 10 best matches idx = [sims[s][0] for s in range(0, 13)] results = index_lookup(idx) # clean results results = [r for r in results if "Contractor" not in r] results = [r for r in results if "Intern" not in r] results = [r for r in results if "Hourly" not in r] results = [r for r in results if "Monthly" not in r] results = [r for r in results if "Visiting" not in r] rtokens = [r.split('/') for r in results] #results = pull_linkedidx(idx) clean_res = [{ 'Company': r[2], 'Title': r[3].split('.')[0] } for r in rtokens] jobs = getSalary(clean_res) min_sal, max_sal, avg_sal = calc_salary([r['Salary'] for r in jobs]) results = {} results['status'] = "ok" results['jobs'] = jobs results['max_salary'] = '$' + locale.format("%d", max_sal, grouping=True) results['min_salary'] = '$' + locale.format("%d", min_sal, grouping=True) results['ave_salary'] = '$' + locale.format("%d", avg_sal, grouping=True) return results
def search_text(data): documents, dictionary, lsi, index = load_docs('linkedin',APP_DATA) sims = query_docs(data, dictionary, lsi, index) #get 10 best matches idx = [sims[s][0] for s in range(0,13)] results = index_lookup(idx) # clean results results = [r for r in results if "Contractor" not in r] results = [r for r in results if "Intern" not in r] results = [r for r in results if "Hourly" not in r] results = [r for r in results if "Monthly" not in r] results = [r for r in results if "Visiting" not in r] rtokens = [r.split('/') for r in results] #results = pull_linkedidx(idx) clean_res = [{'Company':r[2],'Title':r[3].split('.')[0]} for r in rtokens] jobs = getSalary(clean_res) min_sal, max_sal, avg_sal = calc_salary([r['Salary'] for r in jobs]) results = {} results['status'] = "ok" results['jobs'] = jobs results['max_salary'] = '$' + locale.format("%d", max_sal, grouping=True) results['min_salary'] = '$' + locale.format("%d", min_sal, grouping=True) results['ave_salary'] = '$' + locale.format("%d", avg_sal, grouping=True) return results
def search_query(url): data = pull_profile(url) documents, dictionary, lsi, index = load_docs('linkedin') sims = query_docs(data, dictionary, lsi, index) #get 10 best matches idx = [sims[s][0] for s in range(0,10)] results = index_lookup(idx) rtokens = [r.split('/') for r in results] #results = pull_linkedidx(idx) clean_res = [{'Company':r[2],'Title':r[3].split('.')[0]} for r in rtokens] jobs = getSalary(clean_res) min_sal, max_sal, avg_sal = calc_salary([r['Salary'] for r in jobs]) results = {} results['jobs'] = jobs results['max_salary'] = '$' + locale.format("%d", max_sal, grouping=True) results['min_salary'] = '$' + locale.format("%d", min_sal, grouping=True) results['ave_salary'] = '$' + locale.format("%d", avg_sal, grouping=True) return results