Package org.omegat.core.segmentation
Class SRX
- java.lang.Object
-
- org.omegat.core.segmentation.SRX
-
- All Implemented Interfaces:
java.io.Serializable
public class SRX extends java.lang.Object implements java.io.SerializableThe 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.StringCONF_SENTSEGstatic java.lang.StringCURRENT_VERSIONCurrently supported segmentation support version.static java.lang.StringINITIAL_VERSIONInitial version of segmentation support (1.4.6 beta 4 -- 1.6.0 RC7).static java.lang.StringOT160RC8_VERSIONSegmentation support of 1.6.0 RC8 (a bit more rules added).static java.lang.StringOT160RC9_VERSIONSegmentation support of 1.6.0 RC9 (rules separated).
-
Constructor Summary
Constructors Constructor Description SRX()Creates an empty SRX, without any rules.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SRXcopy()booleanequals(java.lang.Object obj)static SRXgetDefault()java.util.List<MapRule>getMappingRules()Returns all mapping rules (of classMapRule) at once: correspondences between languages and their segmentation rules.java.lang.StringgetVersion()Returns segmentation support version.inthashCode()booleanisIncludeEndingTags()Getter for property includeEndingTags.booleanisIncludeIsolatedTags()Getter for property includeIsolatedTags.booleanisIncludeStartingTags()Getter for property includeStartingTags.booleanisSegmentSubflows()Getter for property segmentSubflows.static SRXloadSRX(java.io.File configFile)Loads segmentation rules from an XML file.java.util.List<Rule>lookupRulesForLanguage(Language srclang)Finds the rules for a certain language.static booleanprojectConfigFileExists(java.lang.String configDir)Does a config file already exists for the project at the given location?static voidsaveTo(SRX srx, java.io.File outFile)Saves segmentation rules into specified file.voidsetIncludeEndingTags(boolean includeEndingTags)Setter for property includeEndingTags.voidsetIncludeIsolatedTags(boolean includeIsolatedTags)Setter for property includeIsolatedTags.voidsetIncludeStartingTags(boolean includeStartingTags)Setter for property includeStartingTags.voidsetMappingRules(java.util.List<MapRule> rules)Sets all mapping rules (of classMapRule) at once: correspondences between languages and their segmentation rules.voidsetSegmentSubflows(boolean segmentSubflows)Setter for property segmentSubflows.voidsetVersion(java.lang.String value)Sets segmentation support version.
-
-
-
Field Detail
-
CONF_SENTSEG
public static final java.lang.String CONF_SENTSEG
- See Also:
- Constant Field Values
-
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
-
-
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 callsinitDefaults.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 classMapRule) at once: correspondences between languages and their segmentation rules.
-
setMappingRules
public void setMappingRules(java.util.List<MapRule> rules)
Sets all mapping rules (of classMapRule) 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-