예제 #1
0
        public static IEnumerable <AnalyzedText> BinarySearchMatchFromFile(this OcrResult ocrResult, string textType, string filePath, bool useFuzzyMatch = true)
        {
            var allWords = ocrResult.AllWords().ToArray();

            Constants.SpecialCharactersTranslationDictionary.ForEach(x =>
            {
                allWords = allWords.Replace(x.Key, x.Value);
            });

            List <string> resultList = new List <string>();

            return(allWords
                   .Select(x => FuzzyBinarySearch.FindCloseMatch(x, filePath, useFuzzyMatch))
                   .Where(x => x != null)
                   .Distinct()
                   .Select(x => new AnalyzedText()
            {
                Text = x,
                TextType = textType,
                BoundingBox = ocrResult.BoundingBox
            }));
        }