def get_confs_kws(query, services): params = {'query': query} StandardNLP.process(params) keywords = find_keywords(params['features']['tokens']) confidences = {} for name, heuristic in services.iteritems(): confidences[name] = heuristic.run_heuristic(keywords) return confidences, keywords + ['BIAS']
def process(cls, params): """Does semantic analysis stuff, extracts important information to NLP'd data. """ tree, nouns = find_nouns(params["features"]["pos"]) keywords = find_keywords(set(x[0] for x in tree if " " not in x[0])) features = { "keywords": keywords, "pos": params["features"]["pos"], "tokens": params["features"]["tokens"], "tree": tree, "nouns": nouns, "tense": get_tense(params["features"]["pos"]), "isQuestion": is_question(params["features"]["tokens"]), "questionType": classify_question(params["features"]["tokens"]), } params["features"] = features
def process(cls, params): """Does semantic analysis stuff, extracts important information to NLP'd data. """ tree, nouns = find_nouns(params['features']['pos']) keywords = find_keywords(set(x[0] for x in tree if ' ' not in x[0])) features = { 'keywords': keywords, 'pos': params['features']['pos'], 'tokens': params['features']['tokens'], 'tree': tree, 'nouns': nouns, 'tense': get_tense(params['features']['pos']), 'isQuestion': is_question(params['features']['tokens']), 'questionType': classify_question(params['features']['tokens']) } params['features'] = features