Example #1
0
        public MisspelledWord GetMisspelledWord()
        {
            MisspelledWord word = null;

            if (this.errorPositions[this.ContextSize])
            {
                int errors = 0;
                for (int i = 0; i < this.errorPositions.Count; i++)
                {
                    if (this.errorPositions[i])
                    {
                        errors++;
                    }
                }

                //detekce jineho jazyka
                if (errors >= (this.windowSize - 1))
                {
                    return null;
                }

                // v okolnich slovech je chyba, takze preskocit
                if (this.errorPositions[this.ContextSize - 1] && this.errorPositions[this.ContextSize + 1])
                {
                    return null;
                }

                word = new MisspelledWord(this.history, this.ContextSize);
                if (!word.AreNeighborsInContext())
                {
                    return null;
                }
            }

            return word;
        }