private MatchedChar ScopeMatch(bool[,] source, bool[,] target, int start) { int targetWidth = target.GetLength(0); int targetHeight = target.GetLength(1); int sourceWidth = source.GetLength(0); int sourceHeight = source.GetLength(1); double max = 0; var matched = new MatchedChar(); for (int i = -2; i < 6; i++) { for (int j = -3; j < sourceHeight - targetHeight + 5; j++) { double rate = FixedMatch(source, target, i + start, j); if (rate > max) { max = rate; matched.X = i + start; matched.Y = j; matched.Rate = rate; } } } return(matched); }
private MatchedChar Match(bool[,] source, int start) { MatchedChar best = null; foreach (var info in words_) { var matched = ScopeMatch(source, info.Table, start); matched.Char = info.Char; if (best == null || best.Rate < matched.Rate) { best = matched; } } return(best); }
private MatchedChar ScopeMatch(bool[,] source, bool[,] target, int start) { int targetWidth = target.GetLength(0); int targetHeight = target.GetLength(1); int sourceWidth = source.GetLength(0); int sourceHeight = source.GetLength(1); double max = 0; var matched = new MatchedChar(); for (int i = -2; i < 6; i++) for (int j = -3; j < sourceHeight - targetHeight + 5; j++) { double rate = FixedMatch(source, target, i + start, j); if (rate > max) { max = rate; matched.X = i + start; matched.Y = j; matched.Rate = rate; } } return matched; }