This file is indexed.

/usr/include/irstlm/mdiadapt.h is in libirstlm-dev 6.00.05-2.

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
/******************************************************************************
IrstLM: IRST Language Model Toolkit
Copyright (C) 2006 Marcello Federico, ITC-irst Trento, Italy

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA

******************************************************************************/

// Adapted LM classes: extension of interp classes

#ifndef MF_MDIADAPTLM_H
#define MF_MDIADAPTLM_H

#include "ngramcache.h"
#include "normcache.h"
#include "interplm.h"

#define DONT_PRINT 1000000

namespace irstlm {
class mdiadaptlm:public interplm
{

  int adaptlev;
  interplm* forelm;
  double zeta0;
  double oovscaling;
  bool m_save_per_level;
 
  static bool mdiadaptlm_cache_enable;

protected:
  normcache *cache;

//to improve access speed
  NGRAMCACHE_t** probcache;
  NGRAMCACHE_t** backoffcache;
  int max_caching_level;
	
  int saveARPA_per_word(char *filename,int backoff=0,char* subdictfile=NULL);
  int saveARPA_per_level(char *filename,int backoff=0,char* subdictfile=NULL);
  int saveBIN_per_word(char *filename,int backoff=0,char* subdictfile=NULL,int mmap=0);
  int saveBIN_per_level(char *filename,int backoff=0,char* subdictfile=NULL,int mmap=0);
public:

  mdiadaptlm(char* ngtfile,int depth=0,TABLETYPE tt=FULL);

  inline normcache* get_zetacache() {
    return cache;
  }
  inline NGRAMCACHE_t* get_probcache(int level);
  inline NGRAMCACHE_t* get_backoffcache(int level);

  void create_caches(int mcl);
  void init_caches();
  void init_caches(int level);
  void delete_caches();
  void delete_caches(int level);

  void check_cache_levels();
  void check_cache_levels(int level);
  void reset_caches();
  void reset_caches(int level);

  void caches_stat();

  double gis_step;

  double zeta(ngram ng,int size);

  int discount(ngram ng,int size,double& fstar,double& lambda,int cv=0);

  int bodiscount(ngram ng,int size,double& fstar,double& lambda,double& bo);
	
  virtual int compute_backoff();
  virtual int compute_backoff_per_level();
  virtual int compute_backoff_per_word();

  double backunig(ngram ng);

  double foreunig(ngram ng);

  int adapt(char* ngtfile,int alev=1,double gis_step=0.4);

  int scalefact(char* ngtfile);

  int savescalefactor(char* filename);

  double scalefact(ngram ng);

  double prob(ngram ng,int size);
  double prob(ngram ng,int size,double& fstar,double& lambda, double& bo);

  double prob2(ngram ng,int size,double & fstar);

  double txclprob(ngram ng,int size);

  int saveASR(char *filename,int backoff,char* subdictfile=NULL);
  int saveMT(char *filename,int backoff,char* subdictfile=NULL,int resolution=10000000,double decay=0.999900);
	
  int saveARPA(char *filename,int backoff=0,char* subdictfile=NULL){
		if (m_save_per_level){
			cerr << " per level ...";
			return saveARPA_per_level(filename, backoff, subdictfile);
		}else{
			cerr << " per word ...";
			return saveARPA_per_word(filename, backoff, subdictfile);
		}
	}
  int saveBIN(char *filename,int backoff=0,char* subdictfile=NULL,int mmap=0){
		if (m_save_per_level){
			cerr << " per level ...";
			return saveBIN_per_level(filename, backoff, subdictfile, mmap);
		}else{
			cerr << " per word ...";
			return saveBIN_per_word(filename, backoff, subdictfile, mmap);
		}
	}
	
  inline void save_per_level(bool value){ m_save_per_level=value; }
  inline bool save_per_level() const { return m_save_per_level; }
	
  int netsize();

  ~mdiadaptlm();

  double myround(double x) {
    long int value = (long int) x;
    return (x-value)>0.500?value+1.0:(double)value;
  }

  inline static bool is_train_cache_enabled() {
    VERBOSE(3,"inline static bool is_train_cache_enabled() " << mdiadaptlm_cache_enable << std::endl);
    return mdiadaptlm_cache_enable;
  }

};

}//namespace irstlm
#endif