def is_semantics_only_unordered_exact_match_post_ER()

in utils/semantic_matchers.py [0:0]


def is_semantics_only_unordered_exact_match_post_ER(string_1, string_2, resolver):
    '''
    Function to check if two strings have an unordered EM or not,
    without the non-semantic nodes. Entity resolution step will be performed on
    the semantics only tree representation for string_1. This function is only applicable for
    TOP format string_1. The second string_2 will be loaded as an EXR format 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
    :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 and semantics only transformation was applied.
    '''

    tree_semantics_only_1 = None

    tree_1 = tree_factory(string_1, 'TOP')
    if tree_1:
        tree_semantics_only_1 = TopSemanticTree.get_semantics_only_tree(tree_1.tree_rep)

    tree_2 = tree_factory(string_2, 'EXPRESS')

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

    resolved_tree_1 = resolver.resolve_tree_into_TGT(tree_semantics_only_1)

    return resolved_tree_1 and tree_2 and \
           resolved_tree_1.is_unordered_exact_match(tree_2)