#include #include #include #define VOCAB_SIZE 25672 using namespace std; using std::cout; using std::endl; using std::cerr; void read_priors(char* filename, float array[][VOCAB_SIZE], int index) { string line; //float prob; ifstream lmfile (filename); if (lmfile.is_open()) { int word=0; while(! lmfile.eof() ) { getline (lmfile,line); array[index][word] = atof(line.c_str()); word++; printf("%f\n",array[index][word]); } lmfile.close(); } else cout << "Unable to open file."; } int main () { float priors[5][VOCAB_SIZE]; read_priors("lm1probs",priors,0); //read_priors("lm2probs",priors,1); //read_priors("lm3probs",priors,2); //read_priors("lm4probs",priors,3); //read_priors("lm5probs",priors,4); return 0; }