This file is indexed.

/usr/include/tesseract/cube_reco_context.h is in libtesseract-dev 3.02.01-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/**********************************************************************
 * File:        cube_reco_context.h
 * Description: Declaration of the Cube Recognition Context Class
 * Author:    Ahmad Abdulkader
 * Created:   2007
 *
 * (C) Copyright 2008, Google Inc.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.
 *
 **********************************************************************/

// The CubeRecoContext class abstracts the Cube OCR Engine. Typically a process
// (or a thread) would create one CubeRecoContext object per language.
// The CubeRecoContext object also provides methods to get and set the
// different attribues of the Cube OCR Engine.

#ifndef CUBE_RECO_CONTEXT_H
#define CUBE_RECO_CONTEXT_H

#include <string>
#include "neural_net.h"
#include "lang_model.h"
#include "classifier_base.h"
#include "feature_base.h"
#include "char_set.h"
#include "word_size_model.h"
#include "char_bigrams.h"
#include "word_unigrams.h"

namespace tesseract {

class Tesseract;
class TessdataManager;

class CubeRecoContext {
 public:
  // Reading order enum type
  enum ReadOrder {
   L2R,
   R2L
  };

  // Instantiate using a Tesseract object
  CubeRecoContext(Tesseract *tess_obj);

  ~CubeRecoContext();

  // accessor functions
  inline const string & Lang() const { return lang_; }
  inline CharSet *CharacterSet() const { return char_set_; }
  const UNICHARSET *TessUnicharset() const { return tess_unicharset_; }
  inline CharClassifier *Classifier() const { return char_classifier_; }
  inline WordSizeModel *SizeModel() const { return word_size_model_; }
  inline CharBigrams *Bigrams() const { return char_bigrams_; }
  inline WordUnigrams *WordUnigramsObj() const { return word_unigrams_; }
  inline TuningParams *Params() const { return params_; }
  inline LangModel *LangMod() const { return lang_mod_; }

  // the reading order of the language
  inline ReadOrder ReadingOrder() const {
    return ((lang_ == "ara") ? R2L : L2R);
  }

  // does the language support case
  inline bool HasCase() const {
    return (lang_ != "ara" && lang_ != "hin");
  }

  inline bool Cursive() const {
    return (lang_ == "ara");
  }

  inline bool HasItalics() const {
    return (lang_ != "ara" && lang_ != "hin" && lang_ != "uk");
  }

  inline bool Contextual() const {
    return (lang_ == "ara");
  }

  // RecoContext runtime flags accessor functions
  inline bool SizeNormalization() const { return size_normalization_; }
  inline bool NoisyInput() const { return noisy_input_; }
  inline bool OOD() const { return lang_mod_->OOD(); }
  inline bool Numeric() const { return lang_mod_->Numeric(); }
  inline bool WordList() const { return lang_mod_->WordList(); }
  inline bool Punc() const { return lang_mod_->Punc(); }
  inline bool CaseSensitive() const {
    return char_classifier_->CaseSensitive();
  }

  inline void SetSizeNormalization(bool size_normalization) {
    size_normalization_ = size_normalization;
  }
  inline void SetNoisyInput(bool noisy_input) {
    noisy_input_ = noisy_input;
  }
  inline void SetOOD(bool ood_enabled) {
    lang_mod_->SetOOD(ood_enabled);
  }
  inline void SetNumeric(bool numeric_enabled) {
    lang_mod_->SetNumeric(numeric_enabled);
  }
  inline void SetWordList(bool word_list_enabled) {
    lang_mod_->SetWordList(word_list_enabled);
  }
  inline void SetPunc(bool punc_enabled) {
    lang_mod_->SetPunc(punc_enabled);
  }
  inline void SetCaseSensitive(bool case_sensitive) {
    char_classifier_->SetCaseSensitive(case_sensitive);
  }
  inline tesseract::Tesseract *TesseractObject() const {
    return tess_obj_;
  }

  // Returns the path of the data files
  bool GetDataFilePath(string *path) const;
  // Creates a CubeRecoContext object using a tesseract object. Data
  // files are loaded via the tessdata_manager, and the tesseract
  // unicharset is provided in order to map Cube's unicharset to
  // Tesseract's in the case where the two unicharsets differ.
  static CubeRecoContext *Create(Tesseract *tess_obj,
                                 TessdataManager *tessdata_manager,
                                 UNICHARSET *tess_unicharset);

 private:
  bool loaded_;
  string lang_;
  CharSet *char_set_;
  UNICHARSET *tess_unicharset_;
  WordSizeModel *word_size_model_;
  CharClassifier *char_classifier_;
  CharBigrams *char_bigrams_;
  WordUnigrams *word_unigrams_;
  TuningParams *params_;
  LangModel *lang_mod_;
  Tesseract *tess_obj_;  // CubeRecoContext does not own this pointer
  bool size_normalization_;
  bool noisy_input_;

  // Loads and initialized all the necessary components of a
  // CubeRecoContext. See .cpp for more details.
  bool Load(TessdataManager *tessdata_manager,
            UNICHARSET *tess_unicharset);
};
}

#endif  // CUBE_RECO_CONTEXT_H