/usr/include/irstlm/util.h is in libirstlm-dev 5.80.03-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 | // $Id: util.h 363 2010-02-22 15:02:45Z mfederico $
#ifndef IRSTLM_UTIL_H
#define IRSTLM_UTIL_H
#include <string>
#include <fstream>
#include "gzfilebuf.h"
#include "n_gram.h"
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define UNUSED(x) { (void) x; }
#define _DEBUG_LEVEL 2
/** trace macros **/
/** verbose macros **/
#ifdef TRACE_ENABLE
#define TRACE_ERR(str) { std::cerr << str; }
#define VERBOSE(level,str) { if (_DEBUG_LEVEL){ if (_DEBUG_LEVEL >= level) { TRACE_ERR("DEBUG_LEVEL:" <<_DEBUG_LEVEL << " "); TRACE_ERR(str); } } }
#define IFVERBOSE(level) if (_DEBUG_LEVEL) if (_DEBUG_LEVEL >= level)
#else
#define VERBOSE(level,str) { }
#define IFVERBOSE(level) { }
#endif
#define LMTMAXLEV 20
#define MAX_LINE 100000
//0.000001 = 10^(-6)
//0.000000000001 = 10^(-12)
//1.000001 = 1+10^(-6)
//1.000000000001 = 1+10^(-12)
//0.999999 = 1-10^(-6)
//0.999999999999 = 1-10^(-12)
#define UPPER_SINGLE_PRECISION_OF_0 0.000001
#define UPPER_DOUBLE_PRECISION_OF_0 0.000000000001
#define UPPER_SINGLE_PRECISION_OF_1 1.000001
#define LOWER_SINGLE_PRECISION_OF_1 0.999999
#define UPPER_DOUBLE_PRECISION_OF_1 1.000000000001
#define LOWER_DOUBLE_PRECISION_OF_1 0.999999999999
std::string gettempfolder();
std::string createtempName();
void createtempfile(mfstream &fileStream, std::string &filePath, std::ios_base::openmode flags);
void removefile(const std::string &filePath);
class inputfilestream : public std::istream
{
protected:
std::streambuf *m_streambuf;
bool _good;
public:
inputfilestream(const std::string &filePath);
~inputfilestream();
bool good() {
return _good;
}
void close();
};
void *MMap(int fd, int access, off_t offset, size_t len, off_t *gap);
int Munmap(void *p,size_t len,int sync);
// A couple of utilities to measure access time
void ResetUserTime();
void PrintUserTime(const std::string &message);
double GetUserTime();
int parseWords(char *, const char **, int);
int parseline(istream& inp, int Order,ngram& ng,float& prob,float& bow);
#endif
|