Classes

The following classes are available globally.

  • Stateless class that provides the ability to reverse-transliterate from the given script to the specified scheme with the anteliterate API. Unlike the Transliterator, this class does not aggregate inputs. The assumption is that while anteliterating the clients already have the full output string that they want to reverse-transliterate into the specified scheme.

    Usage:

    class MyConfig: Config {
    ...
    }
    
    let factory = try TransliteratorFactory(config: MyConfig())
    
    guard let schemes = try factory.availableSchemes(), let scripts = try factory.availableScripts() else {
    // Deal with bad config
    }
    
    let anteliterator = try factory.anteliterator(schemeName: schemes[0], scriptName: scripts[0])
    
    try anteliterator.anteliterate("...")
    
    See more

    Declaration

    Swift

    public class Anteliterator
  • This class provides default config values that the client can override, typically using UserDefaults and pass an instance into LiteratorFactory.

    See more

    Declaration

    Swift

    open class Config
  • Use this class to get an instance of Transliterator and Anteliterator. This class is responsible for the two step initialization that is needed to generate an instance of Transliterator or Anteliterator.

    Important

    Handle any exception that are thrown from init, transliterator and anteliterator - these are indicative of a bad config.
    See more

    Declaration

    Swift

    public class LiteratorFactory
  • If clients want to use the same log formatting and logger features of LipikaEngine, they are free to use this class. Logger exposes a thread-local instance called Logger.log that needs to be used. Logger itself cannot be instantiated.

    Important

    logLevel is thread-local specific and not global.

    Note

    message strings passed into Logger are @autoclosure and hence are not evaluated unless they are logged.

    Usage

    Logger.logLevel = .warning
    Logger.log.debug("you don't need to know")
    Logger.log.warning("you may want to know")
    
    See more

    Declaration

    Swift

    public final class Logger
  • Stateful class that aggregates incremental input in the given scheme and provides aggregated output in the specified script through the transliterate API.

    Usage:

    class MyConfig: Config {
       ...
    }
    
    let factory = try TransliteratorFactory(config: MyConfig())
    
    guard let schemes = try factory.availableSchemes(), let scripts = try factory.availableScripts() else {
       // Deal with bad config
    }
    
    let tranliterator = try factory.tranliterator(schemeName: schemes[0], scriptName: scripts[0])
    
    try tranliterator.transliterate("...")
    
    See more

    Declaration

    Swift

    public class Transliterator