Class SRXManager

java.lang.Object
org.omegat.core.segmentation.SRXManager

@NullMarked public final class SRXManager extends Object
Utility class for SRX segmentation rules.
  • Field Details

  • Method Details

    • getDefault

      public static SRX getDefault() throws IOException
      Throws:
      IOException
    • saveToSrx

      public static void saveToSrx(@Nullable SRX srx, File outDir) throws IOException
      Saves segmentation rules into specified directory.
      Parameters:
      srx - OmegaT object to be written; if null, means that we want to delete the file
      outDir - where to put the file. The file name is forced to SRX_SENTSEG and will be in standard SRX format.
      Throws:
      IOException
    • loadSrxFile

      public static @Nullable SRX loadSrxFile(URI rulesUri)
    • loadFromDir

      @Nullable public static @Nullable SRX loadFromDir(File configDir)
      Loads the local segmentation file. Accepts SRX (default) or old CONF format. In case you use a conf format, rules about an old version remain valid.
    • loadSrxInputStream

      public static SRX loadSrxInputStream(InputStream io) throws IOException
      Throws:
      IOException
    • lookupRulesForLanguage

      public static List<Rule> lookupRulesForLanguage(SRX srx, Language srclang)
      Finds the rules for a certain language.

      Usually (if the user didn't screw up the setup) there are 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.