Class CachingHyphenator
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
IHyphenator implementation that caches the responses.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the internalIHyphenatorinstance.voidfromMessage(HyphenatorMessage hyphenatorMessage) Loads the cache from the givenHyphenatorMessage.voidfromMessage(com.google.protobuf.Any message) Loads the cache from the given message if it is aHyphenatorMessage.String[]hyphenate(com.github.szgabsz91.morpher.core.model.Word input) Uses the internalIHyphenatorinstance to hyphenate the given input word, unless the response is already cached.Converts thisIHyphenatorto aHyphenatorMessage.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.szgabsz91.morpher.languagehandlers.hunmorph.impl.hyphenation.IHyphenator
getLastSyllable
-
Constructor Details
-
CachingHyphenator
public CachingHyphenator()Default constructor.
-
-
Method Details
-
close
public void close()Closes the internalIHyphenatorinstance.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIHyphenator
-
hyphenate
Uses the internalIHyphenatorinstance 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:
hyphenatein interfaceIHyphenator- Parameters:
input- the input word- Returns:
- the String array containing the syllables
-
toMessage
Converts thisIHyphenatorto aHyphenatorMessage.- Specified by:
toMessagein interfacecom.github.szgabsz91.morpher.core.io.IConvertable<HyphenatorMessage>
-
fromMessage
Loads the cache from the givenHyphenatorMessage.- Specified by:
fromMessagein interfacecom.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 aHyphenatorMessage.- Specified by:
fromMessagein interfacecom.github.szgabsz91.morpher.core.io.IConvertable<HyphenatorMessage>- Throws:
com.google.protobuf.InvalidProtocolBufferException
-