Class HyphenDictionary

java.lang.Object
com.teamten.hyphen.HyphenDictionary

public class HyphenDictionary extends Object
A TeX-style hyphen dictionary.
  • Method Details

    • fromResource

      public static HyphenDictionary fromResource(String language) throws IOException
      Reads a .dic file from a resource. Use e.g., "fr" for language.
      Throws:
      FileNotFoundException - if the file can't be found.
      IOException - if the file can't be loaded.
    • hyphenate

      public List<String> hyphenate(String word)
      Hyphenate the specified word, returning a list of word fragments between which hyphenation can happen. Note that if the word already contains a hyphen, it will show up at the end of one of the fragments. Don't add another hyphen after that.
    • segmentsToString

      public static String segmentsToString(List<String> segments)
      Takes a list of segments and return them separated by hyphens.