Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <fishandfrolick@gmail.com>2012-07-31 05:21:48 +0400
committerHieu Hoang <fishandfrolick@gmail.com>2012-07-31 05:21:48 +0400
commita1ab8e354adc61e2c38b343de733048f5d8c88fc (patch)
treec478ecf38c8eecf49620be6d98c926d28b2ef728 /phrase-extract
parent379baad8790bc6bad01945ce54ac378e0130c47d (diff)
cleanup of variables. Need to delete temporary files
Diffstat (limited to 'phrase-extract')
-rw-r--r--phrase-extract/score.cpp20
-rw-r--r--phrase-extract/score.h2
-rw-r--r--phrase-extract/statistics.cpp6
3 files changed, 14 insertions, 14 deletions
diff --git a/phrase-extract/score.cpp b/phrase-extract/score.cpp
index eac762de7..4e395a917 100644
--- a/phrase-extract/score.cpp
+++ b/phrase-extract/score.cpp
@@ -75,7 +75,7 @@ void outputPhrasePair(const PhraseAlignmentCollection &phrasePair, float, int, o
double computeLexicalTranslation( const PHRASE &, const PHRASE &, PhraseAlignment * );
double computeUnalignedPenalty( const PHRASE &, const PHRASE &, PhraseAlignment * );
set<string> functionWordList;
-void loadFunctionWords( const char* fileNameFunctionWords );
+void loadFunctionWords( const string &fileNameFunctionWords );
double computeUnalignedFWPenalty( const PHRASE &, const PHRASE &, PhraseAlignment * );
void calcNTLengthProb(const vector< PhraseAlignment* > &phrasePairs
, map<size_t, map<size_t, float> > &sourceProb
@@ -92,11 +92,11 @@ int main(int argc, char* argv[])
cerr << "syntax: score extract lex phrase-table [--Inverse] [--Hierarchical] [--LogProb] [--NegLogProb] [--NoLex] [--GoodTuring] [--KneserNey] [--WordAlignment] [--UnalignedPenalty] [--UnalignedFunctionWordPenalty function-word-file] [--MinCountHierarchical count] [--OutputNTLengths] [--PCFG] [--UnpairedExtractFormat] [--ConditionOnTargetLHS]\n";
exit(1);
}
- char* fileNameExtract = argv[1];
- char* fileNameLex = argv[2];
- char* fileNamePhraseTable = argv[3];
+ string fileNameExtract = argv[1];
+ string fileNameLex = argv[2];
+ string fileNamePhraseTable = argv[3];
string fileNameCountOfCounts;
- char* fileNameFunctionWords;
+ string fileNameFunctionWords;
for(int i=4; i<argc; i++) {
if (strcmp(argv[i],"inverse") == 0 || strcmp(argv[i],"--Inverse") == 0) {
@@ -183,7 +183,7 @@ int main(int argc, char* argv[])
// output file: phrase translation table
ostream *phraseTableFile;
- if (strcmp(fileNamePhraseTable, "-") == 0) {
+ if (fileNamePhraseTable == "-") {
phraseTableFile = &cout;
}
else {
@@ -601,11 +601,11 @@ double computeUnalignedFWPenalty( const PHRASE &phraseS, const PHRASE &phraseT,
return unaligned;
}
-void loadFunctionWords( const char *fileName )
+void loadFunctionWords( const string &fileName )
{
cerr << "Loading function word list from " << fileName;
ifstream inFile;
- inFile.open(fileName);
+ inFile.open(fileName.c_str());
if (inFile.fail()) {
cerr << " - ERROR: could not open file\n";
exit(1);
@@ -649,11 +649,11 @@ double computeLexicalTranslation( const PHRASE &phraseS, const PHRASE &phraseT,
return lexScore;
}
-void LexicalTable::load( char *fileName )
+void LexicalTable::load( const string &fileName )
{
cerr << "Loading lexical translation table from " << fileName;
ifstream inFile;
- inFile.open(fileName);
+ inFile.open(fileName.c_str());
if (inFile.fail()) {
cerr << " - ERROR: could not open file\n";
exit(1);
diff --git a/phrase-extract/score.h b/phrase-extract/score.h
index ed9adc18c..f720a32d2 100644
--- a/phrase-extract/score.h
+++ b/phrase-extract/score.h
@@ -65,7 +65,7 @@ class LexicalTable
{
public:
std::map< WORD_ID, std::map< WORD_ID, double > > ltable;
- void load( char[] );
+ void load( const std::string &filePath );
double permissiveLookup( WORD_ID wordS, WORD_ID wordT ) {
// cout << endl << vcbS.getWord( wordS ) << "-" << vcbT.getWord( wordT ) << ":";
if (ltable.find( wordS ) == ltable.end()) return 1.0;
diff --git a/phrase-extract/statistics.cpp b/phrase-extract/statistics.cpp
index d39a05d3b..563fc4f90 100644
--- a/phrase-extract/statistics.cpp
+++ b/phrase-extract/statistics.cpp
@@ -310,11 +310,11 @@ bool PhraseAlignment::equals( const PhraseAlignment& other )
return true;
}
-void LexicalTable::load( char *fileName )
+void LexicalTable::load( const string &filePath )
{
- cerr << "Loading lexical translation table from " << fileName;
+ cerr << "Loading lexical translation table from " << filePath;
ifstream inFile;
- inFile.open(fileName);
+ inFile.open(filePath.c_str());
if (inFile.fail()) {
cerr << " - ERROR: could not open file\n";
exit(1);