mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 20:46:59 +03:00
Removed previous implementation of the Web translator
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1800 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
949e565658
commit
474b1e196c
@ -1,29 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-cgi", "moses-cgi\moses-cgi.vcproj", "{5BBAC701-84F5-438E-8F54-B3391F451F2A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{13A41E11-BD00-4198-9A62-0C700BBA67B2} = {13A41E11-BD00-4198-9A62-0C700BBA67B2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tokenizer", "..\tokenizer\tokenizer.vcproj", "{13A41E11-BD00-4198-9A62-0C700BBA67B2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release|Win32.Build.0 = Release|Win32
|
||||
{13A41E11-BD00-4198-9A62-0C700BBA67B2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{13A41E11-BD00-4198-9A62-0C700BBA67B2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{13A41E11-BD00-4198-9A62-0C700BBA67B2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{13A41E11-BD00-4198-9A62-0C700BBA67B2}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,103 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 3.1.0?>
|
||||
|
||||
<ManagedProjectBuildInfo>
|
||||
<project id="moses-cgi.cdt.managedbuild.target.gnu.exe.880461730" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe">
|
||||
<configuration artifactName="moses-cgi" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.debug.862821065" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.442539703" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.626133972" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.381079048" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
|
||||
<option id="gnu.cpp.compiler.option.include.paths.1241301640" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../moses/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../irstlm/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/misc/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/dstruct/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/include""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/lm/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../tokenizer/src""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.1028025969" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="LM_SRI"/>
|
||||
<listOptionValue builtIn="false" value="LM_IRST"/>
|
||||
<listOptionValue builtIn="false" value="LM_INTERNAL"/>
|
||||
<listOptionValue builtIn="false" value="TRACE_ENABLE"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.debugging.gprof.514527174" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.warnings.allwarn.169517888" superClass="gnu.cpp.compiler.option.warnings.allwarn" value="false" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1905266391" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.888044188" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
|
||||
<option id="gnu.cpp.link.option.libs.427302130" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="pthread"/>
|
||||
<listOptionValue builtIn="false" value="z"/>
|
||||
<listOptionValue builtIn="false" value="lattice"/>
|
||||
<listOptionValue builtIn="false" value="misc"/>
|
||||
<listOptionValue builtIn="false" value="dstruct"/>
|
||||
<listOptionValue builtIn="false" value="oolm"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.paths.1718276622" superClass="gnu.cpp.link.option.paths" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../srilm/lib/cygwin""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../srilm/lib/i686""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.userobjs.551693347" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../moses/${ConfigName}/libmoses.a""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../tokenizer/${ConfigName}/libtokenizer.a""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../irstlm/lib/libirstlm.a""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.flags.1995182231" superClass="gnu.cpp.link.option.flags" value="" valueType="string"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1540394737" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"/>
|
||||
<macros/>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
<configuration artifactName="moses-cgi" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.release.1126249995" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1691856622" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1171408650" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"/>
|
||||
<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1960479367" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
|
||||
<option id="gnu.cpp.compiler.option.include.paths.1986529351" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../moses/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../irstlm/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/misc/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/dstruct/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/include""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../srilm/lm/src""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../tokenizer/src""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.542441515" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="USE_HYPO_POOL"/>
|
||||
<listOptionValue builtIn="false" value="LM_SRI"/>
|
||||
<listOptionValue builtIn="false" value="LM_IRST"/>
|
||||
<listOptionValue builtIn="false" value="LM_INTERNAL"/>
|
||||
<listOptionValue builtIn="false" value="TRACE_ENABLE"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.debugging.gprof.24360799" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.warnings.allwarn.2108427488" superClass="gnu.cpp.compiler.option.warnings.allwarn" value="false" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.285054015" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1153317521" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
|
||||
<option id="gnu.cpp.link.option.libs.1100640875" superClass="gnu.cpp.link.option.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="pthread"/>
|
||||
<listOptionValue builtIn="false" value="z"/>
|
||||
<listOptionValue builtIn="false" value="lattice"/>
|
||||
<listOptionValue builtIn="false" value="misc"/>
|
||||
<listOptionValue builtIn="false" value="dstruct"/>
|
||||
<listOptionValue builtIn="false" value="oolm"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.paths.724264639" superClass="gnu.cpp.link.option.paths" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../srilm/lib/cygwin""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../srilm/lib/i686""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.userobjs.1365891611" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../moses/${ConfigName}/libmoses.a""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../tokenizer/${ConfigName}/libtokenizer.a""/>
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../../irstlm/lib/libirstlm.a""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.flags.213483667" superClass="gnu.cpp.link.option.flags" value="" valueType="string"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1402140367" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"/>
|
||||
<macros/>
|
||||
</toolChain>
|
||||
</configuration>
|
||||
<macros/>
|
||||
</project>
|
||||
</ManagedProjectBuildInfo>
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse-cdt version="2.0"?>
|
||||
|
||||
<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake">
|
||||
<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.nullindexer" point="org.eclipse.cdt.core.CIndexer"/>
|
||||
<data>
|
||||
<item id="org.eclipse.cdt.core.pathentry">
|
||||
<pathentry kind="src" path=""/>
|
||||
<pathentry kind="out" path=""/>
|
||||
<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/>
|
||||
</item>
|
||||
</data>
|
||||
</cdtproject>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>moses-cgi</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>irstlm</project>
|
||||
<project>moses</project>
|
||||
<project>tokenizer</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,223 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="moses-cgi"
|
||||
ProjectGUID="{5BBAC701-84F5-438E-8F54-B3391F451F2A}"
|
||||
RootNamespace="mosescmd"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\src";"$(SolutionDir)..\irstlm\src";..\..\..\moses\src;"$(SolutionDir)..\tokenizer\src""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""..\..\..\moses\$(ConfigurationName)\moses.lib" zlib.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\src";"$(SolutionDir)..\irstlm\src";..\..\..\moses\src;"$(SolutionDir)..\tokenizer\src""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;USE_HYPO_POOL;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""..\..\..\moses\$(ConfigurationName)\moses.lib" zlib.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\IOStream.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Main.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TranslationAnalysis.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\IOStream.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Main.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\TranslationAnalysis.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,382 +0,0 @@
|
||||
// $Id$
|
||||
|
||||
/***********************************************************************
|
||||
Moses - factored phrase-based language decoder
|
||||
Copyright (c) 2006 University of Edinburgh
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the University of Edinburgh nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
***********************************************************************/
|
||||
|
||||
// example file on how to use moses library
|
||||
|
||||
#include <iostream>
|
||||
#include "TypeDef.h"
|
||||
#include "Util.h"
|
||||
#include "IOStream.h"
|
||||
#include "Hypothesis.h"
|
||||
#include "WordsRange.h"
|
||||
#include "TrellisPathList.h"
|
||||
#include "StaticData.h"
|
||||
#include "DummyScoreProducers.h"
|
||||
#include "InputFileStream.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
IOStream::IOStream(
|
||||
const vector<FactorType> &inputFactorOrder
|
||||
, const vector<FactorType> &outputFactorOrder
|
||||
, const FactorMask &inputFactorUsed
|
||||
, size_t nBestSize
|
||||
, const string &nBestFilePath)
|
||||
:m_inputFactorOrder(inputFactorOrder)
|
||||
,m_outputFactorOrder(outputFactorOrder)
|
||||
,m_inputFactorUsed(inputFactorUsed)
|
||||
,m_inputFile(NULL)
|
||||
,m_inputStream(&std::cin)
|
||||
,m_nBestStream(NULL)
|
||||
{
|
||||
m_surpressSingleBestOutput = false;
|
||||
if (nBestSize > 0)
|
||||
{
|
||||
if (nBestFilePath == "-")
|
||||
{
|
||||
m_nBestStream = &std::cout;
|
||||
m_surpressSingleBestOutput = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ofstream *nBestFile = new std::ofstream;
|
||||
m_nBestStream = nBestFile;
|
||||
nBestFile->open(nBestFilePath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IOStream::IOStream(const std::vector<FactorType> &inputFactorOrder
|
||||
, const std::vector<FactorType> &outputFactorOrder
|
||||
, const FactorMask &inputFactorUsed
|
||||
, size_t nBestSize
|
||||
, const std::string &nBestFilePath
|
||||
, const std::string &inputFilePath)
|
||||
:m_inputFactorOrder(inputFactorOrder)
|
||||
,m_outputFactorOrder(outputFactorOrder)
|
||||
,m_inputFactorUsed(inputFactorUsed)
|
||||
,m_inputFilePath(inputFilePath)
|
||||
,m_inputFile(new InputFileStream(inputFilePath))
|
||||
,m_nBestStream(NULL)
|
||||
{
|
||||
m_surpressSingleBestOutput = false;
|
||||
m_inputStream = m_inputFile;
|
||||
|
||||
if (nBestSize > 0)
|
||||
{
|
||||
if (nBestFilePath == "-")
|
||||
{
|
||||
m_nBestStream = &std::cout;
|
||||
m_surpressSingleBestOutput = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ofstream *nBestFile = new std::ofstream;
|
||||
m_nBestStream = nBestFile;
|
||||
nBestFile->open(nBestFilePath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IOStream::~IOStream()
|
||||
{
|
||||
if (m_inputFile != NULL)
|
||||
delete m_inputFile;
|
||||
if (m_nBestStream != NULL && !m_surpressSingleBestOutput)
|
||||
{ // outputting n-best to file, rather than stdout. need to close file and delete obj
|
||||
delete m_nBestStream;
|
||||
}
|
||||
}
|
||||
|
||||
string IOStream::GetInput()
|
||||
{
|
||||
std::string line;
|
||||
if (getline(*m_inputStream, line, '\n').eof())
|
||||
return "";
|
||||
line = Trim(line);
|
||||
return line;
|
||||
}
|
||||
|
||||
InputType*IOStream::GetInput(InputType* inputType)
|
||||
{
|
||||
if(inputType->Read(*m_inputStream, m_inputFactorOrder))
|
||||
{
|
||||
inputType->SetTranslationId(m_translationId++);
|
||||
return inputType;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete inputType;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* print surface factor only for the given phrase
|
||||
*/
|
||||
void OutputSurface(std::ostream &out, const Phrase &phrase, const std::vector<FactorType> &outputFactorOrder, bool reportAllFactors)
|
||||
{
|
||||
assert(outputFactorOrder.size() > 0);
|
||||
if (reportAllFactors == true)
|
||||
{
|
||||
out << phrase;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t size = phrase.GetSize();
|
||||
for (size_t pos = 0 ; pos < size ; pos++)
|
||||
{
|
||||
const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]);
|
||||
out << *factor;
|
||||
|
||||
for (size_t i = 1 ; i < outputFactorOrder.size() ; i++)
|
||||
{
|
||||
const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]);
|
||||
out << "|" << *factor;
|
||||
}
|
||||
out << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OutputSurface(std::ostream &out, const Hypothesis *hypo, const std::vector<FactorType> &outputFactorOrder
|
||||
,bool reportSegmentation, bool reportAllFactors)
|
||||
{
|
||||
if ( hypo != NULL)
|
||||
{
|
||||
OutputSurface(out, hypo->GetPrevHypo(), outputFactorOrder, reportSegmentation, reportAllFactors);
|
||||
OutputSurface(out, hypo->GetCurrTargetPhrase(), outputFactorOrder, reportAllFactors);
|
||||
|
||||
if (reportSegmentation == true
|
||||
&& hypo->GetCurrTargetPhrase().GetSize() > 0) {
|
||||
out << "|" << hypo->GetCurrSourceWordsRange().GetStartPos()
|
||||
<< "-" << hypo->GetCurrSourceWordsRange().GetEndPos() << "| ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IOStream::Backtrack(const Hypothesis *hypo){
|
||||
|
||||
if (hypo->GetPrevHypo() != NULL) {
|
||||
VERBOSE(3,hypo->GetId() << " <= ");
|
||||
Backtrack(hypo->GetPrevHypo());
|
||||
}
|
||||
}
|
||||
|
||||
void IOStream::OutputBestHypo(const Hypothesis *hypo, long /*translationId*/, bool reportSegmentation, bool reportAllFactors)
|
||||
{
|
||||
if (hypo != NULL)
|
||||
{
|
||||
VERBOSE(1,"BEST TRANSLATION: " << *hypo << endl);
|
||||
VERBOSE(3,"Best path: ");
|
||||
Backtrack(hypo);
|
||||
VERBOSE(3,"0" << std::endl);
|
||||
|
||||
if (!m_surpressSingleBestOutput)
|
||||
{
|
||||
OutputSurface(cout, hypo, m_outputFactorOrder, reportSegmentation, reportAllFactors);
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VERBOSE(1, "NO BEST TRANSLATION" << endl);
|
||||
if (!m_surpressSingleBestOutput)
|
||||
{
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IOStream::OutputNBestList(const TrellisPathList &nBestList, long translationId)
|
||||
{
|
||||
bool labeledOutput = StaticData::Instance().IsLabeledNBestList();
|
||||
bool includeAlignment = StaticData::Instance().NBestIncludesAlignment();
|
||||
|
||||
TrellisPathList::const_iterator iter;
|
||||
for (iter = nBestList.begin() ; iter != nBestList.end() ; ++iter)
|
||||
{
|
||||
const TrellisPath &path = **iter;
|
||||
const std::vector<const Hypothesis *> &edges = path.GetEdges();
|
||||
|
||||
// print the surface factor of the translation
|
||||
*m_nBestStream << translationId << " ||| ";
|
||||
for (int currEdge = (int)edges.size() - 1 ; currEdge >= 0 ; currEdge--)
|
||||
{
|
||||
const Hypothesis &edge = *edges[currEdge];
|
||||
OutputSurface(*m_nBestStream, edge.GetCurrTargetPhrase(), m_outputFactorOrder, false); // false for not reporting all factors
|
||||
}
|
||||
*m_nBestStream << " ||| ";
|
||||
|
||||
// print the scores in a hardwired order
|
||||
// before each model type, the corresponding command-line-like name must be emitted
|
||||
// MERT script relies on this
|
||||
|
||||
// basic distortion
|
||||
if (labeledOutput)
|
||||
*m_nBestStream << "d: ";
|
||||
*m_nBestStream << path.GetScoreBreakdown().GetScoreForProducer(StaticData::Instance().GetDistortionScoreProducer()) << " ";
|
||||
|
||||
// reordering
|
||||
vector<LexicalReordering*> rms = StaticData::Instance().GetReorderModels();
|
||||
if(rms.size() > 0)
|
||||
{
|
||||
vector<LexicalReordering*>::iterator iter;
|
||||
for(iter = rms.begin(); iter != rms.end(); ++iter)
|
||||
{
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for (size_t j = 0; j<scores.size(); ++j)
|
||||
{
|
||||
*m_nBestStream << scores[j] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lm
|
||||
const LMList& lml = StaticData::Instance().GetAllLM();
|
||||
if (lml.size() > 0) {
|
||||
if (labeledOutput)
|
||||
*m_nBestStream << "lm: ";
|
||||
LMList::const_iterator lmi = lml.begin();
|
||||
for (; lmi != lml.end(); ++lmi) {
|
||||
*m_nBestStream << path.GetScoreBreakdown().GetScoreForProducer(*lmi) << " ";
|
||||
}
|
||||
}
|
||||
|
||||
// translation components
|
||||
if (StaticData::Instance().GetInputType()==0){
|
||||
// translation components for text input
|
||||
vector<PhraseDictionary*> pds = StaticData::Instance().GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
if (labeledOutput)
|
||||
*m_nBestStream << "tm: ";
|
||||
vector<PhraseDictionary*>::iterator iter;
|
||||
for (iter = pds.begin(); iter != pds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for (size_t j = 0; j<scores.size(); ++j)
|
||||
*m_nBestStream << scores[j] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
// translation components for Confusion Network input
|
||||
// first translation component has GetNumInputScores() scores from the input Confusion Network
|
||||
// at the beginning of the vector
|
||||
vector<PhraseDictionary*> pds = StaticData::Instance().GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
vector<PhraseDictionary*>::iterator iter;
|
||||
|
||||
iter = pds.begin();
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
|
||||
size_t pd_numinputscore = (*iter)->GetNumInputScores();
|
||||
|
||||
if (pd_numinputscore){
|
||||
|
||||
if (labeledOutput)
|
||||
*m_nBestStream << "I: ";
|
||||
|
||||
for (size_t j = 0; j < pd_numinputscore; ++j)
|
||||
*m_nBestStream << scores[j] << " ";
|
||||
}
|
||||
|
||||
|
||||
for (iter = pds.begin() ; iter != pds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
|
||||
size_t pd_numinputscore = (*iter)->GetNumInputScores();
|
||||
|
||||
if (iter == pds.begin() && labeledOutput)
|
||||
*m_nBestStream << "tm: ";
|
||||
for (size_t j = pd_numinputscore; j < scores.size() ; ++j)
|
||||
*m_nBestStream << scores[j] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// word penalty
|
||||
if (labeledOutput)
|
||||
*m_nBestStream << "w: ";
|
||||
*m_nBestStream << path.GetScoreBreakdown().GetScoreForProducer(StaticData::Instance().GetWordPenaltyProducer()) << " ";
|
||||
|
||||
// generation
|
||||
vector<GenerationDictionary*> gds = StaticData::Instance().GetGenerationDictionaries();
|
||||
if (gds.size() > 0) {
|
||||
if (labeledOutput)
|
||||
*m_nBestStream << "g: ";
|
||||
vector<GenerationDictionary*>::iterator iter;
|
||||
for (iter = gds.begin(); iter != gds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for (size_t j = 0; j<scores.size(); j++) {
|
||||
*m_nBestStream << scores[j] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// total
|
||||
*m_nBestStream << "||| " << path.GetTotalScore();
|
||||
if (includeAlignment) {
|
||||
*m_nBestStream << " |||";
|
||||
for (int currEdge = (int)edges.size() - 2 ; currEdge >= 0 ; currEdge--)
|
||||
{
|
||||
const Hypothesis &edge = *edges[currEdge];
|
||||
WordsRange sourceRange = edge.GetCurrSourceWordsRange();
|
||||
WordsRange targetRange = edge.GetCurrTargetWordsRange();
|
||||
*m_nBestStream << " " << sourceRange.GetStartPos();
|
||||
if (sourceRange.GetStartPos() < sourceRange.GetEndPos()) {
|
||||
*m_nBestStream << "-" << sourceRange.GetEndPos();
|
||||
}
|
||||
*m_nBestStream << "=" << targetRange.GetStartPos();
|
||||
if (targetRange.GetStartPos() < targetRange.GetEndPos()) {
|
||||
*m_nBestStream << "-" << targetRange.GetEndPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
*m_nBestStream << endl;
|
||||
}
|
||||
|
||||
*m_nBestStream<<std::flush;
|
||||
}
|
||||
|
||||
void IOStream::ClearInStream()
|
||||
{
|
||||
m_inputStream->clear();
|
||||
}
|
||||
|
||||
void IOStream::FlushOutStream()
|
||||
{
|
||||
cout.flush();
|
||||
}
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
// $Id$
|
||||
|
||||
/***********************************************************************
|
||||
Moses - factored phrase-based language decoder
|
||||
Copyright (c) 2006 University of Edinburgh
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the University of Edinburgh nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
***********************************************************************/
|
||||
|
||||
// example file on how to use moses library
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include "TypeDef.h"
|
||||
#include "Sentence.h"
|
||||
|
||||
class FactorMask;
|
||||
class FactorCollection;
|
||||
class Hypothesis;
|
||||
class TrellisPathList;
|
||||
class InputFileStream;
|
||||
|
||||
class IOStream
|
||||
{
|
||||
protected:
|
||||
long m_translationId;
|
||||
|
||||
const std::vector<FactorType> &m_inputFactorOrder;
|
||||
const std::vector<FactorType> &m_outputFactorOrder;
|
||||
const FactorMask &m_inputFactorUsed;
|
||||
std::ostream *m_nBestStream;
|
||||
std::string m_inputFilePath;
|
||||
std::istream *m_inputStream;
|
||||
InputFileStream *m_inputFile;
|
||||
bool m_surpressSingleBestOutput;
|
||||
|
||||
public:
|
||||
IOStream(const std::vector<FactorType> &inputFactorOrder
|
||||
, const std::vector<FactorType> &outputFactorOrder
|
||||
, const FactorMask &inputFactorUsed
|
||||
, size_t nBestSize
|
||||
, const std::string &nBestFilePath);
|
||||
|
||||
IOStream(const std::vector<FactorType> &inputFactorOrder
|
||||
, const std::vector<FactorType> &outputFactorOrder
|
||||
, const FactorMask &inputFactorUsed
|
||||
, size_t nBestSize
|
||||
, const std::string &nBestFilePath
|
||||
, const std::string &inputFilePath);
|
||||
~IOStream();
|
||||
|
||||
InputType* GetInput(InputType *inputType);
|
||||
std::string GetInput();
|
||||
void OutputBestHypo(const Hypothesis *hypo, long translationId, bool reportSegmentation, bool reportAllFactors);
|
||||
void OutputNBestList(const TrellisPathList &nBestList, long translationId);
|
||||
void Backtrack(const Hypothesis *hypo);
|
||||
|
||||
void ResetTranslationId() { m_translationId = 0; }
|
||||
void ClearInStream();
|
||||
void FlushOutStream();
|
||||
|
||||
};
|
@ -1,230 +0,0 @@
|
||||
// $Id$
|
||||
|
||||
/***********************************************************************
|
||||
Moses - factored phrase-based language decoder
|
||||
Copyright (c) 2006 University of Edinburgh
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the University of Edinburgh nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
***********************************************************************/
|
||||
|
||||
// example file on how to use moses library
|
||||
|
||||
#ifdef WIN32
|
||||
// Include Visual Leak Detector
|
||||
#include <vld.h>
|
||||
#include <windows.h>
|
||||
|
||||
#else
|
||||
#define Sleep(millisec) usleep(millisec * 1000)
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <fstream>
|
||||
#include "Main.h"
|
||||
#include "TrellisPathList.h"
|
||||
#include "FactorCollection.h"
|
||||
#include "Manager.h"
|
||||
#include "Phrase.h"
|
||||
#include "Util.h"
|
||||
#include "TrellisPathList.h"
|
||||
#include "Timer.h"
|
||||
#include "IOStream.h"
|
||||
#include "Sentence.h"
|
||||
#include "ConfusionNet.h"
|
||||
#include "TranslationAnalysis.h"
|
||||
#include "Tokenizer.h"
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#else
|
||||
// those not using autoconf have to build MySQL support for now
|
||||
# define USE_MYSQL 1
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#undef max
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
//signal(SIGPIPE, SIG_IGN); // ensures the server doesn't exit once the script stops reading from the output pipe
|
||||
|
||||
IFVERBOSE(1)
|
||||
{
|
||||
TRACE_ERR("command: ");
|
||||
for(int i=0;i<argc;++i) TRACE_ERR(argv[i]<<" ");
|
||||
TRACE_ERR(endl);
|
||||
}
|
||||
|
||||
cout.setf(std::ios::fixed);
|
||||
cout.precision(3);
|
||||
cerr.setf(std::ios::fixed);
|
||||
cerr.precision(3);
|
||||
|
||||
// load data structures
|
||||
Parameter *parameter = new Parameter();
|
||||
if (!parameter->LoadParam(argc, argv))
|
||||
{
|
||||
parameter->Explain();
|
||||
delete parameter;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
if (!StaticData::LoadDataStatic(parameter))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
// set up read/writing class
|
||||
IOStream *ioStream = GetIODevice(staticData);
|
||||
|
||||
// check on weights
|
||||
vector<float> weights = staticData.GetAllWeights();
|
||||
IFVERBOSE(2) {
|
||||
TRACE_ERR("The score component vector looks like this:\n" << staticData.GetScoreIndexManager());
|
||||
TRACE_ERR("The global weight vector looks like this:");
|
||||
for (size_t j=0; j<weights.size(); j++) { TRACE_ERR(" " << weights[j]); }
|
||||
TRACE_ERR("\n");
|
||||
}
|
||||
// every score must have a weight! check that here:
|
||||
if(weights.size() != staticData.GetScoreIndexManager().GetTotalNumberOfScores()) {
|
||||
TRACE_ERR("ERROR: " << staticData.GetScoreIndexManager().GetTotalNumberOfScores() << " score components, but " << weights.size() << " weights defined" << std::endl);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (ioStream == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
// read each sentence & decode
|
||||
size_t lineCount = 0;
|
||||
while(true)
|
||||
{
|
||||
// wait for input
|
||||
string input;
|
||||
while ((input = ioStream->GetInput()).size() == 0)
|
||||
{
|
||||
ioStream->ClearInStream();
|
||||
Sleep(1000);
|
||||
}
|
||||
// tokenize input
|
||||
Tokenizer tokenizer("en");
|
||||
string inputTokenized = tokenizer.Tokenize(input);
|
||||
vector<string> sentences = Tokenize(inputTokenized, "\n");
|
||||
|
||||
std::vector<FactorType> factorOrder;
|
||||
factorOrder.push_back(0);
|
||||
|
||||
vector<string>::iterator iterSentences;
|
||||
for (iterSentences = sentences.begin() ; iterSentences != sentences.end() ; ++iterSentences)
|
||||
{
|
||||
IFVERBOSE(1)
|
||||
ResetUserTime();
|
||||
|
||||
const string &sentence = *iterSentences;
|
||||
|
||||
Sentence sourceSentence(Input);
|
||||
sourceSentence.CreateFromString(factorOrder, sentence, "|");
|
||||
|
||||
VERBOSE(2,"\nTRANSLATING(" << ++lineCount << "): " << sentence);
|
||||
|
||||
Manager manager(sourceSentence);
|
||||
manager.ProcessSentence();
|
||||
InputType *source = new Sentence(Input);
|
||||
ioStream->OutputBestHypo(manager.GetBestHypothesis(), source->GetTranslationId(),
|
||||
staticData.GetReportSegmentation(),
|
||||
staticData.GetReportAllFactors()
|
||||
);
|
||||
IFVERBOSE(2) { PrintUserTime("Best Hypothesis Generation Time:"); }
|
||||
delete source;
|
||||
|
||||
// n-best
|
||||
size_t nBestSize = staticData.GetNBestSize();
|
||||
if (nBestSize > 0)
|
||||
{
|
||||
VERBOSE(2,"WRITING " << nBestSize << " TRANSLATION ALTERNATIVES TO " << staticData.GetNBestFilePath() << endl);
|
||||
TrellisPathList nBestList;
|
||||
manager.CalcNBest(nBestSize, nBestList,staticData.GetDistinctNBest());
|
||||
ioStream->OutputNBestList(nBestList, source->GetTranslationId());
|
||||
//RemoveAllInColl(nBestList);
|
||||
|
||||
IFVERBOSE(2) { PrintUserTime("N-Best Hypotheses Generation Time:"); }
|
||||
}
|
||||
|
||||
if (staticData.IsDetailedTranslationReportingEnabled())
|
||||
{
|
||||
TranslationAnalysis::PrintTranslationAnalysis(std::cerr, manager.GetBestHypothesis());
|
||||
}
|
||||
|
||||
IFVERBOSE(2) { PrintUserTime("Sentence Decoding Time:"); }
|
||||
manager.CalcDecoderStatistics();
|
||||
ioStream->FlushOutStream();
|
||||
}
|
||||
} // while(true)
|
||||
|
||||
delete ioStream;
|
||||
|
||||
IFVERBOSE(1)
|
||||
PrintUserTime("End.");
|
||||
|
||||
#ifdef HACK_EXIT
|
||||
//This avoids that detructors are called (it can take a long time)
|
||||
exit(EXIT_SUCCESS);
|
||||
#else
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
IOStream *GetIODevice(const StaticData &staticData)
|
||||
{
|
||||
IOStream *ioStream;
|
||||
const std::vector<FactorType> &inputFactorOrder = staticData.GetInputFactorOrder()
|
||||
,&outputFactorOrder = staticData.GetOutputFactorOrder();
|
||||
FactorMask inputFactorUsed(inputFactorOrder);
|
||||
|
||||
// io
|
||||
if (staticData.GetParam("input-file").size() == 1)
|
||||
{
|
||||
VERBOSE(2,"IO from File" << endl);
|
||||
string filePath = staticData.GetParam("input-file")[0];
|
||||
|
||||
ioStream = new IOStream(inputFactorOrder, outputFactorOrder, inputFactorUsed
|
||||
, staticData.GetNBestSize()
|
||||
, staticData.GetNBestFilePath()
|
||||
, filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
VERBOSE(1,"IO from STDOUT/STDIN" << endl);
|
||||
ioStream = new IOStream(inputFactorOrder, outputFactorOrder, inputFactorUsed
|
||||
, staticData.GetNBestSize()
|
||||
, staticData.GetNBestFilePath());
|
||||
}
|
||||
ioStream->ResetTranslationId();
|
||||
|
||||
IFVERBOSE(1)
|
||||
PrintUserTime("Created input-output object");
|
||||
|
||||
return ioStream;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
// $Id$
|
||||
|
||||
/***********************************************************************
|
||||
Moses - factored phrase-based language decoder
|
||||
Copyright (c) 2006 University of Edinburgh
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the University of Edinburgh nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
***********************************************************************/
|
||||
|
||||
// example file on how to use moses library
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "StaticData.h"
|
||||
|
||||
class IOStream;
|
||||
|
||||
int main(int argc, char* argv[]);
|
||||
IOStream *GetIODevice(const StaticData &staticData);
|
@ -1,7 +0,0 @@
|
||||
bin_PROGRAMS = moses
|
||||
moses_SOURCES = Main.cpp IOStream.cpp TranslationAnalysis.cpp
|
||||
AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUSE_HYPO_POOL -I$(top_srcdir)/moses/src
|
||||
|
||||
moses_LDADD = -L$(top_srcdir)/moses/src -lmoses
|
||||
moses_DEPENDENCIES = $(top_srcdir)/moses/src/libmoses.a
|
||||
|
@ -1,112 +0,0 @@
|
||||
// $Id$
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include "StaticData.h"
|
||||
#include "Hypothesis.h"
|
||||
#include "TranslationAnalysis.h"
|
||||
|
||||
namespace TranslationAnalysis {
|
||||
|
||||
void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo)
|
||||
{
|
||||
os << std::endl << "TRANSLATION HYPOTHESIS DETAILS:" << std::endl;
|
||||
std::vector<const Hypothesis*> translationPath;
|
||||
while (hypo) {
|
||||
translationPath.push_back(hypo);
|
||||
hypo = hypo->GetPrevHypo();
|
||||
}
|
||||
std::reverse(translationPath.begin(), translationPath.end());
|
||||
|
||||
std::vector<std::string> droppedWords;
|
||||
std::vector<const Hypothesis*>::iterator tpi = translationPath.begin();
|
||||
++tpi; // skip initial translation state
|
||||
std::vector<std::string> sourceMap;
|
||||
std::vector<std::string> targetMap;
|
||||
std::vector<unsigned int> lmAcc(0);
|
||||
size_t lmCalls = 0;
|
||||
bool doLMStats = ((*tpi)->GetLMStats() != 0);
|
||||
if (doLMStats)
|
||||
lmAcc.resize((*tpi)->GetLMStats()->size(), 0);
|
||||
for (; tpi != translationPath.end(); ++tpi) {
|
||||
std::ostringstream sms;
|
||||
std::ostringstream tms;
|
||||
std::string target = (*tpi)->GetTargetPhraseStringRep();
|
||||
std::string source = (*tpi)->GetSourcePhraseStringRep();
|
||||
WordsRange twr = (*tpi)->GetCurrTargetWordsRange();
|
||||
WordsRange swr = (*tpi)->GetCurrSourceWordsRange();
|
||||
|
||||
// language model backoff stats,
|
||||
if (doLMStats) {
|
||||
std::vector<std::vector<unsigned int> >& lmstats = *(*tpi)->GetLMStats();
|
||||
std::vector<std::vector<unsigned int> >::iterator i = lmstats.begin();
|
||||
std::vector<unsigned int>::iterator acc = lmAcc.begin();
|
||||
|
||||
for (; i != lmstats.end(); ++i, ++acc) {
|
||||
std::vector<unsigned int>::iterator j = i->begin();
|
||||
lmCalls += i->size();
|
||||
for (; j != i->end(); ++j) {
|
||||
(*acc) += *j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool epsilon = false;
|
||||
if (target == "") {
|
||||
target="<EPSILON>";
|
||||
epsilon = true;
|
||||
droppedWords.push_back(source);
|
||||
}
|
||||
os << " SOURCE: " << swr << " " << source << std::endl
|
||||
<< " TRANSLATED AS: " << target << std::endl;
|
||||
size_t twr_i = twr.GetStartPos();
|
||||
size_t swr_i = swr.GetStartPos();
|
||||
if (!epsilon) { sms << twr_i; }
|
||||
if (epsilon) { tms << "del(" << swr_i << ")"; } else { tms << swr_i; }
|
||||
swr_i++; twr_i++;
|
||||
for (; twr_i <= twr.GetEndPos() && twr.GetEndPos() != NOT_FOUND; twr_i++) {
|
||||
sms << '-' << twr_i;
|
||||
}
|
||||
for (; swr_i <= swr.GetEndPos() && swr.GetEndPos() != NOT_FOUND; swr_i++) {
|
||||
tms << '-' << swr_i;
|
||||
}
|
||||
if (!epsilon) targetMap.push_back(sms.str());
|
||||
sourceMap.push_back(tms.str());
|
||||
}
|
||||
std::vector<std::string>::iterator si = sourceMap.begin();
|
||||
std::vector<std::string>::iterator ti = targetMap.begin();
|
||||
os << std::endl << "SOURCE/TARGET SPANS:";
|
||||
os << std::endl << " SOURCE:";
|
||||
for (; si != sourceMap.end(); ++si) {
|
||||
os << " " << *si;
|
||||
}
|
||||
os << std::endl << " TARGET:";
|
||||
for (; ti != targetMap.end(); ++ti) {
|
||||
os << " " << *ti;
|
||||
}
|
||||
os << std::endl << std::endl;
|
||||
if (doLMStats && lmCalls > 0) {
|
||||
std::vector<unsigned int>::iterator acc = lmAcc.begin();
|
||||
const LMList& lmlist = StaticData::Instance().GetAllLM();
|
||||
LMList::const_iterator i = lmlist.begin();
|
||||
for (; acc != lmAcc.end(); ++acc, ++i) {
|
||||
char buf[256];
|
||||
sprintf(buf, "%.4f", (double)(*acc)/(double)lmCalls);
|
||||
os << (*i)->GetScoreProducerDescription() <<", AVG N-GRAM LENGTH: " << buf << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (droppedWords.size() > 0) {
|
||||
std::vector<std::string>::iterator dwi = droppedWords.begin();
|
||||
os << std::endl << "WORDS/PHRASES DROPPED:" << std::endl;
|
||||
for (; dwi != droppedWords.end(); ++dwi) {
|
||||
os << "\tdropped=" << *dwi << std::endl;
|
||||
}
|
||||
}
|
||||
os << std::endl << "SCORES (UNWEIGHTED/WEIGHTED):" << std::endl;
|
||||
StaticData::Instance().GetScoreIndexManager().Debug_PrintLabeledWeightedScores(os, translationPath.back()->GetScoreBreakdown(), StaticData::Instance().GetAllWeights());
|
||||
os << std::endl;
|
||||
}
|
||||
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
// $Id$
|
||||
|
||||
/*
|
||||
* also see moses/SentenceStats
|
||||
*/
|
||||
|
||||
#ifndef _TRANSLATION_ANALYSIS_H_
|
||||
#define _TRANSLATION_ANALYSIS_H_
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class Hypothesis;
|
||||
|
||||
namespace TranslationAnalysis
|
||||
{
|
||||
|
||||
/***
|
||||
* print details about the translation represented in hypothesis to
|
||||
* os. Included information: phrase alignment, words dropped, scores
|
||||
*/
|
||||
void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user