diff options
author | bojar <bojar@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-10-02 18:32:18 +0400 |
---|---|---|
committer | bojar <bojar@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-10-02 18:32:18 +0400 |
commit | 5bcb34be1787ebd24dbcd3320df441fb0ac177dc (patch) | |
tree | e9c282971ec3e46ba6e27c7e542c2e32a57e2cde /irstlm | |
parent | a12bb015a78f06a67c884fb2113ebc4fe66cf3b5 (diff) |
changed fstream to istream in lmtable, so irstlm now supports reading gzippped models (via InputFileStream)
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@838 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'irstlm')
-rw-r--r-- | irstlm/src/lmtable.cpp | 14 | ||||
-rw-r--r-- | irstlm/src/lmtable.h | 12 |
2 files changed, 13 insertions, 13 deletions
diff --git a/irstlm/src/lmtable.cpp b/irstlm/src/lmtable.cpp index bb9437ed9..3a06e273e 100644 --- a/irstlm/src/lmtable.cpp +++ b/irstlm/src/lmtable.cpp @@ -59,7 +59,7 @@ lmtable::lmtable(){ //loadstd::istream& inp a lmtable from a lm file -void lmtable::load(fstream& inp){ +void lmtable::load(istream& inp){ //give a look at the header to select loading method char header[1024]; @@ -108,7 +108,7 @@ int parseWords(char *sentence, char **words, int max) //This method also loads files processed with the quantization //tool: qlm -int parseline(fstream& inp, int Order,ngram& ng,float& prob,float& bow){ +int parseline(istream& inp, int Order,ngram& ng,float& prob,float& bow){ char* words[1+ LMTMAXLEV + 1 + 1]; int howmany; @@ -135,7 +135,7 @@ int parseline(fstream& inp, int Order,ngram& ng,float& prob,float& bow){ } -void lmtable::loadcenters(fstream& inp,int Order){ +void lmtable::loadcenters(istream& inp,int Order){ char line[11]; //first read the coodebook @@ -154,7 +154,7 @@ void lmtable::loadcenters(fstream& inp,int Order){ } -void lmtable::loadtxt(fstream& inp,const char* header){ +void lmtable::loadtxt(istream& inp,const char* header){ //open input stream and prepare an input string @@ -492,7 +492,7 @@ void lmtable::savebin(const char *filename){ //manages the long header of a bin file -void lmtable::loadbinheader(fstream& inp,const char* header){ +void lmtable::loadbinheader(istream& inp,const char* header){ // read rest of header inp >> maxlev; @@ -523,7 +523,7 @@ void lmtable::loadbinheader(fstream& inp,const char* header){ //load codebook of level l -void lmtable::loadbincodebook(fstream& inp,int l){ +void lmtable::loadbincodebook(istream& inp,int l){ Pcenters[l]=new float [NumCenters[l]]; inp.read((char*)Pcenters[l],NumCenters[l] * sizeof(float)); @@ -536,7 +536,7 @@ void lmtable::loadbincodebook(fstream& inp,int l){ //load a binary lmfile -void lmtable::loadbin(fstream& inp, const char* header){ +void lmtable::loadbin(istream& inp, const char* header){ cerr << "loadbin()\n"; diff --git a/irstlm/src/lmtable.h b/irstlm/src/lmtable.h index c759527e1..76dff8d7e 100644 --- a/irstlm/src/lmtable.h +++ b/irstlm/src/lmtable.h @@ -234,17 +234,17 @@ public: void savebin(const char *filename); void dumplm(std::fstream& out,ngram ng, int ilev, int elev, int ipos,int epos); - void load(std::fstream& inp); - void loadtxt(std::fstream& inp,const char* header); - void loadbin(std::fstream& inp,const char* header); + void load(std::istream& inp); + void loadtxt(std::istream& inp,const char* header); + void loadbin(std::istream& inp,const char* header); - void loadbinheader(std::fstream& inp, const char* header); - void loadbincodebook(std::fstream& inp,int l); + void loadbinheader(std::istream& inp, const char* header); + void loadbincodebook(std::istream& inp,int l); void filter(const char* lmfile); void filter2(const char* lmfile,int buffMb=512); - void loadcenters(std::fstream& inp,int Order); + void loadcenters(std::istream& inp,int Order); double prob(ngram ng); double lprob(ngram ng); |