Class SyntaxGeneralizer

java.lang.Object
org.episteme.social.linguistics.loaders.tigerxml.tools.SyntaxGeneralizer

public class SyntaxGeneralizer extends Object
The purpose of this class is to generalize over some distinctions made in Tiger Syntax. The distinctions concern phrase type, part of speech and grammatical function.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • SyntaxGeneralizer

      public SyntaxGeneralizer(Map<String,String> type2gen_type, Map<String,String> label2gen_label, Map<String,String> tag2gen_tag)
      Creates a SyntaxGeneralizer object with user-definned generalization settings.
    • SyntaxGeneralizer

      public SyntaxGeneralizer()
      Creates a SyntaxGeneralizer object with predefinned generalization settings.
  • Method Details

    • getGeneralType

      protected String getGeneralType(String type)
      Generalizes a phrase type using the internal mapping.
      Parameters:
      type - the specific phrase type to generalize
      Returns:
      the generalized phrase type, or "OTHER" if no match is found
    • getGeneralTag

      protected String getGeneralTag(String tag)
      Generalizes a POS tag using the internal mapping.
      Parameters:
      tag - the specific POS tag to generalize
      Returns:
      the generalized POS tag, or "OTHER" if no match is found
    • getGeneralLabel

      protected String getGeneralLabel(String label)
      Generalizes an edge label using the internal mapping.
      Parameters:
      label - the specific edge label to generalize
      Returns:
      the generalized label, or "OTHER" if no match is found
    • isCaseOf

      protected boolean isCaseOf(String item, String general_item)
      Checks if an item (type, label, or tag) matches a specific general category.
      Parameters:
      item - the item to check
      general_item - the general category to match against
      Returns:
      true if the item belongs to the general category, false otherwise
    • getDaughtersByGeneralLabel

      public List<GraphNode> getDaughtersByGeneralLabel(NT node, String gen_label)
      Returns a List of the daughter nodes with a given general edge label. The list is ordered left to right according to word order.
    • getDescendantsByGeneralLabel

      public List<GraphNode> getDescendantsByGeneralLabel(NT node, String gen_label)
      Returns a List of the descendant nodes with a given general edge label. The descendants are ordered breadth first then left to right.
    • isDominatedBy

      public boolean isDominatedBy(GraphNode node, String gen_cat)
      Returns true if there is a dominating node that has the general category "cat"
    • getDominatingNode

      public NT getDominatingNode(GraphNode node, String gen_cat)
      Returns the nearest dominating node that has the general category gen_cat, and is not identical with the input node itself. The method returns null if there is no such node.
    • getGrammaticalFunction

      public String getGrammaticalFunction(GraphNode node)
      Returns the (general) grammatical function of this node.
      Parameters:
      node - the node to inspect
      Returns:
      the generalized grammatical function (edge label)
    • getPhraseType

      public String getPhraseType(NT node)
      Returns the (general) phrase type of this node.
      Parameters:
      node - the non-terminal node to inspect
      Returns:
      the generalized phrase type
    • getPos

      public String getPos(T node)
      Returns the (general) POS tag of this terminal.
      Parameters:
      node - the terminal node to inspect
      Returns:
      the generalized POS tag