5 Replies Latest reply on Jun 24, 2008 12:01 AM by srakete

    hyphenate word

    srakete Level 1
      Hi,
      is there a way to find out the possible hyphenations for a word, i.e. the information the userdictionary provides about a word. Is there a way to access this information ?

      e.g. if I have a word "automation", I want to know the position of "~~" in
      "auto~~mation"

      Thanks Stefan
        • 1. Re: hyphenate word
          Martin Fischer Level 2
          Hi Stefan,

          try something like this:


          var myPos = app.selection[0].contents.indexOf('\u00AD');


          But you will only find the discretionary hyphen you have typed in.
          You cannot find a ... (in German: 'Trennfuge') of your hyphenation modul with this.

          (It's my mistake that I didn't read your question as well as needed.)

          Martin
          • 2. Re: hyphenate word
            [Jongware] Most Valuable Participant
            The user dictionary (specifically) has a list of added and removed exceptions. I didn't check, but these most likely are in the "~~" format.
            The hyphenationExceptions set is an element of Document.

            I guess what you're after is to use ID's engine to hyphenate
            i any
            word. Seems not possible through the regular channels. Perhaps one of the external Hyphenation plugins expose their methods for scripting.
            • 3. Re: hyphenate word
              Martin Fischer Level 2
              > Perhaps one of the external Hyphenation plugins expose their methods for scripting.

              But maybe the producers of hyphenation plugins want to keep this information/knowledge for themselves. ;-)

              Martin
              • 4. Re: hyphenate word
                [Jongware] Most Valuable Participant
                If they are smart, they do. You could use a scriptable hyphenator to compare its output against a known word list and then count errors.

                I once wrote an implementation of the algorithm used in TeX, and it did surprisingly well, albeit within the constraints of the algorithm (TeX has a list of exceptions -- fourteen, in the standard version). This algorithm is from Frank Liang, and his thesis can be found here. Not surprisingly, there is a JS version as well. It looks like it's targeting browsers, but you could lift out the relevant code and do a better job than ID. (Is "contralateral" really such a weird word? :-) )
                • 5. Re: hyphenate word
                  srakete Level 1
                  Very interesting. I will have a look at the JS version. Thank you.
                  Stefan