java.lang.Object
com.github.szgabsz91.morpher.languagehandlers.hunmorph.impl.hyphenation.CachingHyphenator
All Implemented Interfaces:
com.github.szgabsz91.morpher.core.io.IConvertable<HyphenatorMessage>, IHyphenator, AutoCloseable

public class CachingHyphenator extends Object implements IHyphenator
IHyphenator implementation that caches the responses.
  • Constructor Details

    • CachingHyphenator

      public CachingHyphenator()
      Default constructor.
  • Method Details

    • close

      public void close()
      Closes the internal IHyphenator instance.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface IHyphenator
    • hyphenate

      public String[] hyphenate(com.github.szgabsz91.morpher.core.model.Word input)
      Uses the internal IHyphenator instance to hyphenate the given input word, unless the response is already cached. Returns a String array that contains each syllable of the input word.
      Specified by:
      hyphenate in interface IHyphenator
      Parameters:
      input - the input word
      Returns:
      the String array containing the syllables
    • toMessage

      public HyphenatorMessage toMessage()
      Converts this IHyphenator to a HyphenatorMessage.
      Specified by:
      toMessage in interface com.github.szgabsz91.morpher.core.io.IConvertable<HyphenatorMessage>
    • fromMessage

      public void fromMessage(HyphenatorMessage hyphenatorMessage)
      Loads the cache from the given HyphenatorMessage.
      Specified by:
      fromMessage in interface com.github.szgabsz91.morpher.core.io.IConvertable<HyphenatorMessage>
    • fromMessage

      public void fromMessage(com.google.protobuf.Any message) throws com.google.protobuf.InvalidProtocolBufferException
      Loads the cache from the given message if it is a HyphenatorMessage.
      Specified by:
      fromMessage in interface com.github.szgabsz91.morpher.core.io.IConvertable<HyphenatorMessage>
      Throws:
      com.google.protobuf.InvalidProtocolBufferException