예제 #1
0
파일: hill_climb.py 프로젝트: Machyne/pal
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']
예제 #2
0
 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
예제 #3
0
 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