Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
matrix.cpp
Go to the documentation of this file.
1 /* -*-C-*-
2 ********************************************************************************
3 *
4 * File: matrix.c (Formerly matrix.c)
5 * Description: Ratings matrix code. (Used by associator)
6 * Author: Mark Seaman, OCR Technology
7 * Created: Wed May 16 13:18:47 1990
8 * Modified: Wed Mar 20 09:44:47 1991 (Mark Seaman) marks@hpgrlt
9 * Language: C
10 * Package: N/A
11 * Status: Experimental (Do Not Distribute)
12 *
13 * (c) Copyright 1990, Hewlett-Packard Company.
14 ** Licensed under the Apache License, Version 2.0 (the "License");
15 ** you may not use this file except in compliance with the License.
16 ** You may obtain a copy of the License at
17 ** http://www.apache.org/licenses/LICENSE-2.0
18 ** Unless required by applicable law or agreed to in writing, software
19 ** distributed under the License is distributed on an "AS IS" BASIS,
20 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 ** See the License for the specific language governing permissions and
22 ** limitations under the License.
23 *
24 *********************************************************************************/
25 /*----------------------------------------------------------------------
26 I n c l u d e s
27 ----------------------------------------------------------------------*/
28 #include "matrix.h"
29
30 #include "callcpp.h"
31 #include "ratngs.h"
32 #include "tprintf.h"
33 #include "unicharset.h"
34
35 // Print the best guesses out of the match rating matrix.
36 void MATRIX::print(const UNICHARSET &unicharset) const {
37 tprintf("Ratings Matrix (top choices)\n");
38 int row, col;
39 for (col = 0; col < this->dimension(); ++col) tprintf("\t%d", col);
40 tprintf("\n");
41 for (row = 0; row < this->dimension(); ++row) {
42 for (col = 0; col <= row; ++col) {
43 if (col == 0) tprintf("%d\t", row);
44 BLOB_CHOICE_LIST *rating = this->get(col, row);
45 if (rating != NOT_CLASSIFIED) {
46 BLOB_CHOICE_IT b_it(rating);
47 int counter = 0;
48 for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
49 tprintf("%s ", unicharset.id_to_unichar(b_it.data()->unichar_id()));
50 ++counter;
51 if (counter == 3) break;
52 }
53 tprintf("\t");
54 } else {
55 tprintf(" \t");
56 }
57 }
58 tprintf("\n");
59 }
60 }