예제 #1
0
파일: tree.py 프로젝트: yyht/XRTransfer
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)
예제 #2
0
    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