示例#1
0
        private bool IsMultiPartWord(char[] w, int len)
        {
            int wordParts = 0;

            for (int i = 0; i < len; i++)
            {
                char[] c = new char[2];
                c[0] = w[i];
                int nc = classmap.Find(c, 0);
                if (nc > 0)
                {
                    if (wordParts > 1)
                    {
                        return(true);
                    }
                    wordParts = 1;
                }
                else
                {
                    if (wordParts == 1)
                    {
                        wordParts++;
                    }
                }
            }
            return(false);
        }
示例#2
0
        /// <summary>Add a pattern to the tree.</summary>
        /// <remarks>
        /// Add a pattern to the tree. Mainly, to be used by
        /// <see cref="PatternParser">PatternParser</see>
        /// class as callback to
        /// add a pattern to the tree.
        /// </remarks>
        /// <param name="pattern">the hyphenation pattern</param>
        /// <param name="ivalue">
        /// interletter weight values indicating the
        /// desirability and priority of hyphenating at a given point
        /// within the pattern. It should contain only digit characters.
        /// (i.e. '0' to '9').
        /// </param>
        public virtual void AddPattern(String pattern, String ivalue)
        {
            int k = ivalues.Find(ivalue);

            if (k <= 0)
            {
                k = PackValues(ivalue);
                ivalues.Insert(ivalue, (char)k);
            }
            Insert(pattern, (char)k);
        }