3 Replies Latest reply on Oct 9, 2009 4:15 AM by Kees van Daalen

    [CS3 JS] find words in dictionary

    Kees van Daalen

      I'm trying to find a way to break up words in syllables.

      The dictionary can break up words but I cannot make a reference to the dictionary to find a word and its hyphenation.

      From the hyphenation I should be able to get the syllables.

       

      It is possible to get the hyphenation exceptions, but I need the hyphenations from the custom dictionary.

       

      Any thoughts?

       

      Thanks, Kees

        • 1. Re: [CS3 JS] find words in dictionary
          [Jongware] Most Valuable Participant

          No go. I tried that myself :-) there simply is no interface to the hyphenation modules for any language (nor for the spell check, which might have come in handy as well!).

           

          You could download a hyphenated word list and use that for whatever purpose you need it. Down-sides: (a) you won't know how ID will break the word, as it may have different rules; (b) ID can break unknown words using rules, a word list cannot; (c) ID uses one-, two- and three-priority hyphens.

          1 person found this helpful
          • 2. Re: [CS3 JS] find words in dictionary
            [Jongware] Most Valuable Participant

            [Addendum] If you only need to be able to manually find breaking points, you could use an implementation of Knuth-Liang's algorithm. I wrote one in C, and it did rather good for, ah, perhaps 80% of words. For a purely rule-based system, that qualifies as "not too bad"

             

            There are lots of free implementations; this one http://code.google.com/p/hyphenator/ is in javascript. (It is targeted at web pages but the basics should be transferable to your script.)

            • 3. Re: [CS3 JS] find words in dictionary
              Kees van Daalen Level 1

              The hyphenator does the trick once I put the HTML-DOM stuff in a try-catch-block.

              However the ExtendScript editor crashes when I use words that contain a circonflex.

              I'll probably vreate an exceptions list to deal with those words.

               

              Thanks a lot!