Class GlossarySearcher

java.lang.Object
org.omegat.gui.glossary.GlossarySearcher

@NullMarked public class GlossarySearcher extends Object
A class encapsulating glossary matching logic.
  • Constructor Details

    • GlossarySearcher

      public GlossarySearcher(ITokenizer tok, Language srcLang, boolean mergeAltDefinitions)
    • GlossarySearcher

      public GlossarySearcher(ITokenizer tok, Language srcLang, Language targetLang, boolean mergeAltDefinitions)
  • Method Details

    • searchSourceMatches

      public List<GlossaryEntry> searchSourceMatches(SourceTextEntry ste, List<GlossaryEntry> entries)
    • searchSourceMatchTokens

      public List<Token[]> searchSourceMatchTokens(SourceTextEntry ste, GlossaryEntry entry)
      Searches for matching tokens between the source text of a SourceTextEntry and the source text of a GlossaryEntry.

      The method tokenizes the source text and compares it with the glossary entry's source text. If no matches are found, it attempts to find matches using rules specific to CJK (Chinese, Japanese, Korean) text.

      Parameters:
      ste - the source text entry containing the text to be tokenized and matched
      entry - the glossary entry containing the source text to be matched against
      Returns:
      a mutable list of token arrays representing the matched tokens between the source text entry and the glossary entry
    • searchTargetMatches

      public List<String> searchTargetMatches(String trg, ProtectedPart[] protectedParts, GlossaryEntry entry)