def find_pot_aspects(tree, pot_aspects, tags): """ A recursive function that finds each noun in a sentence and appends them to a list. :param tree: A node. :param pot_aspects: A list of the current noun phrases found in a tree. :param tags: The tags of nouns. """ if tree.is_leaf(): if tree.tag in tags: pot_aspects.append(Aspect(None, tree.phrase, 6)) else: for i in range(tree.children): child = tree.get_child(i) find_pot_aspects(child, pot_aspects, tags)
def __init__(self, url=None, version=None, token=None): self.subject = Subject() self.aspect = Aspect() self.sample = Sample() if url: if url.endswith('/'): config.REFOCUS_URL = url else: config.REFOCUS_URL = url + '/' if config.API_VERSION or version: config.REFOCUS_URL += version if version else config.API_VERSION if token: config.REFOCUS_TOKEN = token