Example #1
0
        public string ReturnMostSimilarWord(string ocrword)
        {
            var thisword = new Closeness {
                Closeid = -1.0, Item = ""
            };

            foreach (var word in _items)
            {
                var tmep = CalculateSimilarity(ocrword.Trim(), word.ToUpper());
                if (tmep >= 1.0)
                {
                    return(word);
                }

                if (!(thisword.Closeid < tmep))
                {
                    continue;
                }
                if (!(tmep > .25))
                {
                    continue;
                }
                thisword.Closeid = tmep;
                thisword.Item    = word;
            }
            MessageBox.Show(@"ocr txt :" + ocrword + @" suggested word : " + thisword.Item);

            //have option to add new word here somewhere or where this is returned.


            return(thisword.Item);
        }
Example #2
0
        public string ReturnMostSimilarWord(string ocrword, List <string> items)
        {
            var thisword = new Closeness {
                Closeid = -1.0, Item = ""
            };

            foreach (var word in items)
            {
                var tmep = CalculateSimilarity(ocrword.Trim(), word.ToUpper());
                if (Math.Abs(tmep - 1.0) < .0001)
                {
                    return(word);
                }

                if (!(thisword.Closeid < tmep))
                {
                    continue;
                }
                thisword.Closeid = tmep;
                thisword.Item    = word;
            }

            return(thisword.Item);
        }