class_docstr: Extract Relation between two mentions according to computation and rule based algorithms
class_docstr_tok: ["Extract","Relation","between","two","mentions","according","to","computation","and","rule","based","algorithms"]
docstr: Try to find if mentions has anyone or more of the relations this class support
  
  Args:
      mention_x: MentionDataLight
      mention_y: MentionDataLight
  
  Returns:
      Set[RelationType]: One or more of: RelationType.EXACT_STRING, RelationType.FUZZY_FIT,
          RelationType.FUZZY_HEAD_FIT, RelationType.SAME_HEAD_LEMMA,
          RelationType.SAME_HEAD_LEMMA_RELAX
docstr_tok: ["Try","to","find","if","mentions","has","anyone","or","more","of","the","relations","this","class","support","Args",":","mention_x",":","MentionDataLight","mention_y",":","MentionDataLight","Returns",":","Set","[","RelationType","]",":","One","or","more","of",":","RelationType.EXACT_STRING",",","RelationType.FUZZY_FIT",",","RelationType.FUZZY_HEAD_FIT",",","RelationType.SAME_HEAD_LEMMA",",","RelationType.SAME_HEAD_LEMMA_RELAX"]
code: def extract_all_relations(
      self, mention_x: MentionDataLight, mention_y: MentionDataLight
  ) -> Set[RelationType]:
      """
      Try to find if mentions has anyone or more of the relations this class support
  
      Args:
          mention_x: MentionDataLight
          mention_y: MentionDataLight
  
      Returns:
          Set[RelationType]: One or more of: RelationType.EXACT_STRING, RelationType.FUZZY_FIT,
              RelationType.FUZZY_HEAD_FIT, RelationType.SAME_HEAD_LEMMA,
              RelationType.SAME_HEAD_LEMMA_RELAX
      """
      relations = set()
      mention_x_str = mention_x.tokens_str
      mention_y_str = mention_y.tokens_str
  
      if StringUtils.is_pronoun(
          mention_x_str.lower()
      ) or StringUtils.is_pronoun(mention_y_str.lower()):
          relations.add(RelationType.NO_RELATION_FOUND)
          return relations
  
      exact_rel = self.extract_exact_string(mention_x, mention_y)
      fuzzy_rel = self.extract_fuzzy_fit(mention_x, mention_y)
      fuzzy_head_rel = self.extract_fuzzy_head_fit(mention_x, mention_y)
      same_head_rel = self.extract_same_head_lemma(mention_x, mention_y)
      if exact_rel != RelationType.NO_RELATION_FOUND:
          relations.add(exact_rel)
      if fuzzy_rel != RelationType.NO_RELATION_FOUND:
          relations.add(fuzzy_rel)
      if fuzzy_head_rel != RelationType.NO_RELATION_FOUND:
          relations.add(fuzzy_head_rel)
      if same_head_rel != RelationType.NO_RELATION_FOUND:
          relations.add(same_head_rel)
  
      if len(relations) == 0:
          relations.add(RelationType.NO_RELATION_FOUND)
  
      return relations
  
file_path: nlp-architect/nlp_architect/data/cdc_resources/relations/computed_relation_extraction.py
imports: import difflib
  import logging
  import sys
  from typing import List, Set
  from nlp_architect.common.cdc.mention_data import MentionDataLight
  from nlp_architect.data.cdc_resources.relations.relation_extraction import RelationExtraction
  from nlp_architect.data.cdc_resources.relations.relation_types_enums import RelationType
  from nlp_architect.utils.string_utils import StringUtils
label_desc: Use image node_id 1 for calling the ComputedRelationExtraction obj's underlying member method code with example usage: obj.extract_all_relations(mention_x, mention_y) and returns: relations, relations