changes to make LMs work in Windows

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@949 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2006-11-04 11:55:47 +00:00
parent 8d97bce927
commit e8cd4e752f
3 changed files with 21 additions and 6 deletions

View File

@ -61,7 +61,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="&quot;$(SolutionDir)\$(ConfigurationName)\moses.lib&quot; &quot;$(SolutionDir)\$(ConfigurationName)\irstlm.lib&quot; zdll.lib" AdditionalDependencies="&quot;$(SolutionDir)\$(ConfigurationName)\moses.lib&quot; &quot;$(SolutionDir)\$(ConfigurationName)\irstlm.lib&quot; zdll.lib &quot;$(SolutionDir)..\srilm\lib\cygwin\libdstruct.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\libflm.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\liblattice.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\liboolm.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\libmisc.a&quot;"
OutputFile="$(ProjectDir)$(ConfigurationName)\$(ProjectName).exe" OutputFile="$(ProjectDir)$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
@ -137,7 +137,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="&quot;$(SolutionDir)\$(ConfigurationName)\moses.lib&quot; &quot;$(SolutionDir)\$(ConfigurationName)\irstlm.lib&quot; zdll.lib" AdditionalDependencies="&quot;$(SolutionDir)\$(ConfigurationName)\moses.lib&quot; &quot;$(SolutionDir)\$(ConfigurationName)\irstlm.lib&quot; zdll.lib &quot;$(SolutionDir)..\srilm\lib\cygwin\libdstruct.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\libflm.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\liblattice.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\liboolm.a&quot; &quot;$(SolutionDir)..\srilm\lib\cygwin\libmisc.a&quot;"
OutputFile="$(ProjectDir)$(ConfigurationName)\$(ProjectName).exe" OutputFile="$(ProjectDir)$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"

View File

@ -40,7 +40,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)..\mysqlpp\lib&quot;;&quot;$(SolutionDir)..\irstlm\src&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)..\mysqlpp\lib&quot;;&quot;$(SolutionDir)..\irstlm\src&quot;;&quot;$(SolutionDir)..\srilm\misc\src&quot;;&quot;$(SolutionDir)..\srilm\dstruct\src&quot;;&quot;$(SolutionDir)..\srilm\include&quot;;&quot;$(SolutionDir)..\srilm\lm\src&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_IRST;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_IRST;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -106,7 +106,7 @@
InlineFunctionExpansion="2" InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="&quot;$(SolutionDir)..\mysqlpp\lib&quot;;&quot;$(SolutionDir)..\irstlm\src&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)..\mysqlpp\lib&quot;;&quot;$(SolutionDir)..\irstlm\src&quot;;&quot;$(SolutionDir)..\srilm\misc\src&quot;;&quot;$(SolutionDir)..\srilm\dstruct\src&quot;;&quot;$(SolutionDir)..\srilm\include&quot;;&quot;$(SolutionDir)..\srilm\lm\src&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_IRST;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_IRST;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
@ -243,6 +243,10 @@
RelativePath=".\src\LanguageModelSkip.cpp" RelativePath=".\src\LanguageModelSkip.cpp"
> >
</File> </File>
<File
RelativePath=".\src\LanguageModelSRI.cpp"
>
</File>
<File <File
RelativePath=".\src\LatticePath.cpp" RelativePath=".\src\LatticePath.cpp"
> >
@ -521,6 +525,10 @@
RelativePath=".\src\LanguageModelSkip.h" RelativePath=".\src\LanguageModelSkip.h"
> >
</File> </File>
<File
RelativePath=".\src\LanguageModelSRI.h"
>
</File>
<File <File
RelativePath=".\src\LatticePath.h" RelativePath=".\src\LatticePath.h"
> >

View File

@ -63,8 +63,13 @@ void LanguageModelIRST::Load(const std::string &filePath
// Open the input file (possibly gzipped) and load the (possibly binary) model // Open the input file (possibly gzipped) and load the (possibly binary) model
InputFileStream inp(filePath); InputFileStream inp(filePath);
m_lmtb = new lmtable; m_lmtb = new lmtable;
m_lmtb->load(inp,filePath.c_str(),1);
#ifdef WIN32
m_lmtb->load(inp);
#else
m_lmtb->load(inp,filePath.c_str(),1);
#endif
m_lmtb_ng=new ngram(m_lmtb->dict); m_lmtb_ng=new ngram(m_lmtb->dict);
m_lmtb_size=m_lmtb->maxlevel(); m_lmtb_size=m_lmtb->maxlevel();
@ -159,8 +164,10 @@ float LanguageModelIRST::GetValue(const vector<const Word*> &contextFactor, Stat
const void LanguageModelIRST::CleanUpAfterSentenceProcessing(){ const void LanguageModelIRST::CleanUpAfterSentenceProcessing(){
cerr << "reset caches and mmap\n"; cerr << "reset caches and mmap\n";
#ifndef WIN32
m_lmtb->reset_caches(); m_lmtb->reset_caches();
m_lmtb->reset_mmap(); m_lmtb->reset_mmap();
#endif
} }
const void LanguageModelIRST::InitializeBeforeSentenceProcessing(){ const void LanguageModelIRST::InitializeBeforeSentenceProcessing(){