Class RuleManager


  • public class RuleManager
    extends Object
    Represents segmentation rules manager. Responsible for constructing and storing break and exception rules.
    Author:
    loomchild
    • Constructor Detail

      • RuleManager

        public RuleManager​(SrxDocument document,
                           List<LanguageRule> languageRuleList,
                           int maxLookbehindConstructLength)
        Constructor. Responsible for retrieving rules from SRX document for given language code, constructing patterns and storing them in quick accessible format. Adds break rules to breakRuleList and constructs corresponding exception patterns in exceptionPatternMap. Uses document cache to store rules and patterns.
        Parameters:
        document - SRX document
        languageRuleList - list of language rules
        maxLookbehindConstructLength - Maximum length of regular expression in lookbehind (see Util.finitize(String, int)).
    • Method Detail

      • getBreakRuleList

        public List<Rule> getBreakRuleList()
        Returns:
        break rule list
      • getExceptionPattern

        public Pattern getExceptionPattern​(Rule breakRule)
        Parameters:
        breakRule -
        Returns:
        exception pattern corresponding to give break rule