Ejemplo n.º 1
0
def match_pattern(tree):
	if tree.is_question():
		return None
	verb = pt.find_node(tree, pt.match_POS("VB", "VBD", "VBG", "VBN", "VBP", "VBZ"))
	subject_tree = pt.find_node(verb, pt.match_gram("nsubj"))
	object_tree = pt.find_node(verb, pt.match_gram("dobj"))
	if verb and subject_tree:
		return {"verb_tree": verb, "subject_tree": subject_tree, "object_tree": object_tree}
	return None
def match_pattern(tree):
    if not tree.is_question():
        return None
    verb_tree = pt.find_node(tree, pt.match_POS("VB", "VBD", "VBG", "VBN", "VBP", "VBZ"))
    copular = pt.find_node(verb_tree, pt.match_word("are", "is"))
    subject_tree = pt.find_node(verb_tree, pt.match_gram("nsubj"))
    object_tree = pt.find_node(verb_tree, pt.match_gram("dobj"))
    if copular and verb_tree and subject_tree:
        return {"verb_tree": verb_tree, "subject_tree": subject_tree, "object_tree": object_tree}
    return None
def match_pattern(tree):
	if not tree.is_question():
		return None
	person = pt.find_node(tree, pt.match_POS("NNP"))
	copular = pt.find_node(person, pt.match_gram("cop"))
	adjective = pt.find_node(person, pt.match_POS("JJ"))
	if copular and adjective:
		return {"person": person, "adjective": adjective}
	return None
def match_pattern(tree):
    if tree.is_question():
        return None
    super_noun = pt.find_node(tree, pt.match_POS("NN", "NNS"))
    copular = pt.find_node(super_noun, pt.match_gram("cop"))
    sub_noun = pt.find_child_node(super_noun, pt.match_POS("NN", "NNS", "NNP"))
    if sub_noun and copular:
        return {"super_noun": super_noun, "sub_noun": sub_noun}
    return None