def is_unordered_exact_match_post_ER()

in utils/semantic_matchers.py [0:0]


def is_unordered_exact_match_post_ER(string_1, string_2, resolver):
    '''
    Function to check if two strings have an unordered EM or not. Entity
    resolution step will be performed on the loaded tree representation for
    string_1. Once this is done the obtained tree will be
    compared to the tree obtained from loading string_2 as EXR-formatted string.
    This function returns False if either of the two input strings aren't
    in valid formats using which a tree can be constructed.

    :param string_1: input string 1, TOP format, will undergo ER and removal of non-semantic nodes
    :param string_2: input string 2, EXR format, will NOT undergo ER
    :param resolver: a resolver object from entity_resolution.py

    :return: (bool) A bool value indicating if string 1 and string 2 are
        semantics only unordered EM or not after entity resolution is performed
        the tree obtained from string 1.
    '''

    tree_1 = tree_factory(string_1, 'EXR')
    tree_2 = tree_factory(string_2, 'EXR')

    # Check if either of the trees are storing a `None` value.
    # If yes, then return False for not an exact match
    if not tree_1 or not tree_2:
        return False

    resolved_tree_1 = resolver.resolve_tree_into_TGT(tree_1)

    return resolved_tree_1 and tree_2 and resolved_tree_1.is_unordered_exact_match(tree_2)