in utils/semantic_matchers.py [0:0]
def is_semantics_only_unordered_exact_match(string_1, string_2):
'''
Function to check if two strings have an unordered EM or not,
without the non-semantic nodes. This function is only applicable for
TOP format strings. 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
:param string_2: input string 2
:return: (bool) A bool value indicating if string 1 and string 2 are
semantics only unordered EM or not
'''
tree_semantics_only_1 = None
tree_semantics_only_2 = 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, 'TOP')
if tree_2:
tree_semantics_only_2 = TopSemanticTree.get_semantics_only_tree(tree_2.tree_rep)
# 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_semantics_only_2:
return False
return tree_semantics_only_1 and tree_semantics_only_2 and \
tree_semantics_only_1.is_unordered_exact_match(tree_semantics_only_2)