Strabo.Core.OCR.ABBYYSingleStringResultParser.ReadResult C# (CSharp) Method

ReadResult() public method

public ReadResult ( string dir, string fn ) : void
dir string
fn string
return void
        public void ReadResult(string dir, string fn)
        {
            double avg_h = 0;
            double avg_w = 0;
            int char_count = 0;
            StreamReader sr = new StreamReader(dir + fn);
            string line = sr.ReadLine();
            while (line != null)
            {
                //char[] ch = ';';
                string[] token = line.Split(';');
                //135; 974; 354; 33; John Av;

                TextLabel textlabel = new TextLabel();
                textlabel.id =  Convert.ToInt16(token[0]);
                textlabel.mass_center = new System.Drawing.Point(Convert.ToInt16(token[1]), Convert.ToInt16(token[2]));
                textlabel.orientation = Convert.ToDouble(token[3]);
                textlabel.text = token[4].Trim();
                //if(textlabel.text.Length <=3)

                textlabel.susp_text = token[5];
                textlabel.bbxx = Convert.ToInt16(token[6]);
                textlabel.bbxy = Convert.ToInt16(token[7]);
                textlabel.bbxw = Convert.ToInt16(token[8]);
                textlabel.bbxh = Convert.ToInt16(token[9]);
                //textlabel.mass_center = new System.Drawing.Point(Convert.ToInt16(textlabel.bbxx + textlabel.bbxw / 2), Convert.ToInt16(textlabel.bbxy + textlabel.bbxh / 2));
                textlabel.avg_h = Convert.ToDouble(textlabel.bbxh) / Convert.ToDouble(textlabel.text.Length);
                textlabel.avg_w = Convert.ToDouble(textlabel.bbxw) / Convert.ToDouble(textlabel.text.Length);
                textlabel_list.Add(textlabel);
                line = sr.ReadLine();
                char_count += textlabel.text.Length;
                avg_h += textlabel.bbxh;
                avg_w += textlabel.bbxw;
            }
            avg_h /= char_count;
            avg_w /= char_count;
            Console.WriteLine("Size:" +avg_h + ";" + avg_w +";"+ Convert.ToString((avg_h + avg_w /2)));
        }