def tree_factory()

in utils/semantic_matchers.py [0:0]


def tree_factory(flat_string, origin_type):
    '''
    :param flat_string: (str) input flat string to construct a tree
    :param origin_type: (str) origin of the string, i.e. EXR or TOP

    :return: (TopSemanticTree/ExpressSemanticTree) Return an object of Tree class
        if the tree can be constructed else None
    '''
    return make_tree_if_possible(flat_string, TopSemanticTree) if origin_type == 'TOP' \
        else make_tree_if_possible(flat_string, ExpressSemanticTree)