Class SRX

  • All Implemented Interfaces:
    java.io.Serializable

    public class SRX
    extends java.lang.Object
    implements java.io.Serializable
    The class with all the segmentation data possible -- rules, languages, etc. It loads and saves its data from/to SRX file.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CONF_SENTSEG  
      static java.lang.String CURRENT_VERSION
      Currently supported segmentation support version.
      static java.lang.String INITIAL_VERSION
      Initial version of segmentation support (1.4.6 beta 4 -- 1.6.0 RC7).
      static java.lang.String OT160RC8_VERSION
      Segmentation support of 1.6.0 RC8 (a bit more rules added).
      static java.lang.String OT160RC9_VERSION
      Segmentation support of 1.6.0 RC9 (rules separated).
    • Constructor Summary

      Constructors 
      Constructor Description
      SRX()
      Creates an empty SRX, without any rules.
    • Field Detail

      • INITIAL_VERSION

        public static final java.lang.String INITIAL_VERSION
        Initial version of segmentation support (1.4.6 beta 4 -- 1.6.0 RC7).
        See Also:
        Constant Field Values
      • OT160RC8_VERSION

        public static final java.lang.String OT160RC8_VERSION
        Segmentation support of 1.6.0 RC8 (a bit more rules added).
        See Also:
        Constant Field Values
      • OT160RC9_VERSION

        public static final java.lang.String OT160RC9_VERSION
        Segmentation support of 1.6.0 RC9 (rules separated).
        See Also:
        Constant Field Values
      • CURRENT_VERSION

        public static final java.lang.String CURRENT_VERSION
        Currently supported segmentation support version.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SRX

        public SRX()
        Creates an empty SRX, without any rules.

        Please do not call directly unless you know what you are doing.

    • Method Detail

      • copy

        public SRX copy()
      • saveTo

        public static void saveTo​(SRX srx,
                                  java.io.File outFile)
                           throws java.io.IOException
        Saves segmentation rules into specified file.
        Throws:
        java.io.IOException
      • loadSRX

        public static SRX loadSRX​(java.io.File configFile)
        Loads segmentation rules from an XML file. If there's an error loading a file, it calls initDefaults.

        Since 1.6.0 RC8 it also checks if the version of segmentation rules saved is older than that of the current OmegaT, and tries to merge the two sets of rules.

      • projectConfigFileExists

        public static boolean projectConfigFileExists​(java.lang.String configDir)
        Does a config file already exists for the project at the given location?
        Parameters:
        configDir - the project directory for storage of settings file
      • getDefault

        public static SRX getDefault()
      • lookupRulesForLanguage

        public java.util.List<Rule> lookupRulesForLanguage​(Language srclang)
        Finds the rules for a certain language.

        Usually (if the user didn't screw up the setup) there're a default segmentation rules, so it's a good idea to rely on this method always returning at least some rules.

        Or in case of a completely screwed setup -- an empty list without any rules.

      • isSegmentSubflows

        public boolean isSegmentSubflows()
        Getter for property segmentSubflows.
        Returns:
        Value of property segmentSubflows.
      • setSegmentSubflows

        public void setSegmentSubflows​(boolean segmentSubflows)
        Setter for property segmentSubflows.
        Parameters:
        segmentSubflows - New value of property segmentSubflows.
      • isIncludeStartingTags

        public boolean isIncludeStartingTags()
        Getter for property includeStartingTags.
        Returns:
        Value of property includeStartingTags.
      • setIncludeStartingTags

        public void setIncludeStartingTags​(boolean includeStartingTags)
        Setter for property includeStartingTags.
        Parameters:
        includeStartingTags - New value of property includeStartingTags.
      • isIncludeEndingTags

        public boolean isIncludeEndingTags()
        Getter for property includeEndingTags.
        Returns:
        Value of property includeEndingTags.
      • setIncludeEndingTags

        public void setIncludeEndingTags​(boolean includeEndingTags)
        Setter for property includeEndingTags.
        Parameters:
        includeEndingTags - New value of property includeEndingTags.
      • isIncludeIsolatedTags

        public boolean isIncludeIsolatedTags()
        Getter for property includeIsolatedTags.
        Returns:
        Value of property includeIsolatedTags.
      • setIncludeIsolatedTags

        public void setIncludeIsolatedTags​(boolean includeIsolatedTags)
        Setter for property includeIsolatedTags.
        Parameters:
        includeIsolatedTags - New value of property includeIsolatedTags.
      • getMappingRules

        public java.util.List<MapRule> getMappingRules()
        Returns all mapping rules (of class MapRule) at once: correspondences between languages and their segmentation rules.
      • setMappingRules

        public void setMappingRules​(java.util.List<MapRule> rules)
        Sets all mapping rules (of class MapRule) at once: correspondences between languages and their segmentation rules.
      • getVersion

        public java.lang.String getVersion()
        Returns segmentation support version.
      • setVersion

        public void setVersion​(java.lang.String value)
        Sets segmentation support version.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object