Copy in changes from the chart_merge branch (doing it manually because the

server doesn't seem to support subversion's --reintegrate option).


git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3078 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2010-04-08 17:16:10 +00:00
parent 5f1fd96111
commit c117ef7c17
192 changed files with 15215 additions and 1277 deletions

View File

@ -0,0 +1,199 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="CreateOnDisk"
ProjectGUID="{88AE90C9-72D2-42ED-8389-770ACDCD4308}"
RootNamespace="CreateOnDisk"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<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"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(OutDir)\moses.lib&quot; &quot;$(OutDir)\OnDiskPt.lib&quot; zdll.lib $(NOINHERIT)"
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="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"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(OutDir)\moses.lib&quot; &quot;$(OutDir)\OnDiskPt.lib&quot; zdll.lib $(NOINHERIT)"
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="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\Main.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\Main.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>

View File

@ -0,0 +1,340 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1C62016010F010C700146F11 /* libOnDiskPt.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C62015E10F0108600146F11 /* libOnDiskPt.a */; };
1CCE342810ECC24800F81933 /* Main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CCE342710ECC24800F81933 /* Main.cpp */; };
1CCE352210ECD44F00F81933 /* libmoses.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CCE351D10ECD3E300F81933 /* libmoses.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
1C06EB2810F0C83700192BAB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1C62015910F0108600146F11 /* OnDiskPt.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = OnDiskPt;
};
1C62015D10F0108600146F11 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1C62015910F0108600146F11 /* OnDiskPt.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D2AAC046055464E500DB518D;
remoteInfo = OnDiskPt;
};
1CCE351C10ECD3E300F81933 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1CCE351810ECD3E300F81933 /* moses.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D2AAC046055464E500DB518D;
remoteInfo = moses;
};
1CCE351E10ECD40B00F81933 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1CCE351810ECD3E300F81933 /* moses.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = moses;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
8DD76F690486A84900D96B5E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1C62015910F0108600146F11 /* OnDiskPt.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OnDiskPt.xcodeproj; path = ../OnDiskPt/OnDiskPt.xcodeproj; sourceTree = SOURCE_ROOT; };
1C9536D910EE1EB200BFA19C /* CreateOnDisk */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CreateOnDisk; sourceTree = BUILT_PRODUCTS_DIR; };
1CCE342610ECC24800F81933 /* Main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Main.h; path = src/Main.h; sourceTree = "<group>"; };
1CCE342710ECC24800F81933 /* Main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Main.cpp; path = src/Main.cpp; sourceTree = "<group>"; };
1CCE351810ECD3E300F81933 /* moses.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = moses.xcodeproj; path = ../moses/moses.xcodeproj; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DD76F660486A84900D96B5E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1C62016010F010C700146F11 /* libOnDiskPt.a in Frameworks */,
1CCE352210ECD44F00F81933 /* libmoses.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* CreateOnDisk */ = {
isa = PBXGroup;
children = (
1C62015910F0108600146F11 /* OnDiskPt.xcodeproj */,
1CCE351810ECD3E300F81933 /* moses.xcodeproj */,
08FB7795FE84155DC02AAC07 /* Source */,
C6859E8C029090F304C91782 /* Documentation */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = CreateOnDisk;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
1CCE342710ECC24800F81933 /* Main.cpp */,
1CCE342610ECC24800F81933 /* Main.h */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1C9536D910EE1EB200BFA19C /* CreateOnDisk */,
);
name = Products;
sourceTree = "<group>";
};
1C62015A10F0108600146F11 /* Products */ = {
isa = PBXGroup;
children = (
1C62015E10F0108600146F11 /* libOnDiskPt.a */,
);
name = Products;
sourceTree = "<group>";
};
1CCE351910ECD3E300F81933 /* Products */ = {
isa = PBXGroup;
children = (
1CCE351D10ECD3E300F81933 /* libmoses.a */,
);
name = Products;
sourceTree = "<group>";
};
C6859E8C029090F304C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
);
name = Documentation;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8DD76F620486A84900D96B5E /* CreateOnDisk */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "CreateOnDisk" */;
buildPhases = (
8DD76F640486A84900D96B5E /* Sources */,
8DD76F660486A84900D96B5E /* Frameworks */,
8DD76F690486A84900D96B5E /* CopyFiles */,
);
buildRules = (
);
dependencies = (
1CCE351F10ECD40B00F81933 /* PBXTargetDependency */,
1C06EB2910F0C83700192BAB /* PBXTargetDependency */,
);
name = CreateOnDisk;
productInstallPath = "$(HOME)/bin";
productName = CreateOnDisk;
productReference = 1C9536D910EE1EB200BFA19C /* CreateOnDisk */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "CreateOnDisk" */;
compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* CreateOnDisk */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 1CCE351910ECD3E300F81933 /* Products */;
ProjectRef = 1CCE351810ECD3E300F81933 /* moses.xcodeproj */;
},
{
ProductGroup = 1C62015A10F0108600146F11 /* Products */;
ProjectRef = 1C62015910F0108600146F11 /* OnDiskPt.xcodeproj */;
},
);
projectRoot = "";
targets = (
8DD76F620486A84900D96B5E /* CreateOnDisk */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
1C62015E10F0108600146F11 /* libOnDiskPt.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libOnDiskPt.a;
remoteRef = 1C62015D10F0108600146F11 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1CCE351D10ECD3E300F81933 /* libmoses.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libmoses.a;
remoteRef = 1CCE351C10ECD3E300F81933 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXSourcesBuildPhase section */
8DD76F640486A84900D96B5E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1CCE342810ECC24800F81933 /* Main.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
1C06EB2910F0C83700192BAB /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = OnDiskPt;
targetProxy = 1C06EB2810F0C83700192BAB /* PBXContainerItemProxy */;
};
1CCE351F10ECD40B00F81933 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = moses;
targetProxy = 1CCE351E10ECD40B00F81933 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
1DEB923208733DC60010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"_GLIBCXX_DEBUG=1",
"_GLIBCXX_DEBUG_PEDANTIC=1",
);
INSTALL_PATH = /usr/local/bin;
LIBRARY_SEARCH_PATHS = (
"../irstlm/lib/i386-apple-darwin9.0/",
"../moses/build//**",
../srilm/lib/macosx,
/usr/local/BerkeleyDB.4.7/lib,
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
OTHER_LDFLAGS = (
"-lflm",
"-lmisc",
"-loolm",
"-ldstruct",
"-lz",
"-lirstlm",
"-ldb_cxx",
"-ldb",
);
PRODUCT_NAME = CreateOnDisk;
};
name = Debug;
};
1DEB923308733DC60010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
INSTALL_PATH = /usr/local/bin;
LIBRARY_SEARCH_PATHS = (
"../irstlm/lib/i386-apple-darwin9.0/",
"../moses/build//**",
../srilm/lib/macosx,
/usr/local/BerkeleyDB.4.7/lib,
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
OTHER_LDFLAGS = (
"-lflm",
"-lmisc",
"-loolm",
"-ldstruct",
"-lz",
"-lirstlm",
"-ldb_cxx",
"-ldb",
);
PRODUCT_NAME = CreateOnDisk;
};
name = Release;
};
1DEB923608733DC60010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-lz";
PREBINDING = NO;
SDKROOT = macosx10.5;
};
name = Debug;
};
1DEB923708733DC60010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_LDFLAGS = "-lz";
PREBINDING = NO;
SDKROOT = macosx10.5;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "CreateOnDisk" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB923208733DC60010E9CD /* Debug */,
1DEB923308733DC60010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "CreateOnDisk" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB923608733DC60010E9CD /* Debug */,
1DEB923708733DC60010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}

239
CreateOnDisk/src/Main.cpp Normal file
View File

@ -0,0 +1,239 @@
#undef _GLIBCXX_DEBUG
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include "../../moses/src/InputFileStream.h"
#include "../../moses/src/Util.h"
#include "../../moses/src/UserMessage.h"
#include "../../OnDiskPt/src/OnDiskWrapper.h"
#include "../../OnDiskPt/src/SourcePhrase.h"
#include "../../OnDiskPt/src/TargetPhrase.h"
#include "../../OnDiskPt/src/TargetPhraseCollection.h"
#include "../../OnDiskPt/src/Word.h"
#include "../../OnDiskPt/src/Vocab.h"
#include "Main.h"
using namespace std;
using namespace OnDiskPt;
int main (int argc, char * const argv[])
{
// insert code here...
Moses::ResetUserTime();
Moses::PrintUserTime("Starting");
assert(argc == 8);
int numSourceFactors = Moses::Scan<int>(argv[1])
, numTargetFactors = Moses::Scan<int>(argv[2])
, numScores = Moses::Scan<int>(argv[3])
, tableLimit = Moses::Scan<int>(argv[4]);
TargetPhraseCollection::s_sortScoreInd = Moses::Scan<int>(argv[5]);
const string filePath = argv[6]
,destPath = argv[7];
Moses::InputFileStream inStream(filePath);
OnDiskWrapper onDiskWrapper;
bool retDb = onDiskWrapper.BeginSave(destPath, numSourceFactors, numTargetFactors, numScores);
assert(retDb);
PhraseNode &rootNode = onDiskWrapper.GetRootSourceNode();
size_t lineNum = 0;
char line[100000];
//while(getline(inStream, line))
while(inStream.getline(line, 100000))
{
lineNum++;
if (lineNum%1000 == 0) cerr << "." << flush;
if (lineNum%10000 == 0) cerr << ":" << flush;
if (lineNum%100000 == 0) cerr << lineNum << flush;
//cerr << lineNum << " " << line << endl;
std::vector<float> misc;
SourcePhrase sourcePhrase;
TargetPhrase *targetPhrase = new TargetPhrase(numScores);
Tokenize(sourcePhrase, *targetPhrase, line, onDiskWrapper, numScores, misc);
assert(misc.size() == onDiskWrapper.GetNumCounts());
rootNode.AddTargetPhrase(sourcePhrase, targetPhrase, onDiskWrapper, tableLimit, misc);
}
rootNode.Save(onDiskWrapper, 0, tableLimit);
onDiskWrapper.EndSave();
Moses::PrintUserTime("Finished");
//pause();
return 0;
} // main()
bool Flush(const OnDiskPt::SourcePhrase *prevSourcePhrase, const OnDiskPt::SourcePhrase *currSourcePhrase)
{
if (prevSourcePhrase == NULL)
return false;
assert(currSourcePhrase);
bool ret = (*currSourcePhrase > *prevSourcePhrase);
//cerr << *prevSourcePhrase << endl << *currSourcePhrase << " " << ret << endl << endl;
return ret;
}
void Tokenize(SourcePhrase &sourcePhrase, TargetPhrase &targetPhrase, char *line, OnDiskWrapper &onDiskWrapper, int numScores, vector<float> &misc)
{
size_t scoreInd = 0;
// MAIN LOOP
size_t stage = 0;
/* 0 = source phrase
1 = target phrase
2 = align
3 = scores
4 = count
*/
char *tok = strtok (line," ");
while (tok != NULL)
{
if (0 == strcmp(tok, "|||"))
{
++stage;
}
else
{
switch (stage)
{
case 0:
{
Tokenize(sourcePhrase, tok, true, true, onDiskWrapper);
break;
}
case 1:
{
Tokenize(targetPhrase, tok, false, true, onDiskWrapper);
break;
}
case 2:
{
targetPhrase.Create1AlignFromString(tok);
break;
}
case 3:
{
float score = Moses::Scan<float>(tok);
targetPhrase.SetScore(score, scoreInd);
++scoreInd;
break;
}
case 4:
++stage;
break;
case 5:
{ // count info. Only store the 2nd one
if (misc.size() == 0)
{
float val = Moses::Scan<float>(tok);
misc.push_back(val);
}
++stage;
break;
}
default:
assert(false);
break;
}
}
tok = strtok (NULL, " ");
} // while (tok != NULL)
assert(scoreInd == numScores);
targetPhrase.SortAlign();
} // Tokenize()
void Tokenize(OnDiskPt::Phrase &phrase
, const std::string &token, bool addSourceNonTerm, bool addTargetNonTerm
, OnDiskPt::OnDiskWrapper &onDiskWrapper)
{
bool nonTerm = false;
size_t tokSize = token.size();
int comStr =token.compare(0, 1, "[");
if (comStr == 0)
{
comStr = token.compare(tokSize - 1, 1, "]");
nonTerm = comStr == 0;
}
if (nonTerm)
{ // non-term
size_t splitPos = token.find_first_of("[", 2);
string wordStr = token.substr(0, splitPos);
if (splitPos == string::npos)
{ // lhs - only 1 word
Word *word = new Word();
word->CreateFromString(wordStr, onDiskWrapper.GetVocab());
phrase.AddWord(word);
}
else
{ // source & target non-terms
if (addSourceNonTerm)
{
Word *word = new Word();
word->CreateFromString(wordStr, onDiskWrapper.GetVocab());
phrase.AddWord(word);
}
wordStr = token.substr(splitPos, tokSize - splitPos);
if (addTargetNonTerm)
{
Word *word = new Word();
word->CreateFromString(wordStr, onDiskWrapper.GetVocab());
phrase.AddWord(word);
}
}
}
else
{ // term
Word *word = new Word();
word->CreateFromString(token, onDiskWrapper.GetVocab());
phrase.AddWord(word);
}
}
void InsertTargetNonTerminals(std::vector<std::string> &sourceToks, const std::vector<std::string> &targetToks, const ::AlignType &alignments)
{
for (int ind = alignments.size() - 1; ind >= 0; --ind)
{
const ::AlignPair &alignPair = alignments[ind];
size_t sourcePos = alignPair.first
,targetPos = alignPair.second;
const string &target = targetToks[targetPos];
sourceToks.insert(sourceToks.begin() + sourcePos + 1, target);
}
}
class AlignOrderer
{
public:
bool operator()(const ::AlignPair &a, const ::AlignPair &b) const
{
return a.first < b.first;
}
};
void SortAlign(::AlignType &alignments)
{
std::sort(alignments.begin(), alignments.end(), AlignOrderer());
}

28
CreateOnDisk/src/Main.h Normal file
View File

@ -0,0 +1,28 @@
#pragma once
/*
* Main.h
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <string>
#include "../../OnDiskPt/src/SourcePhrase.h"
#include "../../OnDiskPt/src/TargetPhrase.h"
typedef std::pair<size_t, size_t> AlignPair;
typedef std::vector<AlignPair> AlignType;
void Tokenize(OnDiskPt::Phrase &phrase
, const std::string &token, bool addSourceNonTerm, bool addTargetNonTerm
, OnDiskPt::OnDiskWrapper &onDiskWrapper);
void Tokenize(OnDiskPt::SourcePhrase &sourcePhrase, OnDiskPt::TargetPhrase &targetPhrase
, char *line, OnDiskPt::OnDiskWrapper &onDiskWrapper
, int numScores
, std::vector<float> &misc);
void InsertTargetNonTerminals(std::vector<std::string> &sourceToks, const std::vector<std::string> &targetToks, const AlignType &alignments);
void SortAlign(AlignType &alignments);
bool Flush(const OnDiskPt::SourcePhrase *prevSource, const OnDiskPt::SourcePhrase *currSource);

View File

@ -0,0 +1,9 @@
bin_PROGRAMS = CreateOnDiskPt
CreateOnDiskPt_SOURCES = Main.cpp
AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUSE_HYPO_POOL -I$(top_srcdir)/moses/src
CreateOnDiskPt_LDADD = -L$(top_srcdir)/OnDiskPt/src -L$(top_srcdir)/moses/src -lOnDiskPt -lmoses
CreateOnDiskPt_DEPENDENCIES = $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a $(top_srcdir)/moses/src/libmoses.la

View File

@ -11,4 +11,4 @@ endif
if WITH_SERVER
SERVER = server
endif
SUBDIRS = moses/src moses-cmd/src misc $(MERT) $(SERVER)
SUBDIRS = moses/src moses-chart/src OnDiskPt/src moses-cmd/src misc moses-chart-cmd/src CreateOnDisk/src $(MERT) $(SERVER)

231
OnDiskPt/OnDiskPt.vcproj Normal file
View File

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="OnDiskPt"
ProjectGUID="{8B07671B-CBAF-4514-AFFD-CE238CD427E9}"
RootNamespace="OnDiskPt"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<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\OnDiskWrapper.cpp"
>
</File>
<File
RelativePath=".\src\Phrase.cpp"
>
</File>
<File
RelativePath=".\src\PhraseNode.cpp"
>
</File>
<File
RelativePath=".\src\SourcePhrase.cpp"
>
</File>
<File
RelativePath=".\src\TargetPhrase.cpp"
>
</File>
<File
RelativePath=".\src\TargetPhraseCollection.cpp"
>
</File>
<File
RelativePath=".\src\Vocab.cpp"
>
</File>
<File
RelativePath=".\src\Word.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\OnDiskWrapper.h"
>
</File>
<File
RelativePath=".\src\Phrase.h"
>
</File>
<File
RelativePath=".\src\PhraseNode.h"
>
</File>
<File
RelativePath=".\src\SourcePhrase.h"
>
</File>
<File
RelativePath=".\src\TargetPhrase.h"
>
</File>
<File
RelativePath=".\src\TargetPhraseCollection.h"
>
</File>
<File
RelativePath=".\src\Vocab.h"
>
</File>
<File
RelativePath=".\src\Word.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>

View File

@ -0,0 +1,258 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1C62013310F0105300146F11 /* OnDiskWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62012310F0105300146F11 /* OnDiskWrapper.cpp */; };
1C62013410F0105300146F11 /* OnDiskWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62012410F0105300146F11 /* OnDiskWrapper.h */; };
1C62013510F0105300146F11 /* Phrase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62012510F0105300146F11 /* Phrase.cpp */; };
1C62013610F0105300146F11 /* Phrase.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62012610F0105300146F11 /* Phrase.h */; };
1C62013710F0105300146F11 /* PhraseNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62012710F0105300146F11 /* PhraseNode.cpp */; };
1C62013810F0105300146F11 /* PhraseNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62012810F0105300146F11 /* PhraseNode.h */; };
1C62013910F0105300146F11 /* SourcePhrase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62012910F0105300146F11 /* SourcePhrase.cpp */; };
1C62013A10F0105300146F11 /* SourcePhrase.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62012A10F0105300146F11 /* SourcePhrase.h */; };
1C62013B10F0105300146F11 /* TargetPhrase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62012B10F0105300146F11 /* TargetPhrase.cpp */; };
1C62013C10F0105300146F11 /* TargetPhrase.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62012C10F0105300146F11 /* TargetPhrase.h */; };
1C62013D10F0105300146F11 /* TargetPhraseCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62012D10F0105300146F11 /* TargetPhraseCollection.cpp */; };
1C62013E10F0105300146F11 /* TargetPhraseCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62012E10F0105300146F11 /* TargetPhraseCollection.h */; };
1C62013F10F0105300146F11 /* Vocab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62012F10F0105300146F11 /* Vocab.cpp */; };
1C62014010F0105300146F11 /* Vocab.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62013010F0105300146F11 /* Vocab.h */; };
1C62014110F0105300146F11 /* Word.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C62013110F0105300146F11 /* Word.cpp */; };
1C62014210F0105300146F11 /* Word.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C62013210F0105300146F11 /* Word.h */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1C62012210F0105300146F11 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Makefile.am; path = src/Makefile.am; sourceTree = "<group>"; };
1C62012310F0105300146F11 /* OnDiskWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OnDiskWrapper.cpp; path = src/OnDiskWrapper.cpp; sourceTree = "<group>"; };
1C62012410F0105300146F11 /* OnDiskWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OnDiskWrapper.h; path = src/OnDiskWrapper.h; sourceTree = "<group>"; };
1C62012510F0105300146F11 /* Phrase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Phrase.cpp; path = src/Phrase.cpp; sourceTree = "<group>"; };
1C62012610F0105300146F11 /* Phrase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Phrase.h; path = src/Phrase.h; sourceTree = "<group>"; };
1C62012710F0105300146F11 /* PhraseNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseNode.cpp; path = src/PhraseNode.cpp; sourceTree = "<group>"; };
1C62012810F0105300146F11 /* PhraseNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhraseNode.h; path = src/PhraseNode.h; sourceTree = "<group>"; };
1C62012910F0105300146F11 /* SourcePhrase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SourcePhrase.cpp; path = src/SourcePhrase.cpp; sourceTree = "<group>"; };
1C62012A10F0105300146F11 /* SourcePhrase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SourcePhrase.h; path = src/SourcePhrase.h; sourceTree = "<group>"; };
1C62012B10F0105300146F11 /* TargetPhrase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TargetPhrase.cpp; path = src/TargetPhrase.cpp; sourceTree = "<group>"; };
1C62012C10F0105300146F11 /* TargetPhrase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TargetPhrase.h; path = src/TargetPhrase.h; sourceTree = "<group>"; };
1C62012D10F0105300146F11 /* TargetPhraseCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TargetPhraseCollection.cpp; path = src/TargetPhraseCollection.cpp; sourceTree = "<group>"; };
1C62012E10F0105300146F11 /* TargetPhraseCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TargetPhraseCollection.h; path = src/TargetPhraseCollection.h; sourceTree = "<group>"; };
1C62012F10F0105300146F11 /* Vocab.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Vocab.cpp; path = src/Vocab.cpp; sourceTree = "<group>"; };
1C62013010F0105300146F11 /* Vocab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Vocab.h; path = src/Vocab.h; sourceTree = "<group>"; };
1C62013110F0105300146F11 /* Word.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Word.cpp; path = src/Word.cpp; sourceTree = "<group>"; };
1C62013210F0105300146F11 /* Word.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Word.h; path = src/Word.h; sourceTree = "<group>"; };
D2AAC046055464E500DB518D /* libOnDiskPt.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOnDiskPt.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
D289987405E68DCB004EDB86 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* OnDiskPt */ = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07 /* Source */,
C6A0FF2B0290797F04C91782 /* Documentation */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = OnDiskPt;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
1C62012210F0105300146F11 /* Makefile.am */,
1C62012310F0105300146F11 /* OnDiskWrapper.cpp */,
1C62012410F0105300146F11 /* OnDiskWrapper.h */,
1C62012510F0105300146F11 /* Phrase.cpp */,
1C62012610F0105300146F11 /* Phrase.h */,
1C62012710F0105300146F11 /* PhraseNode.cpp */,
1C62012810F0105300146F11 /* PhraseNode.h */,
1C62012910F0105300146F11 /* SourcePhrase.cpp */,
1C62012A10F0105300146F11 /* SourcePhrase.h */,
1C62012B10F0105300146F11 /* TargetPhrase.cpp */,
1C62012C10F0105300146F11 /* TargetPhrase.h */,
1C62012D10F0105300146F11 /* TargetPhraseCollection.cpp */,
1C62012E10F0105300146F11 /* TargetPhraseCollection.h */,
1C62012F10F0105300146F11 /* Vocab.cpp */,
1C62013010F0105300146F11 /* Vocab.h */,
1C62013110F0105300146F11 /* Word.cpp */,
1C62013210F0105300146F11 /* Word.h */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
D2AAC046055464E500DB518D /* libOnDiskPt.a */,
);
name = Products;
sourceTree = "<group>";
};
C6A0FF2B0290797F04C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
);
name = Documentation;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
D2AAC043055464E500DB518D /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
1C62013410F0105300146F11 /* OnDiskWrapper.h in Headers */,
1C62013610F0105300146F11 /* Phrase.h in Headers */,
1C62013810F0105300146F11 /* PhraseNode.h in Headers */,
1C62013A10F0105300146F11 /* SourcePhrase.h in Headers */,
1C62013C10F0105300146F11 /* TargetPhrase.h in Headers */,
1C62013E10F0105300146F11 /* TargetPhraseCollection.h in Headers */,
1C62014010F0105300146F11 /* Vocab.h in Headers */,
1C62014210F0105300146F11 /* Word.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
D2AAC045055464E500DB518D /* OnDiskPt */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "OnDiskPt" */;
buildPhases = (
D2AAC043055464E500DB518D /* Headers */,
D2AAC044055464E500DB518D /* Sources */,
D289987405E68DCB004EDB86 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = OnDiskPt;
productName = OnDiskPt;
productReference = D2AAC046055464E500DB518D /* libOnDiskPt.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "OnDiskPt" */;
compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* OnDiskPt */;
projectDirPath = "";
projectRoot = "";
targets = (
D2AAC045055464E500DB518D /* OnDiskPt */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
D2AAC044055464E500DB518D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1C62013310F0105300146F11 /* OnDiskWrapper.cpp in Sources */,
1C62013510F0105300146F11 /* Phrase.cpp in Sources */,
1C62013710F0105300146F11 /* PhraseNode.cpp in Sources */,
1C62013910F0105300146F11 /* SourcePhrase.cpp in Sources */,
1C62013B10F0105300146F11 /* TargetPhrase.cpp in Sources */,
1C62013D10F0105300146F11 /* TargetPhraseCollection.cpp in Sources */,
1C62013F10F0105300146F11 /* Vocab.cpp in Sources */,
1C62014110F0105300146F11 /* Word.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1DEB91EC08733DB70010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = OnDiskPt;
};
name = Debug;
};
1DEB91ED08733DB70010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = OnDiskPt;
};
name = Release;
};
1DEB91F008733DB70010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
};
name = Debug;
};
1DEB91F108733DB70010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "OnDiskPt" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91EC08733DB70010E9CD /* Debug */,
1DEB91ED08733DB70010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "OnDiskPt" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91F008733DB70010E9CD /* Debug */,
1DEB91F108733DB70010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}

14
OnDiskPt/src/Makefile.am Normal file
View File

@ -0,0 +1,14 @@
lib_LIBRARIES = libOnDiskPt.a
AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
libOnDiskPt_a_SOURCES = \
OnDiskWrapper.cpp \
SourcePhrase.cpp \
TargetPhrase.cpp \
Word.cpp \
Phrase.cpp \
PhraseNode.cpp \
TargetPhraseCollection.cpp \
Vocab.cpp

View File

@ -0,0 +1,222 @@
/*
* OnDiskWrapper.cpp
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#ifdef WIN32
#include <direct.h>
#endif
#include <sys/stat.h>
#include <cassert>
#include <string>
#include "OnDiskWrapper.h"
using namespace std;
namespace OnDiskPt
{
OnDiskWrapper::OnDiskWrapper()
{
}
OnDiskWrapper::~OnDiskWrapper()
{
delete m_rootSourceNode;
}
bool OnDiskWrapper::BeginLoad(const std::string &filePath)
{
if (!OpenForLoad(filePath))
return false;
if (!m_vocab.Load(*this))
return false;
UINT64 rootFilePos = GetMisc("RootNodeOffset");
m_rootSourceNode = new PhraseNode(rootFilePos, *this);
return true;
}
bool OnDiskWrapper::OpenForLoad(const std::string &filePath)
{
m_fileSource.open((filePath + "/Source.dat").c_str(), ios::in | ios::binary);
assert(m_fileSource.is_open());
m_fileTargetInd.open((filePath + "/TargetInd.dat").c_str(), ios::in | ios::binary);
assert(m_fileTargetInd.is_open());
m_fileTargetColl.open((filePath + "/TargetColl.dat").c_str(), ios::in | ios::binary);
assert(m_fileTargetColl.is_open());
m_fileVocab.open((filePath + "/Vocab.dat").c_str(), ios::in);
assert(m_fileVocab.is_open());
m_fileMisc.open((filePath + "/Misc.dat").c_str(), ios::in);
assert(m_fileMisc.is_open());
// set up root node
LoadMisc();
m_numSourceFactors = GetMisc("NumSourceFactors");
m_numTargetFactors = GetMisc("NumTargetFactors");
m_numScores = GetMisc("NumScores");
return true;
}
bool OnDiskWrapper::LoadMisc()
{
char line[100000];
while(m_fileMisc.getline(line, 100000))
{
vector<string> tokens;
Moses::Tokenize(tokens, line);
assert(tokens.size() == 2);
const string &key = tokens[0];
m_miscInfo[key] = Moses::Scan<UINT64>(tokens[1]);
}
return true;
}
bool OnDiskWrapper::BeginSave(const std::string &filePath
, int numSourceFactors, int numTargetFactors, int numScores)
{
m_numSourceFactors = numSourceFactors;
m_numTargetFactors = numTargetFactors;
m_numScores = numScores;
m_filePath = filePath;
#ifdef WIN32
mkdir(filePath.c_str());
#else
mkdir(filePath.c_str(), 0777);
#endif
m_fileSource.open((filePath + "/Source.dat").c_str(), ios::out | ios::in | ios::binary | ios::ate | ios::trunc);
assert(m_fileSource.is_open());
m_fileTargetInd.open((filePath + "/TargetInd.dat").c_str(), ios::out | ios::binary | ios::ate | ios::trunc);
assert(m_fileTargetInd.is_open());
m_fileTargetColl.open((filePath + "/TargetColl.dat").c_str(), ios::out | ios::binary | ios::ate | ios::trunc);
assert(m_fileTargetColl.is_open());
m_fileVocab.open((filePath + "/Vocab.dat").c_str(), ios::out | ios::ate | ios::trunc);
assert(m_fileVocab.is_open());
m_fileMisc.open((filePath + "/Misc.dat").c_str(), ios::out | ios::ate | ios::trunc);
assert(m_fileMisc.is_open());
// offset by 1. 0 offset is reserved
char c = 0xff;
m_fileSource.write(&c, 1);
assert(1 == m_fileSource.tellp());
m_fileTargetInd.write(&c, 1);
assert(1 == m_fileTargetInd.tellp());
m_fileTargetColl.write(&c, 1);
assert(1 == m_fileTargetColl.tellp());
// set up root node
assert(GetNumCounts() == 1);
vector<float> counts(GetNumCounts());
counts[0] = DEFAULT_COUNT;
m_rootSourceNode = new PhraseNode();
m_rootSourceNode->AddCounts(counts);
return true;
}
void OnDiskWrapper::EndSave()
{
assert(m_rootSourceNode->Saved());
GetVocab().Save(*this);
SaveMisc();
m_fileMisc.close();
m_fileVocab.close();
m_fileSource.close();
m_fileTarget.close();
m_fileTargetInd.close();
m_fileTargetColl.close();
}
void OnDiskWrapper::SaveMisc()
{
m_fileMisc << "Version 3" << endl;
m_fileMisc << "NumSourceFactors " << m_numSourceFactors << endl;
m_fileMisc << "NumTargetFactors " << m_numTargetFactors << endl;
m_fileMisc << "NumScores " << m_numScores << endl;
m_fileMisc << "RootNodeOffset " << m_rootSourceNode->GetFilePos() << endl;
}
size_t OnDiskWrapper::GetSourceWordSize() const
{
return m_numSourceFactors * sizeof(UINT64) + sizeof(char);
}
size_t OnDiskWrapper::GetTargetWordSize() const
{
return m_numTargetFactors * sizeof(UINT64) + sizeof(char);
}
UINT64 OnDiskWrapper::GetMisc(const std::string &key) const
{
std::map<std::string, UINT64>::const_iterator iter;
iter = m_miscInfo.find(key);
assert(iter != m_miscInfo.end());
return iter->second;
}
PhraseNode &OnDiskWrapper::GetRootSourceNode()
{ return *m_rootSourceNode; }
Word *OnDiskWrapper::ConvertFromMoses(Moses::FactorDirection direction
, const std::vector<Moses::FactorType> &factorsVec
, const Moses::Word &origWord) const
{
bool isNonTerminal = origWord.IsNonTerminal();
Word *newWord = new Word(1, isNonTerminal); // TODO - num of factors
for (size_t ind = 0 ; ind < factorsVec.size() ; ++ind)
{
size_t factorType = factorsVec[ind];
const Moses::Factor *factor = origWord.GetFactor(factorType);
assert(factor);
string str = factor->GetString();
if (isNonTerminal)
{
str = "[" + str + "]";
}
bool found;
UINT64 vocabId = m_vocab.GetVocabId(str, found);
if (!found)
{ // factor not in phrase table -> phrse definately not in. exit
delete newWord;
return NULL;
}
else
{
newWord->SetVocabId(ind, vocabId);
}
} // for (size_t factorType
return newWord;
}
}

View File

@ -0,0 +1,82 @@
#pragma once
/*
* OnDiskWrapper.h
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <string>
#include <fstream>
#include "Vocab.h"
#include "PhraseNode.h"
#include "../../moses/src/Word.h"
namespace OnDiskPt
{
const float DEFAULT_COUNT = 66666;
class OnDiskWrapper
{
protected:
Vocab m_vocab;
std::string m_filePath;
int m_numSourceFactors, m_numTargetFactors, m_numScores;
std::fstream m_fileMisc, m_fileVocab, m_fileSource, m_fileTarget, m_fileTargetInd, m_fileTargetColl;
size_t m_defaultNodeSize;
PhraseNode *m_rootSourceNode;
std::map<std::string, UINT64> m_miscInfo;
void SaveMisc();
bool OpenForLoad(const std::string &filePath);
bool LoadMisc();
public:
OnDiskWrapper();
~OnDiskWrapper();
bool BeginLoad(const std::string &filePath);
bool BeginSave(const std::string &filePath
, int numSourceFactors, int numTargetFactors, int numScores);
void EndSave();
Vocab &GetVocab()
{ return m_vocab; }
size_t GetSourceWordSize() const;
size_t GetTargetWordSize() const;
std::fstream &GetFileSource()
{ return m_fileSource; }
std::fstream &GetFileTargetInd()
{ return m_fileTargetInd; }
std::fstream &GetFileTargetColl()
{ return m_fileTargetColl; }
std::fstream &GetFileVocab()
{ return m_fileVocab; }
size_t GetNumSourceFactors() const
{ return m_numSourceFactors; }
size_t GetNumTargetFactors() const
{ return m_numTargetFactors; }
size_t GetNumScores() const
{ return m_numScores; }
size_t GetNumCounts() const
{ return 1; }
PhraseNode &GetRootSourceNode();
UINT64 GetMisc(const std::string &key) const;
Word *ConvertFromMoses(Moses::FactorDirection direction
, const std::vector<Moses::FactorType> &factorsVec
, const Moses::Word &origWord) const;
};
}

106
OnDiskPt/src/Phrase.cpp Normal file
View File

@ -0,0 +1,106 @@
/*
* Phrase.cpp
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <iostream>
#include <cassert>
#include "../../moses/src/Util.h"
#include "Phrase.h"
using namespace std;
namespace OnDiskPt
{
Phrase::Phrase(const Phrase &copy)
:m_words(copy.GetSize())
{
for (size_t pos = 0; pos < copy.GetSize(); ++pos)
{
const Word &oldWord = copy.GetWord(pos);
Word *newWord = new Word(oldWord);
m_words[pos] = newWord;
}
}
Phrase::~Phrase()
{
Moses::RemoveAllInColl(m_words);
}
void Phrase::AddWord(Word *word)
{
m_words.push_back(word);
}
void Phrase::AddWord(Word *word, size_t pos)
{
assert(pos < m_words.size());
m_words.insert(m_words.begin() + pos + 1, word);
}
int Phrase::Compare(const Phrase &compare) const
{
int ret = 0;
for (size_t pos = 0; pos < GetSize(); ++pos)
{
if (pos >= compare.GetSize())
{ // we're bigger than the other. Put 1st
ret = -1;
break;
}
const Word &thisWord = GetWord(pos)
,&compareWord = compare.GetWord(pos);
int wordRet = thisWord.Compare(compareWord);
if (wordRet != 0)
{
ret = wordRet;
break;
}
}
if (ret == 0)
{
assert(compare.GetSize() >= GetSize());
ret = (compare.GetSize() > GetSize()) ? 1 : 0;
}
return ret;
}
//! transitive comparison
bool Phrase::operator<(const Phrase &compare) const
{
int ret = Compare(compare);
return ret < 0;
}
bool Phrase::operator>(const Phrase &compare) const
{
int ret = Compare(compare);
return ret > 0;
}
bool Phrase::operator==(const Phrase &compare) const
{
int ret = Compare(compare);
return ret == 0;
}
std::ostream& operator<<(std::ostream &out, const Phrase &phrase)
{
for (size_t pos = 0; pos < phrase.GetSize(); ++pos)
{
const Word &word = phrase.GetWord(pos);
out << word << " ";
}
return out;
}
}

44
OnDiskPt/src/Phrase.h Normal file
View File

@ -0,0 +1,44 @@
#pragma once
/*
* Phrase.h
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <vector>
#include <iostream>
#include "Word.h"
namespace OnDiskPt
{
class Phrase
{
friend std::ostream& operator<<(std::ostream&, const Phrase&);
protected:
std::vector<Word*> m_words;
public:
Phrase()
{}
Phrase(const Phrase &copy);
virtual ~Phrase();
void AddWord(Word *word);
void AddWord(Word *word, size_t pos);
const Word &GetWord(size_t pos) const
{ return *m_words[pos]; }
size_t GetSize() const
{ return m_words.size(); }
int Compare(const Phrase &compare) const;
bool operator<(const Phrase &compare) const;
bool operator>(const Phrase &compare) const;
bool operator==(const Phrase &compare) const;
};
}

266
OnDiskPt/src/PhraseNode.cpp Normal file
View File

@ -0,0 +1,266 @@
/*
* PhraseNode.cpp
* CreateOnDisk
*
* Created by Hieu Hoang on 01/01/2010.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include <cassert>
#include "PhraseNode.h"
#include "OnDiskWrapper.h"
#include "TargetPhraseCollection.h"
#include "SourcePhrase.h"
#include "../../moses/src/Util.h"
using namespace std;
namespace OnDiskPt
{
size_t PhraseNode::GetNodeSize(size_t numChildren, size_t wordSize, size_t countSize)
{
size_t ret = sizeof(UINT64) * 2 // num children, value
+ (wordSize + sizeof(UINT64)) * numChildren // word + ptr to next source node
+ sizeof(float) * countSize; // count info
return ret;
}
PhraseNode::PhraseNode()
:m_currChild(NULL)
,m_saved(false)
,m_memLoad(NULL)
,m_value(0)
{
}
PhraseNode::PhraseNode(UINT64 filePos, OnDiskWrapper &onDiskWrapper)
:m_counts(onDiskWrapper.GetNumCounts())
{ // load saved node
m_filePos = filePos;
size_t countSize = onDiskWrapper.GetNumCounts();
std::fstream &file = onDiskWrapper.GetFileSource();
file.seekg(filePos);
assert(filePos == file.tellg());
file.read((char*) &m_numChildrenLoad, sizeof(UINT64));
size_t memAlloc = GetNodeSize(m_numChildrenLoad, onDiskWrapper.GetSourceWordSize(), countSize);
m_memLoad = (char*) malloc(memAlloc);
// go to start of node again
file.seekg(filePos);
assert(filePos == file.tellg());
// read everything into memory
file.read(m_memLoad, memAlloc);
assert(filePos + memAlloc == file.tellg());
// get value
m_value = ((UINT64*)m_memLoad)[1];
// get counts
float *memFloat = (float*) (m_memLoad + sizeof(UINT64) * 2);
assert(countSize == 1);
m_counts[0] = memFloat[0];
m_memLoadLast = m_memLoad + memAlloc;
}
PhraseNode::~PhraseNode()
{
free(m_memLoad);
//assert(m_saved);
}
float PhraseNode::GetCount(size_t ind) const
{ return m_counts[ind]; }
void PhraseNode::Save(OnDiskWrapper &onDiskWrapper, size_t pos, size_t tableLimit)
{
assert(!m_saved);
// save this node
m_targetPhraseColl.Sort(tableLimit);
m_targetPhraseColl.Save(onDiskWrapper);
m_value = m_targetPhraseColl.GetFilePos();
size_t numCounts = onDiskWrapper.GetNumCounts();
size_t memAlloc = GetNodeSize(GetSize(), onDiskWrapper.GetSourceWordSize(), numCounts);
char *mem = (char*) malloc(memAlloc);
//memset(mem, 0xfe, memAlloc);
size_t memUsed = 0;
UINT64 *memArray = (UINT64*) mem;
memArray[0] = GetSize(); // num of children
memArray[1] = m_value; // file pos of corresponding target phrases
memUsed += 2 * sizeof(UINT64);
// count info
float *memFloat = (float*) (mem + memUsed);
assert(numCounts == 1);
memFloat[0] = (m_counts.size() == 0) ? DEFAULT_COUNT : m_counts[0]; // if count = 0, put in very large num to make sure its still used. HACK
memUsed += sizeof(float) * numCounts;
// recursively save chm_countsildren
ChildColl::iterator iter;
for (iter = m_children.begin(); iter != m_children.end(); ++iter)
{
const Word &childWord = iter->first;
PhraseNode &childNode = iter->second;
//assert(childNode.Saved());
// recursive
if (!childNode.Saved())
childNode.Save(onDiskWrapper, pos + 1, tableLimit);
char *currMem = mem + memUsed;
size_t wordMemUsed = childWord.WriteToMemory(currMem);
memUsed += wordMemUsed;
UINT64 *memArray = (UINT64*) (mem + memUsed);
memArray[0] = childNode.GetFilePos();
memUsed += sizeof(UINT64);
}
// save this node
//Moses::DebugMem(mem, memAlloc);
assert(memUsed == memAlloc);
std::fstream &file = onDiskWrapper.GetFileSource();
m_filePos = file.tellp();
file.seekp(0, ios::end);
file.write(mem, memUsed);
UINT64 endPos = file.tellp();
assert(m_filePos + memUsed == endPos);
free(mem);
m_children.clear();
m_saved = true;
}
void PhraseNode::AddTargetPhrase(const SourcePhrase &sourcePhrase, TargetPhrase *targetPhrase
, OnDiskWrapper &onDiskWrapper, size_t tableLimit
, const std::vector<float> &counts)
{
AddTargetPhrase(0, sourcePhrase, targetPhrase, onDiskWrapper, tableLimit, counts);
}
void PhraseNode::AddTargetPhrase(size_t pos, const SourcePhrase &sourcePhrase
, TargetPhrase *targetPhrase, OnDiskWrapper &onDiskWrapper
, size_t tableLimit, const std::vector<float> &counts)
{
size_t phraseSize = sourcePhrase.GetSize();
if (pos < phraseSize)
{
const Word &word = sourcePhrase.GetWord(pos);
PhraseNode &node = m_children[word];
if (m_currChild != &node)
{ // new node
node.SetPos(pos);
if (m_currChild)
{
m_currChild->Save(onDiskWrapper, pos, tableLimit);
}
m_currChild = &node;
}
node.AddTargetPhrase(pos + 1, sourcePhrase, targetPhrase, onDiskWrapper, tableLimit, counts);
}
else
{ // drilled down to the right node
m_counts = counts;
m_targetPhraseColl.AddTargetPhrase(targetPhrase);
}
}
const PhraseNode *PhraseNode::GetChild(const Word &wordSought, OnDiskWrapper &onDiskWrapper) const
{
const PhraseNode *ret = NULL;
int l = 0;
int r = m_numChildrenLoad - 1;
int x;
while (r >= l)
{
x = (l + r) / 2;
Word wordFound;
UINT64 childFilePos;
GetChild(wordFound, childFilePos, x, onDiskWrapper);
if (wordSought == wordFound)
{
ret = new PhraseNode(childFilePos, onDiskWrapper);
break;
}
if (wordSought < wordFound)
r = x - 1;
else
l = x + 1;
}
return ret;
}
void PhraseNode::GetChild(Word &wordFound, UINT64 &childFilePos, size_t ind, OnDiskWrapper &onDiskWrapper) const
{
size_t wordSize = onDiskWrapper.GetSourceWordSize();
size_t childSize = wordSize + sizeof(UINT64);
size_t numFactors = onDiskWrapper.GetNumSourceFactors();
char *currMem = m_memLoad
+ sizeof(UINT64) * 2 // size & file pos of target phrase coll
+ sizeof(float) * onDiskWrapper.GetNumCounts() // count info
+ childSize * ind;
size_t memRead = ReadChild(wordFound, childFilePos, currMem, numFactors);
assert(memRead == childSize);
}
size_t PhraseNode::ReadChild(Word &wordFound, UINT64 &childFilePos, const char *mem, size_t numFactors) const
{
size_t memRead = wordFound.ReadFromMemory(mem, numFactors);
const char *currMem = mem + memRead;
UINT64 *memArray = (UINT64*) (currMem);
childFilePos = memArray[0];
memRead += sizeof(UINT64);
return memRead;
}
const TargetPhraseCollection *PhraseNode::GetTargetPhraseCollection(size_t tableLimit, OnDiskWrapper &onDiskWrapper) const
{
TargetPhraseCollection *ret = new TargetPhraseCollection();
if (m_value > 0)
ret->ReadFromFile(tableLimit, m_value, onDiskWrapper);
else
{
}
return ret;
}
std::ostream& operator<<(std::ostream &out, const PhraseNode &node)
{
out << "node (" << node.GetFilePos() << "," << node.GetValue() << "," << node.m_pos << ")";
return out;
}
}

85
OnDiskPt/src/PhraseNode.h Normal file
View File

@ -0,0 +1,85 @@
#pragma once
/*
* PhraseNode.h
* CreateOnDisk
*
* Created by Hieu Hoang on 01/01/2010.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include <fstream>
#include <vector>
#include <map>
#include "Word.h"
#include "TargetPhraseCollection.h"
namespace OnDiskPt
{
class OnDiskWrapper;
class SourcePhrase;
class PhraseNode
{
friend std::ostream& operator<<(std::ostream&, const PhraseNode&);
protected:
UINT64 m_filePos, m_value;
typedef std::map<Word, PhraseNode> ChildColl;
ChildColl m_children;
PhraseNode *m_currChild;
bool m_saved;
size_t m_pos;
std::vector<float> m_counts;
TargetPhraseCollection m_targetPhraseColl;
char *m_memLoad, *m_memLoadLast;
UINT64 m_numChildrenLoad;
void AddTargetPhrase(size_t pos, const SourcePhrase &sourcePhrase
, TargetPhrase *targetPhrase, OnDiskWrapper &onDiskWrapper
, size_t tableLimit, const std::vector<float> &counts);
size_t ReadChild(Word &wordFound, UINT64 &childFilePos, const char *mem, size_t numFactors) const;
void GetChild(Word &wordFound, UINT64 &childFilePos, size_t ind, OnDiskWrapper &onDiskWrapper) const;
public:
static size_t GetNodeSize(size_t numChildren, size_t wordSize, size_t countSize);
PhraseNode(); // unsaved node
PhraseNode(UINT64 filePos, OnDiskWrapper &onDiskWrapper); // load saved node
~PhraseNode();
void Add(const Word &word, UINT64 nextFilePos, size_t wordSize);
void Save(OnDiskWrapper &onDiskWrapper, size_t pos, size_t tableLimit);
void AddTargetPhrase(const SourcePhrase &sourcePhrase, TargetPhrase *targetPhrase
, OnDiskWrapper &onDiskWrapper, size_t tableLimit
, const std::vector<float> &counts);
UINT64 GetFilePos() const
{ return m_filePos; }
UINT64 GetValue() const
{ return m_value; }
void SetValue(UINT64 value)
{ m_value = value; }
size_t GetSize() const
{ return m_children.size(); }
bool Saved() const
{ return m_saved; }
void SetPos(size_t pos)
{ m_pos = pos; }
const PhraseNode *GetChild(const Word &wordSought, OnDiskWrapper &onDiskWrapper) const;
const TargetPhraseCollection *GetTargetPhraseCollection(size_t tableLimit, OnDiskWrapper &onDiskWrapper) const;
void AddCounts(const std::vector<float> &counts)
{ m_counts = counts; }
float GetCount(size_t ind) const;
};
}

View File

@ -0,0 +1,17 @@
/*
* SourcePhrase.cpp
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <cassert>
#include "SourcePhrase.h"
namespace OnDiskPt
{
}

View File

@ -0,0 +1,24 @@
#pragma once
/*
* SourcePhrase.h
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <vector>
#include "Phrase.h"
#include "Word.h"
namespace OnDiskPt
{
class SourcePhrase: public Phrase
{
protected:
public:
};
}

View File

@ -0,0 +1,327 @@
/*
* TargetPhrase.cpp
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <algorithm>
#include <iostream>
#include "../../moses/src/Util.h"
#include "../../moses/src/TargetPhrase.h"
#include "../../moses/src/PhraseDictionary.h"
#include "TargetPhrase.h"
#include "OnDiskWrapper.h"
using namespace std;
namespace OnDiskPt
{
TargetPhrase::TargetPhrase(size_t numScores)
:m_scores(numScores)
{
}
TargetPhrase::TargetPhrase(const TargetPhrase &copy)
:Phrase(copy)
,m_scores(copy.m_scores)
{
}
TargetPhrase::~TargetPhrase()
{
}
void TargetPhrase::SetLHS(Word *lhs)
{
AddWord(lhs);
}
void TargetPhrase::Create1AlignFromString(const std::string &align1Str)
{
vector<size_t> alignPoints;
Moses::Tokenize<size_t>(alignPoints, align1Str, "-");
assert(alignPoints.size() == 2);
m_align.push_back(pair<size_t, size_t>(alignPoints[0], alignPoints[1]) );
}
void TargetPhrase::SetScore(float score, size_t ind)
{
assert(ind < m_scores.size());
m_scores[ind] = score;
}
class AlignOrderer
{
public:
bool operator()(const AlignPair &a, const AlignPair &b) const
{
return a.first < b.first;
}
};
void TargetPhrase::SortAlign()
{
std::sort(m_align.begin(), m_align.end(), AlignOrderer());
}
char *TargetPhrase::WriteToMemory(OnDiskWrapper &onDiskWrapper, size_t &memUsed) const
{
size_t phraseSize = GetSize();
size_t targetWordSize = onDiskWrapper.GetTargetWordSize();
size_t memNeeded = sizeof(UINT64) // num of words
+ targetWordSize * phraseSize; // actual words. lhs as last words
memUsed = 0;
UINT64 *mem = (UINT64*) malloc(memNeeded);
// write size
mem[0] = phraseSize;
memUsed += sizeof(UINT64);
// write each word
for (size_t pos = 0; pos < phraseSize; ++pos)
{
const Word &word = GetWord(pos);
char *currPtr = (char*)mem + memUsed;
memUsed += word.WriteToMemory((char*) currPtr);
}
assert(memUsed == memNeeded);
return (char *) mem;
}
void TargetPhrase::Save(OnDiskWrapper &onDiskWrapper)
{
// save in target ind
size_t memUsed;
char *mem = WriteToMemory(onDiskWrapper, memUsed);
std::fstream &file = onDiskWrapper.GetFileTargetInd();
UINT64 startPos = file.tellp();
file.seekp(0, ios::end);
file.write(mem, memUsed);
UINT64 endPos = file.tellp();
assert(startPos + memUsed == endPos);
m_filePos = startPos;
free(mem);
}
char *TargetPhrase::WriteOtherInfoToMemory(OnDiskWrapper &onDiskWrapper, size_t &memUsed) const
{
// allocate mem
size_t numScores = onDiskWrapper.GetNumScores()
,numAlign = GetAlign().size();
size_t memNeeded = sizeof(UINT64); // file pos (phrase id)
memNeeded += sizeof(UINT64) + 2 * sizeof(UINT64) * numAlign; // align
memNeeded += sizeof(float) * numScores; // scores
char *mem = (char*) malloc(memNeeded);
//memset(mem, 0, memNeeded);
memUsed = 0;
// phrase id
memcpy(mem, &m_filePos, sizeof(UINT64));
memUsed += sizeof(UINT64);
// align
memUsed += WriteAlignToMemory(mem + memUsed);
// scores
memUsed += WriteScoresToMemory(mem + memUsed);
//DebugMem(mem, memNeeded);
assert(memNeeded == memUsed);
return mem;
}
size_t TargetPhrase::WriteAlignToMemory(char *mem) const
{
size_t memUsed = 0;
// num of alignments
UINT64 numAlign = m_align.size();
memcpy(mem, &numAlign, sizeof(numAlign));
memUsed += sizeof(numAlign);
// actual alignments
AlignType::const_iterator iter;
for (iter = m_align.begin(); iter != m_align.end(); ++iter)
{
const AlignPair &alignPair = *iter;
memcpy(mem + memUsed, &alignPair.first, sizeof(alignPair.first));
memUsed += sizeof(alignPair.first);
memcpy(mem + memUsed, &alignPair.second, sizeof(alignPair.second));
memUsed += sizeof(alignPair.second);
}
return memUsed;
}
size_t TargetPhrase::WriteScoresToMemory(char *mem) const
{
float *scoreMem = (float*) mem;
for (size_t ind = 0; ind < m_scores.size(); ++ind)
scoreMem[ind] = m_scores[ind];
size_t memUsed = sizeof(float) * m_scores.size();
return memUsed;
}
Moses::TargetPhrase *TargetPhrase::ConvertToMoses(const std::vector<Moses::FactorType> &inputFactors
, const std::vector<Moses::FactorType> &outputFactors
, const Vocab &vocab
, const Moses::PhraseDictionary &phraseDict
, const std::vector<float> &weightT
, float weightWP
, const Moses::LMList &lmList
, const Moses::Phrase &sourcePhrase) const
{
Moses::TargetPhrase *ret = new Moses::TargetPhrase(Moses::Output);
// source phrase
ret->SetSourcePhrase(&sourcePhrase);
// words
size_t phraseSize = GetSize();
assert(phraseSize > 0); // last word is lhs
--phraseSize;
for (size_t pos = 0; pos < phraseSize; ++pos)
{
Moses::Word *mosesWord = GetWord(pos).ConvertToMoses(Moses::Output, outputFactors, vocab);
ret->AddWord(*mosesWord);
delete mosesWord;
}
// scores
ret->SetScoreChart(phraseDict.GetFeature(), m_scores, weightT, lmList, true);
// alignments
std::list<std::pair<size_t, size_t> > alignmentInfo;
for (size_t ind = 0; ind < m_align.size(); ++ind)
{
const std::pair<size_t, size_t> &entry = m_align[ind];
alignmentInfo.push_back(entry);
}
ret->SetAlignmentInfo(alignmentInfo);
Moses::Word *lhs = GetWord(GetSize() - 1).ConvertToMoses(Moses::Output, outputFactors, vocab);
ret->SetTargetLHS(*lhs);
delete lhs;
return ret;
}
UINT64 TargetPhrase::ReadOtherInfoFromFile(UINT64 filePos, std::fstream &fileTPColl)
{
assert(filePos == fileTPColl.tellg());
UINT64 memUsed = 0;
fileTPColl.read((char*) &m_filePos, sizeof(UINT64));
memUsed += sizeof(UINT64);
assert(m_filePos != 0);
memUsed += ReadAlignFromFile(fileTPColl);
assert((memUsed + filePos) == fileTPColl.tellg());
memUsed += ReadScoresFromFile(fileTPColl);
assert((memUsed + filePos) == fileTPColl.tellg());
return memUsed;
}
UINT64 TargetPhrase::ReadFromFile(std::fstream &fileTP, size_t numFactors)
{
UINT64 bytesRead = 0;
fileTP.seekg(m_filePos);
UINT64 numWords;
fileTP.read((char*) &numWords, sizeof(UINT64));
bytesRead += sizeof(UINT64);
for (size_t ind = 0; ind < numWords; ++ind)
{
Word *word = new Word();
bytesRead += word->ReadFromFile(fileTP, numFactors);
AddWord(word);
}
return bytesRead;
}
UINT64 TargetPhrase::ReadAlignFromFile(std::fstream &fileTPColl)
{
UINT64 bytesRead = 0;
UINT64 numAlign;
fileTPColl.read((char*) &numAlign, sizeof(UINT64));
bytesRead += sizeof(UINT64);
for (size_t ind = 0; ind < numAlign; ++ind)
{
AlignPair alignPair;
fileTPColl.read((char*) &alignPair.first, sizeof(UINT64));
fileTPColl.read((char*) &alignPair.second, sizeof(UINT64));
m_align.push_back(alignPair);
bytesRead += sizeof(UINT64) * 2;
}
return bytesRead;
}
UINT64 TargetPhrase::ReadScoresFromFile(std::fstream &fileTPColl)
{
assert(m_scores.size() > 0);
UINT64 bytesRead = 0;
for (size_t ind = 0; ind < m_scores.size(); ++ind)
{
fileTPColl.read((char*) &m_scores[ind], sizeof(float));
bytesRead += sizeof(float);
}
std::transform(m_scores.begin(),m_scores.end(),m_scores.begin(), Moses::TransformScore);
std::transform(m_scores.begin(),m_scores.end(),m_scores.begin(), Moses::FloorScore);
return bytesRead;
}
std::ostream& operator<<(std::ostream &out, const TargetPhrase &phrase)
{
out << (const Phrase&) phrase << ", " ;
for (size_t ind = 0; ind < phrase.m_align.size(); ++ind)
{
const AlignPair &alignPair = phrase.m_align[ind];
out << alignPair.first << "-" << alignPair.second << " ";
}
out << ", ";
for (size_t ind = 0; ind < phrase.m_scores.size(); ++ind)
{
out << phrase.m_scores[ind] << " ";
}
return out;
}
} // namespace

View File

@ -0,0 +1,81 @@
#pragma once
/*
* TargetPhrase.h
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <fstream>
#include <string>
#include <vector>
#include "Word.h"
#include "Phrase.h"
namespace Moses
{
class PhraseDictionary;
class TargetPhrase;
class LMList;
class Phrase;
}
namespace OnDiskPt
{
typedef std::pair<UINT64, UINT64> AlignPair;
typedef std::vector<AlignPair> AlignType;
class TargetPhrase: public Phrase
{
friend std::ostream& operator<<(std::ostream&, const TargetPhrase&);
protected:
AlignType m_align;
std::vector<float> m_scores;
UINT64 m_filePos;
size_t WriteAlignToMemory(char *mem) const;
size_t WriteScoresToMemory(char *mem) const;
UINT64 ReadAlignFromFile(std::fstream &fileTPColl);
UINT64 ReadScoresFromFile(std::fstream &fileTPColl);
public:
TargetPhrase(size_t numScores);
TargetPhrase(const TargetPhrase &copy);
virtual ~TargetPhrase();
void SetLHS(Word *lhs);
void Create1AlignFromString(const std::string &align1Str);
void SetScore(float score, size_t ind);
const AlignType &GetAlign() const
{ return m_align; }
void SortAlign();
char *WriteToMemory(OnDiskWrapper &onDiskWrapper, size_t &memUsed) const;
char *WriteOtherInfoToMemory(OnDiskWrapper &onDiskWrapper, size_t &memUsed) const;
void Save(OnDiskWrapper &onDiskWrapper);
UINT64 GetFilePos() const
{ return m_filePos; }
float GetScore(size_t ind) const
{ return m_scores[ind]; }
Moses::TargetPhrase *ConvertToMoses(const std::vector<Moses::FactorType> &inputFactors
, const std::vector<Moses::FactorType> &outputFactors
, const Vocab &vocab
, const Moses::PhraseDictionary &phraseDict
, const std::vector<float> &weightT
, float weightWP
, const Moses::LMList &lmList
, const Moses::Phrase &sourcePhrase) const;
UINT64 ReadOtherInfoFromFile(UINT64 filePos, std::fstream &fileTPColl);
UINT64 ReadFromFile(std::fstream &fileTP, size_t numFactors);
};
}

View File

@ -0,0 +1,181 @@
#include <algorithm>
#include <iostream>
#include "../../moses/src/Util.h"
#include "../../moses/src/TargetPhraseCollection.h"
#include "../../moses/src/PhraseDictionary.h"
#include "TargetPhraseCollection.h"
#include "Vocab.h"
#include "OnDiskWrapper.h"
using namespace std;
namespace OnDiskPt
{
size_t TargetPhraseCollection::s_sortScoreInd;
TargetPhraseCollection::TargetPhraseCollection()
:m_filePos(777)
{}
TargetPhraseCollection::TargetPhraseCollection(const TargetPhraseCollection &copy)
:m_filePos(copy.m_filePos)
,m_debugStr(copy.m_debugStr)
{
}
TargetPhraseCollection::~TargetPhraseCollection()
{
Moses::RemoveAllInColl(m_coll);
}
void TargetPhraseCollection::AddTargetPhrase(TargetPhrase *targetPhrase)
{
m_coll.push_back(targetPhrase);
}
void TargetPhraseCollection::Sort(size_t tableLimit)
{
std::sort(m_coll.begin(), m_coll.end(), TargetPhraseOrderByScore());
if (m_coll.size() > tableLimit)
{
CollType::iterator iter;
for (iter = m_coll.begin() + tableLimit ; iter != m_coll.end(); ++iter)
{
delete *iter;
}
m_coll.resize(tableLimit);
}
}
void TargetPhraseCollection::Save(OnDiskWrapper &onDiskWrapper)
{
std::fstream &file = onDiskWrapper.GetFileTargetColl();
size_t memUsed = sizeof(UINT64);
char *mem = (char*) malloc(memUsed);
// size of coll
UINT64 numPhrases = GetSize();
((UINT64*)mem)[0] = numPhrases;
// MAIN LOOP
CollType::iterator iter;
for (iter = m_coll.begin(); iter != m_coll.end(); ++iter)
{
// save phrase
TargetPhrase &targetPhrase = **iter;
targetPhrase.Save(onDiskWrapper);
// save coll
size_t memUsedTPOtherInfo;
char *memTPOtherInfo = targetPhrase.WriteOtherInfoToMemory(onDiskWrapper, memUsedTPOtherInfo);
// expand existing mem
mem = (char*) realloc(mem, memUsed + memUsedTPOtherInfo);
memcpy(mem + memUsed, memTPOtherInfo, memUsedTPOtherInfo);
memUsed += memUsedTPOtherInfo;
free(memTPOtherInfo);
}
// total number of bytes
//((UINT64*)mem)[0] = (UINT64) memUsed;
UINT64 startPos = file.tellp();
file.seekp(0, ios::end);
file.write((char*) mem, memUsed);
free(mem);
UINT64 endPos = file.tellp();
assert(startPos + memUsed == endPos);
m_filePos = startPos;
}
Moses::TargetPhraseCollection *TargetPhraseCollection::ConvertToMoses(const std::vector<Moses::FactorType> &inputFactors
, const std::vector<Moses::FactorType> &outputFactors
, const Moses::PhraseDictionary &phraseDict
, const std::vector<float> &weightT
, float weightWP
, const Moses::LMList &lmList
, const Moses::Phrase &sourcePhrase
, const std::string &filePath
, Vocab &vocab) const
{
Moses::TargetPhraseCollection *ret = new Moses::TargetPhraseCollection();
CollType::const_iterator iter;
for (iter = m_coll.begin(); iter != m_coll.end(); ++iter)
{
const TargetPhrase &tp = **iter;
Moses::TargetPhrase *mosesPhrase = tp.ConvertToMoses(inputFactors, outputFactors
, vocab
, phraseDict
, weightT
, weightWP
, lmList
, sourcePhrase);
// debugging output
stringstream strme;
strme << filePath << " " << *mosesPhrase;
mosesPhrase->SetDebugOutput(strme.str());
ret->Add(mosesPhrase);
}
ret->Prune(true, phraseDict.GetTableLimit());
return ret;
}
void TargetPhraseCollection::ReadFromFile(size_t tableLimit, UINT64 filePos, OnDiskWrapper &onDiskWrapper)
{
fstream &fileTPColl = onDiskWrapper.GetFileTargetColl();
fstream &fileTP = onDiskWrapper.GetFileTargetInd();
size_t numScores = onDiskWrapper.GetNumScores();
size_t numTargetFactors = onDiskWrapper.GetNumTargetFactors();
UINT64 numPhrases;
UINT64 currFilePos = filePos;
fileTPColl.seekg(filePos);
fileTPColl.read((char*) &numPhrases, sizeof(UINT64));
// table limit
numPhrases = std::min(numPhrases, (UINT64) tableLimit);
currFilePos += sizeof(UINT64);
for (size_t ind = 0; ind < numPhrases; ++ind)
{
TargetPhrase *tp = new TargetPhrase(numScores);
UINT64 sizeOtherInfo = tp->ReadOtherInfoFromFile(currFilePos, fileTPColl);
tp->ReadFromFile(fileTP, numTargetFactors);
currFilePos += sizeOtherInfo;
m_coll.push_back(tp);
}
}
UINT64 TargetPhraseCollection::GetFilePos() const
{ return m_filePos; }
const std::string TargetPhraseCollection::GetDebugStr() const
{ return m_debugStr; }
void TargetPhraseCollection::SetDebugStr(const std::string &str)
{ m_debugStr = str; }
}

View File

@ -0,0 +1,66 @@
#pragma once
#include "TargetPhrase.h"
#include "Vocab.h"
namespace Moses
{
class TargetPhraseCollection;
class PhraseDictionary;
class LMList;
}
namespace OnDiskPt
{
class TargetPhraseCollection
{
class TargetPhraseOrderByScore
{
public:
bool operator()(const TargetPhrase* a, const TargetPhrase *b) const
{
return a->GetScore(s_sortScoreInd) > b->GetScore(s_sortScoreInd);
}
};
protected:
typedef std::vector<TargetPhrase*> CollType;
CollType m_coll;
UINT64 m_filePos;
std::string m_debugStr;
public:
static size_t s_sortScoreInd;
TargetPhraseCollection();
TargetPhraseCollection(const TargetPhraseCollection &copy);
~TargetPhraseCollection();
void AddTargetPhrase(TargetPhrase *targetPhrase);
void Sort(size_t tableLimit);
void Save(OnDiskWrapper &onDiskWrapper);
size_t GetSize() const
{ return m_coll.size(); }
UINT64 GetFilePos() const;
Moses::TargetPhraseCollection *ConvertToMoses(const std::vector<Moses::FactorType> &inputFactors
, const std::vector<Moses::FactorType> &outputFactors
, const Moses::PhraseDictionary &phraseDict
, const std::vector<float> &weightT
, float weightWP
, const Moses::LMList &lmList
, const Moses::Phrase &sourcePhrase
, const std::string &filePath
, Vocab &vocab) const;
void ReadFromFile(size_t tableLimit, UINT64 filePos, OnDiskWrapper &onDiskWrapper);
const std::string GetDebugStr() const;
void SetDebugStr(const std::string &str);
};
}

105
OnDiskPt/src/Vocab.cpp Normal file
View File

@ -0,0 +1,105 @@
/*
* Vocab.cpp
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <string>
#include <fstream>
#include "OnDiskWrapper.h"
#include "Vocab.h"
#include "../../moses/src/FactorCollection.h"
using namespace std;
namespace OnDiskPt
{
bool Vocab::Load(OnDiskWrapper &onDiskWrapper)
{
fstream &file = onDiskWrapper.GetFileVocab();
string line;
while(getline(file, line))
{
vector<string> tokens;
Moses::Tokenize(tokens, line);
assert(tokens.size() == 2);
const string &key = tokens[0];
m_vocabColl[key] = Moses::Scan<UINT64>(tokens[1]);
}
// create lookup
// assume contiguous vocab id
m_lookup.resize(m_vocabColl.size() + 1);
CollType::const_iterator iter;
for (iter = m_vocabColl.begin(); iter != m_vocabColl.end(); ++iter)
{
UINT32 vocabId = iter->second;
const std::string &word = iter->first;
m_lookup[vocabId] = word;
}
return true;
}
void Vocab::Save(OnDiskWrapper &onDiskWrapper)
{
fstream &file = onDiskWrapper.GetFileVocab();
CollType::const_iterator iterVocab;
for (iterVocab = m_vocabColl.begin(); iterVocab != m_vocabColl.end(); ++iterVocab)
{
const string &word = iterVocab->first;
UINT32 vocabId = iterVocab->second;
file << word << " " << vocabId << endl;
}
}
UINT64 Vocab::AddVocabId(const std::string &factorString)
{
// find string id
CollType::const_iterator iter = m_vocabColl.find(factorString);
if (iter == m_vocabColl.end())
{ // add new vocab entry
m_vocabColl[factorString] = m_nextId;
return m_nextId++;
}
else
{ // return existing entry
return iter->second;
}
}
UINT64 Vocab::GetVocabId(const std::string &factorString, bool &found) const
{
// find string id
CollType::const_iterator iter = m_vocabColl.find(factorString);
if (iter == m_vocabColl.end())
{
found = false;
return 0; //return whatever
}
else
{ // return existing entry
found = true;
return iter->second;
}
}
const Moses::Factor *Vocab::GetFactor(UINT32 vocabId, Moses::FactorType factorType, Moses::FactorDirection direction, bool isNonTerminal) const
{
string str = GetString(vocabId);
if (isNonTerminal)
{
str = str.substr(1, str.size() - 2);
}
const Moses::Factor *factor = Moses::FactorCollection::Instance().AddFactor(direction, factorType, str);
return factor;
}
}

49
OnDiskPt/src/Vocab.h Normal file
View File

@ -0,0 +1,49 @@
#pragma once
/*
* Vocab.h
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <string>
#include <map>
#include "../../moses/src/TypeDef.h"
namespace Moses
{
class Factor;
}
namespace OnDiskPt
{
class OnDiskWrapper;
class Vocab
{
protected:
typedef std::map<std::string, UINT64> CollType;
CollType m_vocabColl;
std::vector<std::string> m_lookup; // opposite of m_vocabColl
UINT64 m_nextId; // starts @ 1
const std::string &GetString(UINT32 vocabId) const
{ return m_lookup[vocabId]; }
public:
Vocab()
:m_nextId(1)
{}
UINT64 AddVocabId(const std::string &factorString);
UINT64 GetVocabId(const std::string &factorString, bool &found) const;
const Moses::Factor *GetFactor(UINT32 vocabId, Moses::FactorType factorType, Moses::FactorDirection direction, bool isNonTerminal) const;
bool Load(OnDiskWrapper &onDiskWrapper);
void Save(OnDiskWrapper &onDiskWrapper);
};
}

155
OnDiskPt/src/Word.cpp Normal file
View File

@ -0,0 +1,155 @@
/*
* Word.cpp
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include "../../moses/src/Util.h"
#include "../../moses/src/Word.h"
#include "Word.h"
using namespace std;
namespace OnDiskPt
{
Word::Word(const Word &copy)
:m_isNonTerminal(copy.m_isNonTerminal)
,m_factors(copy.m_factors)
{}
Word::~Word()
{}
void Word::CreateFromString(const std::string &inString, Vocab &vocab)
{
if (inString.substr(0, 1) == "[" && inString.substr(inString.size() - 1, 1) == "]")
{ // non-term
m_isNonTerminal = true;
}
else
{
m_isNonTerminal = false;
}
m_factors.resize(1);
m_factors[0] = vocab.AddVocabId(inString);
}
size_t Word::WriteToMemory(char *mem) const
{
UINT64 *vocabMem = (UINT64*) mem;
// factors
for (size_t ind = 0; ind < m_factors.size(); ind++)
vocabMem[ind] = m_factors[ind];
size_t size = sizeof(UINT64) * m_factors.size();
// is non-term
char bNonTerm = (char) m_isNonTerminal;
mem[size] = bNonTerm;
++size;
return size;
}
size_t Word::ReadFromMemory(const char *mem, size_t numFactors)
{
m_factors.resize(numFactors);
UINT64 *vocabMem = (UINT64*) mem;
// factors
for (size_t ind = 0; ind < m_factors.size(); ind++)
m_factors[ind] = vocabMem[ind];
size_t memUsed = sizeof(UINT64) * m_factors.size();
// is non-term
char bNonTerm;
bNonTerm = mem[memUsed];
m_isNonTerminal = (bool) bNonTerm;
++memUsed;
return memUsed;
}
size_t Word::ReadFromFile(std::fstream &file, size_t numFactors)
{
size_t memAlloc = numFactors * sizeof(UINT64) + sizeof(char);
char *mem = (char*) malloc(memAlloc);
file.read(mem, memAlloc);
size_t memUsed = ReadFromMemory(mem, numFactors);
assert(memAlloc == memUsed);
free(mem);
return memUsed;
}
Moses::Word *Word::ConvertToMoses(Moses::FactorDirection direction
, const std::vector<Moses::FactorType> &outputFactorsVec
, const Vocab &vocab) const
{
Moses::Word *ret = new Moses::Word(m_isNonTerminal);
for (size_t ind = 0; ind < m_factors.size(); ++ind)
{
Moses::FactorType factorType = outputFactorsVec[ind];
UINT32 vocabId = m_factors[ind];
const Moses::Factor *factor = vocab.GetFactor(vocabId, factorType, direction, m_isNonTerminal);
ret->SetFactor(factorType, factor);
}
return ret;
}
int Word::Compare(const Word &compare) const
{
int ret;
if (m_isNonTerminal != compare.m_isNonTerminal)
return m_isNonTerminal ?-1 : 1;
if (m_factors < compare.m_factors)
ret = -1;
else if (m_factors > compare.m_factors)
ret = 1;
else
ret = 0;
return ret;
}
bool Word::operator<(const Word &compare) const
{
int ret = Compare(compare);
return ret < 0;
}
bool Word::operator==(const Word &compare) const
{
int ret = Compare(compare);
return ret == 0;
}
std::ostream& operator<<(std::ostream &out, const Word &word)
{
out << "[";
std::vector<UINT64>::const_iterator iter;
for (iter = word.m_factors.begin(); iter != word.m_factors.end(); ++iter)
{
out << *iter << "|";
}
out << (word.m_isNonTerminal ? "n" : "t");
out << "]";
return out;
}
}

66
OnDiskPt/src/Word.h Normal file
View File

@ -0,0 +1,66 @@
#pragma once
/*
* Word.h
* CreateOnDisk
*
* Created by Hieu Hoang on 31/12/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include "Vocab.h"
namespace Moses
{
class Word;
}
namespace OnDiskPt
{
class Word
{
friend std::ostream& operator<<(std::ostream&, const Word&);
protected:
bool m_isNonTerminal;
std::vector<UINT64> m_factors;
public:
explicit Word()
{}
explicit Word(size_t numFactors, bool isNonTerminal)
:m_factors(numFactors)
,m_isNonTerminal(isNonTerminal)
{}
Word(const Word &copy);
~Word();
void CreateFromString(const std::string &inString, Vocab &vocab);
bool IsNonTerminal() const
{ return m_isNonTerminal; }
size_t WriteToMemory(char *mem) const;
size_t ReadFromMemory(const char *mem, size_t numFactors);
size_t ReadFromFile(std::fstream &file, size_t numFactors);
void SetVocabId(size_t ind, UINT32 vocabId)
{ m_factors[ind] = vocabId; }
Moses::Word *ConvertToMoses(Moses::FactorDirection direction
, const std::vector<Moses::FactorType> &outputFactorsVec
, const Vocab &vocab) const;
int Compare(const Word &compare) const;
bool operator<(const Word &compare) const;
bool operator==(const Word &compare) const;
};
}

View File

@ -204,6 +204,6 @@ fi
LIBS="$LIBS -lz"
AC_CONFIG_FILES(Makefile moses/src/Makefile moses-cmd/src/Makefile misc/Makefile mert/Makefile server/Makefile)
AC_CONFIG_FILES(Makefile OnDiskPt/src/Makefile moses/src/Makefile moses-chart/src/Makefile moses-cmd/src/Makefile moses-chart-cmd/src/Makefile misc/Makefile mert/Makefile server/Makefile CreateOnDisk/src/Makefile)
AC_OUTPUT()

View File

@ -6,8 +6,8 @@ queryLexicalTable_SOURCES = queryLexicalTable.cpp
AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I$(top_srcdir)/moses/src $(BOOST_CPPFLAGS)
processPhraseTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
processPhraseTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt
processLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
processLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt
queryLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
queryLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt

80
moses-chart-cmd/.cdtbuild Normal file
View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 3.1.0?>
<ManagedProjectBuildInfo>
<project id="moses-chart-cmd.cdt.managedbuild.target.gnu.exe.625053624" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe">
<configuration artifactName="moses-chart-cmd" 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.620134777" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1838535064" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.2024126475" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.option.include.paths.818859663" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../moses/src&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1586927757" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LM_SRI"/>
<listOptionValue builtIn="false" value="LM_IRST"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.322988783" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1596838939" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.2034574348" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.2091665674" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="z"/>
<listOptionValue builtIn="false" value="pthread"/>
<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.1931750848" superClass="gnu.cpp.link.option.paths" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;../../irstlm/lib/i686-redhat-linux&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../srilm/lib/i686&quot;"/>
</option>
<option id="gnu.cpp.link.option.userobjs.242773363" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="&quot;../../moses/${ConfigName}/libmoses.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../moses-chart/${ConfigName}/libmoses-chart.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../irstlm/${ConfigName}/libirstlm.a&quot;"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.2106702327" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"/>
<macros/>
</toolChain>
</configuration>
<configuration artifactName="moses-chart-cmd" 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.1978007801" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1809153488" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1860351562" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.option.include.paths.1432131516" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../moses/src&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1771097548" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LM_SRI"/>
<listOptionValue builtIn="false" value="LM_IRST"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.571817535" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.250188501" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.2023140164" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<option id="gnu.cpp.link.option.paths.968163638" superClass="gnu.cpp.link.option.paths" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;../../irstlm/lib/i686-redhat-linux-gnu&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../srilm/lib/i686&quot;"/>
</option>
<option id="gnu.cpp.link.option.libs.13563871" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="z"/>
<listOptionValue builtIn="false" value="irstlm"/>
<listOptionValue builtIn="false" value="lattice"/>
<listOptionValue builtIn="false" value="pthread"/>
<listOptionValue builtIn="false" value="oolm"/>
<listOptionValue builtIn="false" value="misc"/>
<listOptionValue builtIn="false" value="dstruct"/>
</option>
<option id="gnu.cpp.link.option.userobjs.1864426396" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="&quot;../../moses/${ConfigName}/libmoses.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../moses-chart/${ConfigName}/libmoses-chart.a&quot;"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.120047144" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"/>
<macros/>
</toolChain>
</configuration>
<macros/>
</project>
</ManagedProjectBuildInfo>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 3.1.0?>
<ManagedProjectBuildInfo>
<project id="moses-chart-cmd.cdt.managedbuild.target.gnu.exe.625053624" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe">
<configuration artifactName="moses-chart-cmd" 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.620134777" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1838535064" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.2024126475" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.option.include.paths.818859663" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../moses/src&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1586927757" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LM_SRI"/>
<listOptionValue builtIn="false" value="LM_IRST"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.322988783" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1596838939" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.2034574348" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.2091665674" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="z"/>
<listOptionValue builtIn="false" value="pthread"/>
<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.1931750848" superClass="gnu.cpp.link.option.paths" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;../../irstlm/lib/i686-redhat-linux&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../srilm/lib/i686&quot;"/>
</option>
<option id="gnu.cpp.link.option.userobjs.242773363" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="&quot;../../moses/${ConfigName}/libmoses.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../moses-chart/${ConfigName}/libmoses-chart.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../irstlm/${ConfigName}/libirstlm.a&quot;"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.2106702327" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"/>
<macros/>
</toolChain>
</configuration>
<configuration artifactName="moses-chart-cmd" 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.1978007801" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1809153488" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1860351562" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.option.include.paths.1432131516" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../moses/src&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1771097548" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LM_SRI"/>
<listOptionValue builtIn="false" value="LM_IRST"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.571817535" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.250188501" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.2023140164" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<option id="gnu.cpp.link.option.paths.968163638" superClass="gnu.cpp.link.option.paths" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;../../irstlm/lib/i686-redhat-linux-gnu&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../srilm/lib/i686&quot;"/>
</option>
<option id="gnu.cpp.link.option.libs.13563871" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="z"/>
<listOptionValue builtIn="false" value="irstlm"/>
<listOptionValue builtIn="false" value="lattice"/>
<listOptionValue builtIn="false" value="pthread"/>
<listOptionValue builtIn="false" value="oolm"/>
<listOptionValue builtIn="false" value="misc"/>
<listOptionValue builtIn="false" value="dstruct"/>
</option>
<option id="gnu.cpp.link.option.userobjs.1864426396" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="&quot;../../moses/${ConfigName}/libmoses.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../moses-chart/${ConfigName}/libmoses-chart.a&quot;"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.120047144" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"/>
<macros/>
</toolChain>
</configuration>
<macros/>
</project>
</ManagedProjectBuildInfo>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-cdt version="2.0"?>
<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake">
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/>
<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>

976
moses-chart-cmd/.cproject Normal file
View File

@ -0,0 +1,976 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.620134777">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.620134777" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="" artifactName="moses-chart-cmd" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" 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.620134777" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.620134777.1787684589" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1838535064" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1874626137" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/moses-chart-cmd/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.363054782" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.2024126475" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.option.include.paths.818859663" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../moses/src&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1586927757" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LM_SRI"/>
<listOptionValue builtIn="false" value="TRACE_ENABLE"/>
<listOptionValue builtIn="false" value="LM_IRST"/>
</option>
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1668549583" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.46874703" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1489977316" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.322988783" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.789515539" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.776946654" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.161258092" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1596838939" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.2034574348" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.2091665674" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="z"/>
<listOptionValue builtIn="false" value="irstlm"/>
<listOptionValue builtIn="false" value="pthread"/>
<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.1931750848" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;../../irstlm/lib/i686-redhat-linux-gnu&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../srilm/lib/i686&quot;"/>
</option>
<option id="gnu.cpp.link.option.userobjs.242773363" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="&quot;../../moses/${ConfigName}/libmoses.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../moses-chart/${ConfigName}/libmoses-chart.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../on-disk-phrase-dict/${ConfigName}/libon-disk-phrase-dict.a&quot;"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.2106702327" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.2105103323" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.4947490" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1978007801;cdt.managedbuild.config.gnu.exe.release.1978007801.1846633728;cdt.managedbuild.tool.gnu.c.compiler.exe.release.571817535;cdt.managedbuild.tool.gnu.c.compiler.input.242262555">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.620134777;cdt.managedbuild.config.gnu.exe.debug.620134777.1787684589;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.2024126475;cdt.managedbuild.tool.gnu.cpp.compiler.input.1489977316">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1978007801;cdt.managedbuild.config.gnu.exe.release.1978007801.1846633728;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1860351562;cdt.managedbuild.tool.gnu.cpp.compiler.input.1951845353">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.620134777;cdt.managedbuild.config.gnu.exe.debug.620134777.1787684589;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.322988783;cdt.managedbuild.tool.gnu.c.compiler.input.161258092">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1978007801">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1978007801" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="" artifactName="moses-chart-cmd" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" 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.1978007801" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.1978007801.1846633728" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1809153488" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.188427733" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
<builder buildPath="${workspace_loc:/moses-chart-cmd/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.1956957384" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1860351562" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.option.include.paths.1432131516" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../moses/src&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1771097548" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="TRACE_ENABLE"/>
<listOptionValue builtIn="false" value="LM_SRI"/>
<listOptionValue builtIn="false" value="LM_IRST"/>
</option>
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.1086008000" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.240225388" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1951845353" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.571817535" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.281981598" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.release.option.debugging.level.75229925" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.242262555" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.250188501" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.2023140164" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<option id="gnu.cpp.link.option.paths.968163638" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;../../irstlm/lib/i686-redhat-linux-gnu&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../srilm/lib/i686&quot;"/>
</option>
<option id="gnu.cpp.link.option.libs.13563871" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="z"/>
<listOptionValue builtIn="false" value="irstlm"/>
<listOptionValue builtIn="false" value="lattice"/>
<listOptionValue builtIn="false" value="pthread"/>
<listOptionValue builtIn="false" value="oolm"/>
<listOptionValue builtIn="false" value="misc"/>
<listOptionValue builtIn="false" value="dstruct"/>
</option>
<option id="gnu.cpp.link.option.userobjs.1864426396" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="&quot;../../moses/${ConfigName}/libmoses.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../moses-chart/${ConfigName}/libmoses-chart.a&quot;"/>
<listOptionValue builtIn="false" value="&quot;../../on-disk-phrase-dict/${ConfigName}/libon-disk-phrase-dict.a&quot;"/>
</option>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.120047144" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.681859729" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1097906224" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1978007801;cdt.managedbuild.config.gnu.exe.release.1978007801.1846633728;cdt.managedbuild.tool.gnu.c.compiler.exe.release.571817535;cdt.managedbuild.tool.gnu.c.compiler.input.242262555">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.620134777;cdt.managedbuild.config.gnu.exe.debug.620134777.1787684589;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.2024126475;cdt.managedbuild.tool.gnu.cpp.compiler.input.1489977316">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1978007801;cdt.managedbuild.config.gnu.exe.release.1978007801.1846633728;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1860351562;cdt.managedbuild.tool.gnu.cpp.compiler.input.1951845353">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.620134777;cdt.managedbuild.config.gnu.exe.debug.620134777.1787684589;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.322988783;cdt.managedbuild.tool.gnu.c.compiler.input.161258092">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="moses-chart-cmd.cdt.managedbuild.target.gnu.exe.625053624" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
</cproject>

85
moses-chart-cmd/.project Normal file
View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>moses-chart-cmd</name>
<comment></comment>
<projects>
<project>moses</project>
<project>moses-chart</project>
<project>on-disk-phrase-dict</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/moses-chart-cmd/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>moses-chart-cmd</name>
<comment></comment>
<projects>
<project>moses</project>
<project>moses-chart</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>

View File

@ -0,0 +1,3 @@
#Tue Oct 21 00:09:34 BST 2008
eclipse.preferences.version=1
indexerId=org.eclipse.cdt.core.nullindexer

View File

@ -0,0 +1,13 @@
#Tue Oct 21 00:29:36 BST 2008
cdt.managedbuild.config.gnu.exe.debug.620134777/internalBuilder/enabled=false
cdt.managedbuild.config.gnu.exe.debug.620134777/internalBuilder/ignoreErr=true
cdt.managedbuild.config.gnu.exe.release.1978007801/internalBuilder/enabled=false
cdt.managedbuild.config.gnu.exe.release.1978007801/internalBuilder/ignoreErr=true
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.620134777=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1978007801=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.620134777=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1978007801=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n
environment/project=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment/>\n
environment/project/cdt.managedbuild.config.gnu.exe.debug.620134777=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment/>\n
environment/project/cdt.managedbuild.config.gnu.exe.release.1978007801=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment/>\n

View File

@ -0,0 +1,228 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="moses-chart-cmd"
ProjectGUID="{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}"
RootNamespace="moseschartcmd"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<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="&quot;../moses/src&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE"
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="zdll.lib &quot;$(OutDir)\moses.lib&quot; &quot;$(OutDir)\moses-chart.lib&quot; &quot;$(OutDir)\OnDiskPt.lib&quot;"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<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="&quot;../moses/src&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="zdll.lib &quot;$(OutDir)\moses.lib&quot; &quot;$(OutDir)\moses-chart.lib&quot; &quot;$(OutDir)\OnDiskPt.lib&quot;"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<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\IOWrapper.cpp"
>
</File>
<File
RelativePath=".\src\Main.cpp"
>
</File>
<File
RelativePath=".\src\mbr.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\IOWrapper.h"
>
</File>
<File
RelativePath=".\src\Main.h"
>
</File>
<File
RelativePath=".\src\mbr.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>

View File

@ -0,0 +1,457 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
03306D820C0B249A00CA1311 /* mbr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03306D800C0B249A00CA1311 /* mbr.cpp */; };
03306D830C0B249A00CA1311 /* mbr.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 03306D810C0B249A00CA1311 /* mbr.h */; };
1C8CFF4D0AD68D3600FA22E2 /* Main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8CFF450AD68D3600FA22E2 /* Main.cpp */; };
1C8CFF4E0AD68D3600FA22E2 /* Main.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1C8CFF460AD68D3600FA22E2 /* Main.h */; };
1C8CFF4F0AD68D3600FA22E2 /* TranslationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8CFF470AD68D3600FA22E2 /* TranslationAnalysis.cpp */; };
1C8CFF500AD68D3600FA22E2 /* TranslationAnalysis.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1C8CFF480AD68D3600FA22E2 /* TranslationAnalysis.h */; };
1CCBE9381003C16700EA897E /* libmoses.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03306D670C0B240B00CA1311 /* libmoses.a */; };
1CCBE93A1003C17200EA897E /* libmoses-chart.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C335ABB0F20F9EA00D0D9DF /* libmoses-chart.a */; };
1CF71F8B1110574A00CF2DA4 /* libOnDiskPt.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C32916B110F40B400E9F5E1 /* libOnDiskPt.a */; };
B219B8580E9381AC00EAB407 /* IOWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B219B8560E9381AC00EAB407 /* IOWrapper.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
03306D660C0B240B00CA1311 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 03306D5F0C0B240B00CA1311 /* moses.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D2AAC046055464E500DB518D;
remoteInfo = moses;
};
1C32916A110F40B400E9F5E1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1C329163110F40B400E9F5E1 /* OnDiskPt.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D2AAC046055464E500DB518D;
remoteInfo = OnDiskPt;
};
1C335ABA0F20F9EA00D0D9DF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1C335AB30F20F9EA00D0D9DF /* moses-chart.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1C335AA10F20F8F400D0D9DF;
remoteInfo = "moses-chart";
};
1C6689C4100D3A3900A606B2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1C335AB30F20F9EA00D0D9DF /* moses-chart.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = "moses-chart";
};
1C6689C8100D3A4200A606B2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 03306D5F0C0B240B00CA1311 /* moses.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = moses;
};
1CF9A7EB11105A1A00071293 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1C329163110F40B400E9F5E1 /* OnDiskPt.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = OnDiskPt;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
8DD76F690486A84900D96B5E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
1C8CFF4E0AD68D3600FA22E2 /* Main.h in CopyFiles */,
1C8CFF500AD68D3600FA22E2 /* TranslationAnalysis.h in CopyFiles */,
03306D830C0B249A00CA1311 /* mbr.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
03306D5F0C0B240B00CA1311 /* moses.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = moses.xcodeproj; path = ../moses/moses.xcodeproj; sourceTree = SOURCE_ROOT; };
03306D800C0B249A00CA1311 /* mbr.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = mbr.cpp; path = src/mbr.cpp; sourceTree = "<group>"; };
03306D810C0B249A00CA1311 /* mbr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mbr.h; path = src/mbr.h; sourceTree = "<group>"; };
1C329163110F40B400E9F5E1 /* OnDiskPt.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OnDiskPt.xcodeproj; path = ../OnDiskPt/OnDiskPt.xcodeproj; sourceTree = SOURCE_ROOT; };
1C335AB30F20F9EA00D0D9DF /* moses-chart.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "moses-chart.xcodeproj"; path = "../moses-chart/moses-chart.xcodeproj"; sourceTree = SOURCE_ROOT; };
1C8CFF450AD68D3600FA22E2 /* Main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Main.cpp; path = src/Main.cpp; sourceTree = "<group>"; };
1C8CFF460AD68D3600FA22E2 /* Main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Main.h; path = src/Main.h; sourceTree = "<group>"; };
1C8CFF470AD68D3600FA22E2 /* TranslationAnalysis.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = TranslationAnalysis.cpp; path = src/TranslationAnalysis.cpp; sourceTree = "<group>"; };
1C8CFF480AD68D3600FA22E2 /* TranslationAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TranslationAnalysis.h; path = src/TranslationAnalysis.h; sourceTree = "<group>"; };
8DD76F6C0486A84900D96B5E /* moses-chart-cmd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "moses-chart-cmd"; sourceTree = BUILT_PRODUCTS_DIR; };
B219B8560E9381AC00EAB407 /* IOWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOWrapper.cpp; path = src/IOWrapper.cpp; sourceTree = "<group>"; };
B219B8570E9381AC00EAB407 /* IOWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOWrapper.h; path = src/IOWrapper.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DD76F660486A84900D96B5E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1CF71F8B1110574A00CF2DA4 /* libOnDiskPt.a in Frameworks */,
1CCBE93A1003C17200EA897E /* libmoses-chart.a in Frameworks */,
1CCBE9381003C16700EA897E /* libmoses.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
03306D600C0B240B00CA1311 /* Products */ = {
isa = PBXGroup;
children = (
03306D670C0B240B00CA1311 /* libmoses.a */,
);
name = Products;
sourceTree = "<group>";
};
08FB7794FE84155DC02AAC07 /* moses-cmd */ = {
isa = PBXGroup;
children = (
1C329163110F40B400E9F5E1 /* OnDiskPt.xcodeproj */,
03306D5F0C0B240B00CA1311 /* moses.xcodeproj */,
1C335AB30F20F9EA00D0D9DF /* moses-chart.xcodeproj */,
08FB7795FE84155DC02AAC07 /* Source */,
C6859E8C029090F304C91782 /* Documentation */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = "moses-cmd";
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
B219B8560E9381AC00EAB407 /* IOWrapper.cpp */,
B219B8570E9381AC00EAB407 /* IOWrapper.h */,
03306D800C0B249A00CA1311 /* mbr.cpp */,
03306D810C0B249A00CA1311 /* mbr.h */,
1C8CFF450AD68D3600FA22E2 /* Main.cpp */,
1C8CFF460AD68D3600FA22E2 /* Main.h */,
1C8CFF470AD68D3600FA22E2 /* TranslationAnalysis.cpp */,
1C8CFF480AD68D3600FA22E2 /* TranslationAnalysis.h */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8DD76F6C0486A84900D96B5E /* moses-chart-cmd */,
);
name = Products;
sourceTree = "<group>";
};
1C329164110F40B400E9F5E1 /* Products */ = {
isa = PBXGroup;
children = (
1C32916B110F40B400E9F5E1 /* libOnDiskPt.a */,
);
name = Products;
sourceTree = "<group>";
};
1C335AB40F20F9EA00D0D9DF /* Products */ = {
isa = PBXGroup;
children = (
1C335ABB0F20F9EA00D0D9DF /* libmoses-chart.a */,
);
name = Products;
sourceTree = "<group>";
};
C6859E8C029090F304C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
);
name = Documentation;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8DD76F620486A84900D96B5E /* moses-chart-cmd */ = {
isa = PBXNativeTarget;
buildConfigurationList = 03306D3B0C0B23F200CA1311 /* Build configuration list for PBXNativeTarget "moses-chart-cmd" */;
buildPhases = (
8DD76F640486A84900D96B5E /* Sources */,
8DD76F660486A84900D96B5E /* Frameworks */,
8DD76F690486A84900D96B5E /* CopyFiles */,
);
buildRules = (
);
dependencies = (
1C6689C5100D3A3900A606B2 /* PBXTargetDependency */,
1C6689C9100D3A4200A606B2 /* PBXTargetDependency */,
1CF9A7EC11105A1A00071293 /* PBXTargetDependency */,
);
name = "moses-chart-cmd";
productInstallPath = "$(HOME)/bin";
productName = "moses-cmd";
productReference = 8DD76F6C0486A84900D96B5E /* moses-chart-cmd */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 03306D3F0C0B23F200CA1311 /* Build configuration list for PBXProject "moses-chart-cmd" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* moses-cmd */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 1C335AB40F20F9EA00D0D9DF /* Products */;
ProjectRef = 1C335AB30F20F9EA00D0D9DF /* moses-chart.xcodeproj */;
},
{
ProductGroup = 03306D600C0B240B00CA1311 /* Products */;
ProjectRef = 03306D5F0C0B240B00CA1311 /* moses.xcodeproj */;
},
{
ProductGroup = 1C329164110F40B400E9F5E1 /* Products */;
ProjectRef = 1C329163110F40B400E9F5E1 /* OnDiskPt.xcodeproj */;
},
);
projectRoot = "";
targets = (
8DD76F620486A84900D96B5E /* moses-chart-cmd */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
03306D670C0B240B00CA1311 /* libmoses.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libmoses.a;
remoteRef = 03306D660C0B240B00CA1311 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1C32916B110F40B400E9F5E1 /* libOnDiskPt.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libOnDiskPt.a;
remoteRef = 1C32916A110F40B400E9F5E1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1C335ABB0F20F9EA00D0D9DF /* libmoses-chart.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libmoses-chart.a";
remoteRef = 1C335ABA0F20F9EA00D0D9DF /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXSourcesBuildPhase section */
8DD76F640486A84900D96B5E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1C8CFF4D0AD68D3600FA22E2 /* Main.cpp in Sources */,
1C8CFF4F0AD68D3600FA22E2 /* TranslationAnalysis.cpp in Sources */,
03306D820C0B249A00CA1311 /* mbr.cpp in Sources */,
B219B8580E9381AC00EAB407 /* IOWrapper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
1C6689C5100D3A3900A606B2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "moses-chart";
targetProxy = 1C6689C4100D3A3900A606B2 /* PBXContainerItemProxy */;
};
1C6689C9100D3A4200A606B2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = moses;
targetProxy = 1C6689C8100D3A4200A606B2 /* PBXContainerItemProxy */;
};
1CF9A7EC11105A1A00071293 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = OnDiskPt;
targetProxy = 1CF9A7EB11105A1A00071293 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
03306D3C0C0B23F200CA1311 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
LM_SRI,
LM_IRST,
TRACE_ENABLE,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
../moses/src,
../srilm/misc/src,
../srilm/dstruct/src,
../srilm/include,
../irstlm/include,
../srilm/lm/src,
);
INSTALL_PATH = "$(HOME)/bin";
LIBRARY_SEARCH_PATHS = (
"../irstlm/lib/i386-apple-darwin9.0/",
"../moses/build//**",
../srilm/lib/macosx,
/usr/local/BerkeleyDB.4.7/lib,
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../on-disk-phrase-dict/build/Deployment\"";
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../moses-chart/build/Development\"";
OTHER_LDFLAGS = (
"-lflm",
"-lmisc",
"-loolm",
"-ldstruct",
"-lz",
"-lirstlm",
"-ldb_cxx",
"-ldb",
);
PREBINDING = NO;
PRODUCT_NAME = "moses-chart-cmd";
ZERO_LINK = NO;
};
name = Debug;
};
03306D3D0C0B23F200CA1311 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PREPROCESSOR_DEFINITIONS = (
LM_IRST,
LM_SRI,
TRACE_ENABLE,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
../moses/src,
../srilm/misc/src,
../srilm/dstruct/src,
../srilm/include,
../srilm/lm/src,
../irstlm/include,
);
INSTALL_PATH = "$(HOME)/bin";
LIBRARY_SEARCH_PATHS = (
"../irstlm/lib/i386-apple-darwin9.0/",
"../moses/build//**",
../srilm/lib/macosx,
"/usr/local/BerkeleyDB.4.7/lib/**",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../on-disk-phrase-dict/build/Deployment\"";
LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../moses-chart/build/Development\"";
OTHER_LDFLAGS = (
"-lflm",
"-lmisc",
"-loolm",
"-ldstruct",
"-lz",
"-lirstlm",
"-ldb",
"-ldb_cxx",
);
PREBINDING = NO;
PRODUCT_NAME = "moses-chart-cmd";
ZERO_LINK = NO;
};
name = Release;
};
03306D3E0C0B23F200CA1311 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = "$(HOME)/bin";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_2)",
);
LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../on-disk-phrase-dict/build/Deployment\"";
LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../moses-chart/build/Development\"";
OTHER_LDFLAGS = "";
PREBINDING = NO;
PRODUCT_NAME = "moses-cmd";
};
name = Default;
};
03306D400C0B23F200CA1311 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
VALID_ARCHS = i386;
};
name = Debug;
};
03306D410C0B23F200CA1311 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Release;
};
03306D420C0B23F200CA1311 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Default;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
03306D3B0C0B23F200CA1311 /* Build configuration list for PBXNativeTarget "moses-chart-cmd" */ = {
isa = XCConfigurationList;
buildConfigurations = (
03306D3C0C0B23F200CA1311 /* Debug */,
03306D3D0C0B23F200CA1311 /* Release */,
03306D3E0C0B23F200CA1311 /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
03306D3F0C0B23F200CA1311 /* Build configuration list for PBXProject "moses-chart-cmd" */ = {
isa = XCConfigurationList;
buildConfigurations = (
03306D400C0B23F200CA1311 /* Debug */,
03306D410C0B23F200CA1311 /* Release */,
03306D420C0B23F200CA1311 /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}

View File

@ -0,0 +1,470 @@
// $Id: IOWrapper.cpp 2675 2010-01-26 18:37:42Z hieuhoang1972 $
/***********************************************************************
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 "IOWrapper.h"
#include "WordsRange.h"
#include "StaticData.h"
#include "DummyScoreProducers.h"
#include "InputFileStream.h"
#include "PhraseDictionary.h"
#include "../../moses-chart/src/ChartTrellisPathList.h"
#include "../../moses-chart/src/ChartTrellisPath.h"
using namespace std;
using namespace Moses;
using namespace MosesChart;
IOWrapper::IOWrapper(
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_outputSearchGraphStream(NULL)
{
const StaticData &staticData = StaticData::Instance();
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());
}
}
// search graph output
if (staticData.GetOutputSearchGraph())
{
string fileName = staticData.GetParam("output-search-graph")[0];
std::ofstream *file = new std::ofstream;
m_outputSearchGraphStream = file;
file->open(fileName.c_str());
}
}
IOWrapper::IOWrapper(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_outputSearchGraphStream(NULL)
{
const StaticData &staticData = StaticData::Instance();
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());
}
}
// search graph output
if (staticData.GetOutputSearchGraph())
{
string fileName = staticData.GetParam("output-search-graph")[0];
std::ofstream *file = new std::ofstream;
m_outputSearchGraphStream = file;
file->open(fileName.c_str());
}
}
IOWrapper::~IOWrapper()
{
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;
}
if (m_outputSearchGraphStream != NULL)
{
delete m_outputSearchGraphStream;
}
}
InputType*IOWrapper::GetInput(InputType* inputType)
{
if(inputType->Read(*m_inputStream, m_inputFactorOrder))
{
if (long x = inputType->GetTranslationId()) { if (x>=m_translationId) m_translationId = x+1; }
else 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 MosesChart::Hypothesis *hypo, const std::vector<FactorType> &outputFactorOrder
,bool reportSegmentation, bool reportAllFactors)
{
if ( hypo != NULL)
{
//OutputSurface(out, hypo->GetCurrTargetPhrase(), outputFactorOrder, reportAllFactors);
const vector<const MosesChart::Hypothesis*> &prevHypos = hypo->GetPrevHypos();
vector<const MosesChart::Hypothesis*>::const_iterator iter;
for (iter = prevHypos.begin(); iter != prevHypos.end(); ++iter)
{
const MosesChart::Hypothesis *prevHypo = *iter;
OutputSurface(out, prevHypo, outputFactorOrder, reportSegmentation, reportAllFactors);
}
}
}
void IOWrapper::Backtrack(const MosesChart::Hypothesis *hypo)
{
const vector<const MosesChart::Hypothesis*> &prevHypos = hypo->GetPrevHypos();
vector<const MosesChart::Hypothesis*>::const_iterator iter;
for (iter = prevHypos.begin(); iter != prevHypos.end(); ++iter)
{
const MosesChart::Hypothesis *prevHypo = *iter;
VERBOSE(3,prevHypo->GetId() << " <= ");
Backtrack(prevHypo);
}
}
void IOWrapper::OutputBestHypo(const std::vector<const Factor*>& mbrBestHypo, long /*translationId*/, bool reportSegmentation, bool reportAllFactors)
{
for (size_t i = 0 ; i < mbrBestHypo.size() ; i++)
{
const Factor *factor = mbrBestHypo[i];
cout << *factor << " ";
}
}
/*
void OutputInput(std::vector<const Phrase*>& map, const MosesChart::Hypothesis* hypo)
{
if (hypo->GetPrevHypos())
{
OutputInput(map, hypo->GetPrevHypos());
map[hypo->GetCurrSourceWordsRange().GetStartPos()] = hypo->GetSourcePhrase();
}
}
void OutputInput(std::ostream& os, const MosesChart::Hypothesis* hypo)
{
size_t len = StaticData::Instance().GetInput()->GetSize();
std::vector<const Phrase*> inp_phrases(len, 0);
OutputInput(inp_phrases, hypo);
for (size_t i=0; i<len; ++i)
if (inp_phrases[i]) os << *inp_phrases[i];
}
*/
void OutputTranslationOptions(const MosesChart::Hypothesis *hypo, long translationId)
{ // recursive
if (hypo != NULL)
{
//cerr << "Trans Opt " << translationId << " " << hypo->GetCurrSourceRange() << " = " << hypo->GetCurrTargetPhrase() << endl;
cerr << *hypo << endl;
}
const std::vector<const MosesChart::Hypothesis*> &prevHypos = hypo->GetPrevHypos();
std::vector<const MosesChart::Hypothesis*>::const_iterator iter;
for (iter = prevHypos.begin(); iter != prevHypos.end(); ++iter)
{
const MosesChart::Hypothesis *prevHypo = *iter;
OutputTranslationOptions(prevHypo, translationId);
}
}
void IOWrapper::OutputBestHypo(const MosesChart::Hypothesis *hypo, long translationId, bool reportSegmentation, bool reportAllFactors)
{
if (hypo != NULL)
{
//cerr << *hypo << endl;
VERBOSE(3,"Best path: ");
Backtrack(hypo);
VERBOSE(3,"0" << std::endl);
if (StaticData::Instance().GetOutputHypoScore())
{
cout << hypo->GetTotalScore() << " "
<< MosesChart::Hypothesis::GetHypoCount() << " ";
}
if (StaticData::Instance().IsDetailedTranslationReportingEnabled())
{
OutputTranslationOptions(hypo, translationId);
}
if (!m_surpressSingleBestOutput)
{
if (StaticData::Instance().IsPathRecoveryEnabled()) {
//OutputInput(cout, hypo);
cout << "||| ";
}
Phrase outPhrase(Output);
hypo->CreateOutputPhrase(outPhrase);
// delete 1st & last
assert(outPhrase.GetSize() >= 2);
outPhrase.RemoveWord(0);
outPhrase.RemoveWord(outPhrase.GetSize() - 1);
const std::vector<FactorType> outputFactorOrder = StaticData::Instance().GetOutputFactorOrder();
string output = outPhrase.GetStringRep(outputFactorOrder);
cout << output << endl;
}
}
else
{
VERBOSE(1, "NO BEST TRANSLATION" << endl);
if (StaticData::Instance().GetOutputHypoScore())
{
cout << "0 ";
}
if (!m_surpressSingleBestOutput)
{
cout << endl;
}
}
}
void IOWrapper::OutputNBestList(const MosesChart::TrellisPathList &nBestList, long translationId)
{
bool labeledOutput = StaticData::Instance().IsLabeledNBestList();
//bool includeAlignment = StaticData::Instance().NBestIncludesAlignment();
MosesChart::TrellisPathList::const_iterator iter;
for (iter = nBestList.begin() ; iter != nBestList.end() ; ++iter)
{
const MosesChart::TrellisPath &path = **iter;
//cerr << path << endl << endl;
Moses::Phrase outputPhrase = path.GetOutputPhrase();
// delete 1st & last
assert(outputPhrase.GetSize() >= 2);
outputPhrase.RemoveWord(0);
outputPhrase.RemoveWord(outputPhrase.GetSize() - 1);
// print the surface factor of the translation
*m_nBestStream << translationId << " ||| ";
OutputSurface(*m_nBestStream, outputPhrase, m_outputFactorOrder, false);
*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
// 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()==SentenceInput){
// translation components for text input
vector<PhraseDictionaryFeature*> pds = StaticData::Instance().GetPhraseDictionaries();
if (pds.size() > 0) {
if (labeledOutput)
*m_nBestStream << "tm: ";
vector<PhraseDictionaryFeature*>::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<PhraseDictionaryFeature*> pds = StaticData::Instance().GetPhraseDictionaries();
if (pds.size() > 0) {
vector<PhraseDictionaryFeature*>::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 MosesChart::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;
}

View File

@ -0,0 +1,96 @@
// $Id: IOWrapper.h 2615 2009-11-12 13:18:20Z hieuhoang1972 $
/***********************************************************************
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"
#include "FactorTypeSet.h"
#include "InputFileStream.h"
#include "TrellisPathList.h"
#include "../../moses-chart/src/ChartHypothesis.h"
namespace Moses
{
class FactorCollection;
}
namespace MosesChart
{
class TrellisPathList;
}
class IOWrapper
{
protected:
long m_translationId;
const std::vector<Moses::FactorType> &m_inputFactorOrder;
const std::vector<Moses::FactorType> &m_outputFactorOrder;
const Moses::FactorMask &m_inputFactorUsed;
std::ostream *m_nBestStream, *m_outputSearchGraphStream;
std::string m_inputFilePath;
std::istream *m_inputStream;
Moses::InputFileStream *m_inputFile;
bool m_surpressSingleBestOutput;
public:
IOWrapper(const std::vector<Moses::FactorType> &inputFactorOrder
, const std::vector<Moses::FactorType> &outputFactorOrder
, const Moses::FactorMask &inputFactorUsed
, size_t nBestSize
, const std::string &nBestFilePath);
IOWrapper(const std::vector<Moses::FactorType> &inputFactorOrder
, const std::vector<Moses::FactorType> &outputFactorOrder
, const Moses::FactorMask &inputFactorUsed
, size_t nBestSize
, const std::string &nBestFilePath
, const std::string &inputFilePath);
~IOWrapper();
Moses::InputType* GetInput(Moses::InputType *inputType);
void OutputBestHypo(const MosesChart::Hypothesis *hypo, long translationId, bool reportSegmentation, bool reportAllFactors);
void OutputBestHypo(const std::vector<const Moses::Factor*>& mbrBestHypo, long translationId, bool reportSegmentation, bool reportAllFactors);
void OutputNBestList(const MosesChart::TrellisPathList &nBestList, long translationId);
void Backtrack(const MosesChart::Hypothesis *hypo);
void ResetTranslationId() { m_translationId = 0; }
std::ostream &GetOutputSearchGraphStream()
{ return *m_outputSearchGraphStream; }
};

View File

@ -0,0 +1,251 @@
// $Id: Main.cpp 2615 2009-11-12 13:18:20Z hieuhoang1972 $
/***********************************************************************
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>
#endif
#include <fstream>
#include "Main.h"
#include "TrellisPath.h"
#include "FactorCollection.h"
#include "Manager.h"
#include "Phrase.h"
#include "Util.h"
#include "TrellisPathList.h"
#include "Timer.h"
#include "IOWrapper.h"
#include "Sentence.h"
#include "ConfusionNet.h"
#include "WordLattice.h"
#include "TreeInput.h"
#include "TranslationAnalysis.h"
#include "mbr.h"
#include "../../moses-chart/src/ChartManager.h"
#include "../../moses-chart/src/ChartHypothesis.h"
#include "../../moses-chart/src/ChartTrellisPathList.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;
using namespace Moses;
using namespace MosesChart;
bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source)
{
delete source;
switch(inputType)
{
case SentenceInput: source = ioWrapper.GetInput(new Sentence(Input)); break;
case ConfusionNetworkInput: source = ioWrapper.GetInput(new ConfusionNet); break;
case WordLatticeInput: source = ioWrapper.GetInput(new WordLattice); break;
case TreeInputType: source = ioWrapper.GetInput(new TreeInput(Input));break;
default: TRACE_ERR("Unknown input type: " << inputType << "\n");
}
return (source ? true : false);
}
int main(int argc, char* argv[])
{
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;
assert(staticData.GetSearchAlgorithm() == ChartDecoding);
// set up read/writing class
IOWrapper *ioWrapper = 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 (ioWrapper == NULL)
return EXIT_FAILURE;
// read each sentence & decode
InputType *source=0;
size_t lineCount = 0;
while(ReadInput(*ioWrapper,staticData.GetInputType(),source))
{
// note: source is only valid within this while loop!
IFVERBOSE(1)
ResetUserTime();
VERBOSE(2,"\nTRANSLATING(" << ++lineCount << "): " << *source);
//cerr << *source << endl;
MosesChart::Manager manager(*source);
manager.ProcessSentence();
assert(!staticData.UseMBR());
if (!staticData.UseMBR()){
ioWrapper->OutputBestHypo(manager.GetBestHypothesis(), source->GetTranslationId(),
staticData.GetReportSegmentation(),
staticData.GetReportAllFactors()
);
IFVERBOSE(2) { PrintUserTime("Best Hypothesis Generation Time:"); }
// n-best
size_t nBestSize = staticData.GetNBestSize();
if (nBestSize > 0)
{
VERBOSE(2,"WRITING " << nBestSize << " TRANSLATION ALTERNATIVES TO " << staticData.GetNBestFilePath() << endl);
MosesChart::TrellisPathList nBestList;
manager.CalcNBest(nBestSize, nBestList,staticData.GetDistinctNBest());
ioWrapper->OutputNBestList(nBestList, source->GetTranslationId());
IFVERBOSE(2) { PrintUserTime("N-Best Hypotheses Generation Time:"); }
}
if (staticData.GetOutputSearchGraph())
manager.GetSearchGraph(source->GetTranslationId(), ioWrapper->GetOutputSearchGraphStream());
}
else {
/*
size_t nBestSize = staticData.GetNBestSize();
cerr << "NBEST SIZE : " << nBestSize << endl;
assert(nBestSize > 0);
if (nBestSize > 0)
{
VERBOSE(2,"WRITING " << nBestSize << " TRANSLATION ALTERNATIVES TO " << staticData.GetNBestFilePath() << endl);
MosesChart::TrellisPathList nBestList;
manager.CalcNBest(nBestSize, nBestList,true);
std::vector<const Factor*> mbrBestHypo = doMBR(nBestList);
ioWrapper->OutputBestHypo(mbrBestHypo, source->GetTranslationId(),
staticData.GetReportSegmentation(),
staticData.GetReportAllFactors()
);
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();
} // while(ReadInput
delete ioWrapper;
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
}
IOWrapper *GetIODevice(const StaticData &staticData)
{
IOWrapper *ioWrapper;
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];
ioWrapper = new IOWrapper(inputFactorOrder, outputFactorOrder, inputFactorUsed
, staticData.GetNBestSize()
, staticData.GetNBestFilePath()
, filePath);
}
else
{
VERBOSE(1,"IO from STDOUT/STDIN" << endl);
ioWrapper = new IOWrapper(inputFactorOrder, outputFactorOrder, inputFactorUsed
, staticData.GetNBestSize()
, staticData.GetNBestFilePath());
}
ioWrapper->ResetTranslationId();
IFVERBOSE(1)
PrintUserTime("Created input-output object");
return ioWrapper;
}

View File

@ -0,0 +1,42 @@
// $Id: Main.h 2474 2009-08-06 17:32:28Z hieuhoang1972 $
/***********************************************************************
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 IOWrapper;
int main(int argc, char* argv[]);
IOWrapper *GetIODevice(const Moses::StaticData &staticData);

View File

@ -0,0 +1,10 @@
bin_PROGRAMS = moses_chart
moses_chart_SOURCES = Main.cpp mbr.cpp IOWrapper.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_chart_LDADD = -L$(top_srcdir)/moses/src -L$(top_srcdir)/moses-chart/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lmoses-chart -lOnDiskPt
moses_chart_DEPENDENCIES = $(top_srcdir)/moses/src/libmoses.la $(top_srcdir)/moses-chart/src/libmoses-chart.a $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a

View File

@ -0,0 +1,46 @@
// $Id: TranslationAnalysis.cpp 2474 2009-08-06 17:32:28Z hieuhoang1972 $
#include <iostream>
#include <sstream>
#include <algorithm>
#include "StaticData.h"
#include "TranslationAnalysis.h"
#include "TranslationOption.h"
#include "DecodeStepTranslation.h"
using namespace std;
using namespace Moses;
namespace TranslationAnalysis {
void PrintTranslationAnalysis(ostream &os, const Hypothesis* hypo)
{
/*
os << endl << "TRANSLATION HYPOTHESIS DETAILS:" << endl;
queue<const Hypothesis*> translationPath;
while (hypo)
{
translationPath.push(hypo);
hypo = hypo->GetPrevHypo();
}
while (!translationPath.empty())
{
hypo = translationPath.front();
translationPath.pop();
const TranslationOption *transOpt = hypo->GetTranslationOption();
if (transOpt != NULL)
{
os << hypo->GetCurrSourceWordsRange() << " ";
for (size_t decodeStepId = 0; decodeStepId < DecodeStepTranslation::GetNumTransStep(); ++decodeStepId)
os << decodeStepId << "=" << transOpt->GetSubRangeCount(decodeStepId) << ",";
os << *transOpt << endl;
}
}
os << "END TRANSLATION" << endl;
*/
}
}

View File

@ -0,0 +1,24 @@
// $Id: TranslationAnalysis.h 2474 2009-08-06 17:32:28Z hieuhoang1972 $
/*
* also see moses/SentenceStats
*/
#ifndef _TRANSLATION_ANALYSIS_H_
#define _TRANSLATION_ANALYSIS_H_
#include <iostream>
#include "Hypothesis.h"
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 Moses::Hypothesis* hypo);
}
#endif

179
moses-chart-cmd/src/mbr.cpp Normal file
View File

@ -0,0 +1,179 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include "TrellisPathList.h"
#include "TrellisPath.h"
#include "StaticData.h"
#include "Util.h"
#include "mbr.h"
using namespace std ;
using namespace Moses;
/* Input :
1. a sorted n-best list, with duplicates filtered out in the following format
0 ||| amr moussa is currently on a visit to libya , tomorrow , sunday , to hold talks with regard to the in sudan . ||| 0 -4.94418 0 0 -2.16036 0 0 -81.4462 -106.593 -114.43 -105.55 -12.7873 -26.9057 -25.3715 -52.9336 7.99917 -24 ||| -4.58432
2. a weight vector
3. bleu order ( default = 4)
4. scaling factor to weigh the weight vector (default = 1.0)
Output :
translations that minimise the Bayes Risk of the n-best list
*/
int BLEU_ORDER = 4;
int SMOOTH = 1;
int DEBUG = 0;
float min_interval = 1e-4;
void extract_ngrams(const vector<const Factor* >& sentence, map < vector < const Factor* >, int > & allngrams)
{
vector< const Factor* > ngram;
for (int k = 0; k < BLEU_ORDER; k++)
{
for(int i =0; i < max((int)sentence.size()-k,0); i++)
{
for ( int j = i; j<= i+k; j++)
{
ngram.push_back(sentence[j]);
}
++allngrams[ngram];
ngram.clear();
}
}
}
float calculate_score(const vector< vector<const Factor*> > & sents, int ref, int hyp, vector < map < vector < const Factor *>, int > > & ngram_stats ) {
int comps_n = 2*BLEU_ORDER+1;
vector<int> comps(comps_n);
float logbleu = 0.0, brevity;
int hyp_length = sents[hyp].size();
for (int i =0; i<BLEU_ORDER;i++)
{
comps[2*i] = 0;
comps[2*i+1] = max(hyp_length-i,0);
}
map< vector < const Factor * > ,int > & hyp_ngrams = ngram_stats[hyp] ;
map< vector < const Factor * >, int > & ref_ngrams = ngram_stats[ref] ;
for (map< vector< const Factor * >, int >::iterator it = hyp_ngrams.begin();
it != hyp_ngrams.end(); it++)
{
map< vector< const Factor * >, int >::iterator ref_it = ref_ngrams.find(it->first);
if(ref_it != ref_ngrams.end())
{
comps[2* (it->first.size()-1)] += min(ref_it->second,it->second);
}
}
comps[comps_n-1] = sents[ref].size();
if (DEBUG)
{
for ( int i = 0; i < comps_n; i++)
cerr << "Comp " << i << " : " << comps[i];
}
for (int i=0; i<BLEU_ORDER; i++)
{
if (comps[0] == 0)
return 0.0;
if ( i > 0 )
logbleu += log((float)comps[2*i]+SMOOTH)-log((float)comps[2*i+1]+SMOOTH);
else
logbleu += log((float)comps[2*i])-log((float)comps[2*i+1]);
}
logbleu /= BLEU_ORDER;
brevity = 1.0-(float)comps[comps_n-1]/comps[1]; // comps[comps_n-1] is the ref length, comps[1] is the test length
if (brevity < 0.0)
logbleu += brevity;
return exp(logbleu);
}
vector<const Factor*> doMBR(const TrellisPathList& nBestList){
// cerr << "Sentence " << sent << " has " << sents.size() << " candidate translations" << endl;
float marginal = 0;
vector<float> joint_prob_vec;
vector< vector<const Factor*> > translations;
float joint_prob;
vector< map < vector <const Factor *>, int > > ngram_stats;
TrellisPathList::const_iterator iter;
//TrellisPath* hyp = NULL;
for (iter = nBestList.begin() ; iter != nBestList.end() ; ++iter)
{
const TrellisPath &path = **iter;
joint_prob = UntransformScore(StaticData::Instance().GetMBRScale() * path.GetScoreBreakdown().InnerProduct(StaticData::Instance().GetAllWeights()));
marginal += joint_prob;
joint_prob_vec.push_back(joint_prob);
//Cache ngram counts
map < vector < const Factor *>, int > counts;
vector<const Factor*> translation;
GetOutputFactors(path, translation);
//TO DO
extract_ngrams(translation,counts);
ngram_stats.push_back(counts);
translations.push_back(translation);
}
vector<float> mbr_loss;
float bleu, weightedLoss;
float weightedLossCumul = 0;
float minMBRLoss = 1000000;
int minMBRLossIdx = -1;
/* Main MBR computation done here */
for (int i = 0; i < nBestList.GetSize(); i++){
weightedLossCumul = 0;
for (int j = 0; j < nBestList.GetSize(); j++){
if ( i != j) {
bleu = calculate_score(translations, j, i,ngram_stats );
weightedLoss = ( 1 - bleu) * ( joint_prob_vec[j]/marginal);
weightedLossCumul += weightedLoss;
if (weightedLossCumul > minMBRLoss)
break;
}
}
if (weightedLossCumul < minMBRLoss){
minMBRLoss = weightedLossCumul;
minMBRLossIdx = i;
}
}
/* Find sentence that minimises Bayes Risk under 1- BLEU loss */
return translations[minMBRLossIdx];
}
void GetOutputFactors(const TrellisPath &path, vector <const Factor*> &translation){
const std::vector<const Hypothesis *> &edges = path.GetEdges();
const std::vector<FactorType>& outputFactorOrder = StaticData::Instance().GetOutputFactorOrder();
assert (outputFactorOrder.size() == 1);
// print the surface factor of the translation
for (int currEdge = (int)edges.size() - 1 ; currEdge >= 0 ; currEdge--)
{
const Hypothesis &edge = *edges[currEdge];
const Phrase &phrase = edge.GetCurrTargetPhrase();
size_t size = phrase.GetSize();
for (size_t pos = 0 ; pos < size ; pos++)
{
const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]);
translation.push_back(factor);
}
}
}

27
moses-chart-cmd/src/mbr.h Normal file
View File

@ -0,0 +1,27 @@
// $Id: mbr.h 2474 2009-08-06 17:32:28Z hieuhoang1972 $
/***********************************************************************
Moses - factored phrase-based language decoder
Copyright (C) 2006 University of Edinburgh
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
***********************************************************************/
#pragma once
std::vector<const Moses::Factor*> doMBR(const Moses::TrellisPathList& nBestList);
void GetOutputFactors(const Moses::TrellisPath &path, std::vector <const Moses::Factor*> &translation);
float calculate_score(const std::vector< std::vector<const Moses::Factor*> > & sents, int ref, int hyp, std::vector < std::map < std::vector < const Moses::Factor *>, int > > & ngram_stats );

23
moses-chart/.cdtbuild Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 3.1.0?>
<ManagedProjectBuildInfo>
<project id="moses-chart.cdt.managedbuild.target.gnu.lib.2083958710" name="Static Library (Gnu)" projectType="cdt.managedbuild.target.gnu.lib">
<configuration artifactExtension="a" artifactName="moses-chart" 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.lib.debug.149647450" name="Debug" parent="cdt.managedbuild.config.gnu.lib.debug">
<toolChain id="cdt.managedbuild.toolchain.gnu.lib.debug.1685588392" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.debug">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug.1887370952" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug.753739956" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.1122938032" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1756643793" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/>
</toolChain>
</configuration>
<configuration artifactExtension="a" artifactName="moses-chart" 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.lib.release.2142222535" name="Release" parent="cdt.managedbuild.config.gnu.lib.release">
<toolChain id="cdt.managedbuild.toolchain.gnu.lib.release.967045712" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.release">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release.731336284" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.release.339798740" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.release.509124270" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.release.730628705" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.release"/>
</toolChain>
</configuration>
</project>
</ManagedProjectBuildInfo>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 3.1.0?>
<ManagedProjectBuildInfo>
<project id="moses-chart.cdt.managedbuild.target.gnu.lib.2083958710" name="Static Library (Gnu)" projectType="cdt.managedbuild.target.gnu.lib">
<configuration artifactExtension="a" artifactName="moses-chart" 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.lib.debug.149647450" name="Debug" parent="cdt.managedbuild.config.gnu.lib.debug">
<toolChain id="cdt.managedbuild.toolchain.gnu.lib.debug.1685588392" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.debug">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug.1887370952" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug.753739956" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.1122938032" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1756643793" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug"/>
</toolChain>
</configuration>
<configuration artifactExtension="a" artifactName="moses-chart" 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.lib.release.2142222535" name="Release" parent="cdt.managedbuild.config.gnu.lib.release">
<toolChain id="cdt.managedbuild.toolchain.gnu.lib.release.967045712" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.release">
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release.731336284" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.release.339798740" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.release.509124270" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.release.730628705" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.release"/>
</toolChain>
</configuration>
</project>
</ManagedProjectBuildInfo>

14
moses-chart/.cdtproject Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-cdt version="2.0"?>
<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake">
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/>
<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>

110
moses-chart/.cproject Normal file
View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.lib.debug.149647450">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.lib.debug.149647450" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/moses-chart"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/moses-chart/Debug"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="a" artifactName="moses-chart" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" 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.lib.debug.149647450" name="Debug" parent="cdt.managedbuild.config.gnu.lib.debug">
<folderInfo id="cdt.managedbuild.config.gnu.lib.debug.149647450.246722321" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.lib.debug.1685588392" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.lib.debug.613849750" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.lib.debug"/>
<builder buildPath="${workspace_loc:/moses-chart/Debug}" id="cdt.managedbuild.target.gnu.builder.lib.debug.893383121" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug.1887370952" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug">
<option id="gnu.cpp.compiler.lib.debug.option.optimization.level.249189769" name="Optimization Level" superClass="gnu.cpp.compiler.lib.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.lib.debug.option.debugging.level.1356528979" name="Debug Level" superClass="gnu.cpp.compiler.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.75010" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="TRACE_ENABLE"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.466426525" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug.753739956" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.lib.debug.option.optimization.level.644634253" name="Optimization Level" superClass="gnu.c.compiler.lib.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.lib.debug.option.debugging.level.527121153" name="Debug Level" superClass="gnu.c.compiler.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1817436717" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.debug.1122938032" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.debug"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.debug.1756643793" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1985662972" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.108598126" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.684728481" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="scannerConfiguration"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.lib.release.2142222535">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.lib.release.2142222535" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/moses-chart"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/moses-chart/Release"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="a" artifactName="moses-chart" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" 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.lib.release.2142222535" name="Release" parent="cdt.managedbuild.config.gnu.lib.release">
<folderInfo id="cdt.managedbuild.config.gnu.lib.release.2142222535.1833342179" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.lib.release.967045712" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.lib.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.lib.release.2143182462" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.lib.release"/>
<builder buildPath="${workspace_loc:/moses-chart/Release}" id="cdt.managedbuild.target.gnu.builder.lib.release.327430872" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release.731336284" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release">
<option id="gnu.cpp.compiler.lib.release.option.optimization.level.1889105896" name="Optimization Level" superClass="gnu.cpp.compiler.lib.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.lib.release.option.debugging.level.660624423" name="Debug Level" superClass="gnu.cpp.compiler.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.774417125" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="TRACE_ENABLE"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.2070899100" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.lib.release.339798740" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.lib.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.lib.release.option.optimization.level.212445223" name="Optimization Level" superClass="gnu.c.compiler.lib.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.lib.release.option.debugging.level.1600332613" name="Debug Level" superClass="gnu.c.compiler.lib.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.209839519" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.lib.release.509124270" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.lib.release"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.lib.release.730628705" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.lib.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.758630232" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.1772818435" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.1483171829" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="scannerConfiguration"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="moses-chart.cdt.managedbuild.target.gnu.lib.2083958710" name="Static Library (Gnu)" projectType="cdt.managedbuild.target.gnu.lib"/>
</storageModule>
</cproject>

83
moses-chart/.project Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>moses-chart</name>
<comment></comment>
<projects>
<project>moses</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/moses-chart/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>moses-chart</name>
<comment></comment>
<projects>
<project>moses</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>

View File

@ -0,0 +1,3 @@
#Tue Oct 21 00:08:17 BST 2008
eclipse.preferences.version=1
indexerId=org.eclipse.cdt.core.nullindexer

View File

@ -0,0 +1,8 @@
#Tue Oct 21 00:24:45 BST 2008
cdt.managedbuild.config.gnu.lib.debug.149647450/internalBuilder/enabled=false
cdt.managedbuild.config.gnu.lib.debug.149647450/internalBuilder/ignoreErr=true
cdt.managedbuild.config.gnu.lib.release.2142222535/internalBuilder/enabled=false
cdt.managedbuild.config.gnu.lib.release.2142222535/internalBuilder/ignoreErr=true
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.debug.149647450=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.lib.release.2142222535=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<environment>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n

View File

@ -0,0 +1,278 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="moses-chart"
ProjectGUID="{C877DCA8-B4C0-4357-B6AE-34575B3D3328}"
RootNamespace="moseschart"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LM_INTERNAL;TRACE_ENABLE"
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="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LM_INTERNAL;TRACE_ENABLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<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\ChartCell.cpp"
>
</File>
<File
RelativePath=".\src\ChartCellCollection.cpp"
>
</File>
<File
RelativePath=".\src\ChartHypothesis.cpp"
>
</File>
<File
RelativePath=".\src\ChartHypothesisCollection.cpp"
>
</File>
<File
RelativePath=".\src\ChartManager.cpp"
>
</File>
<File
RelativePath=".\src\ChartTranslationOption.cpp"
>
</File>
<File
RelativePath=".\src\ChartTranslationOptionCollection.cpp"
>
</File>
<File
RelativePath=".\src\ChartTranslationOptionList.cpp"
>
</File>
<File
RelativePath=".\src\ChartTrellisNode.cpp"
>
</File>
<File
RelativePath=".\src\ChartTrellisPath.cpp"
>
</File>
<File
RelativePath=".\src\ChartTrellisPathCollection.cpp"
>
</File>
<File
RelativePath=".\src\ChartTrellisPathList.cpp"
>
</File>
<File
RelativePath=".\src\Cube.cpp"
>
</File>
<File
RelativePath=".\src\QueueEntry.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\ChartCell.h"
>
</File>
<File
RelativePath=".\src\ChartCellCollection.h"
>
</File>
<File
RelativePath=".\src\ChartHypothesis.h"
>
</File>
<File
RelativePath=".\src\ChartHypothesisCollection.h"
>
</File>
<File
RelativePath=".\src\ChartManager.h"
>
</File>
<File
RelativePath=".\src\ChartTranslationOption.h"
>
</File>
<File
RelativePath=".\src\ChartTranslationOptionCollection.h"
>
</File>
<File
RelativePath=".\src\ChartTranslationOptionList.h"
>
</File>
<File
RelativePath=".\src\ChartTrellisNode.h"
>
</File>
<File
RelativePath=".\src\ChartTrellisPath.h"
>
</File>
<File
RelativePath=".\src\ChartTrellisPathCollection.h"
>
</File>
<File
RelativePath=".\src\ChartTrellisPathList.h"
>
</File>
<File
RelativePath=".\src\Cube.h"
>
</File>
<File
RelativePath=".\src\QueueEntry.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>

View File

@ -0,0 +1,360 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
1C04F8E4104C4A5C0090020F /* ChartHypothesisCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C04F8E1104C4A5C0090020F /* ChartHypothesisCollection.cpp */; };
1C04F8E5104C4A5C0090020F /* ChartHypothesisCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C04F8E2104C4A5C0090020F /* ChartHypothesisCollection.h */; };
1C335A840F20F8A200D0D9DF /* ChartCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A6E0F20F8A200D0D9DF /* ChartCell.cpp */; };
1C335A850F20F8A200D0D9DF /* ChartCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A6F0F20F8A200D0D9DF /* ChartCell.h */; };
1C335A860F20F8A200D0D9DF /* ChartHypothesis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A700F20F8A200D0D9DF /* ChartHypothesis.cpp */; };
1C335A870F20F8A200D0D9DF /* ChartHypothesis.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A710F20F8A200D0D9DF /* ChartHypothesis.h */; };
1C335A880F20F8A200D0D9DF /* ChartManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A720F20F8A200D0D9DF /* ChartManager.cpp */; };
1C335A890F20F8A200D0D9DF /* ChartManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A730F20F8A200D0D9DF /* ChartManager.h */; };
1C335A8A0F20F8A200D0D9DF /* ChartTranslationOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A740F20F8A200D0D9DF /* ChartTranslationOption.cpp */; };
1C335A8B0F20F8A200D0D9DF /* ChartTranslationOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A750F20F8A200D0D9DF /* ChartTranslationOption.h */; };
1C335A8C0F20F8A200D0D9DF /* ChartTranslationOptionCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A760F20F8A200D0D9DF /* ChartTranslationOptionCollection.cpp */; };
1C335A8D0F20F8A200D0D9DF /* ChartTranslationOptionCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A770F20F8A200D0D9DF /* ChartTranslationOptionCollection.h */; };
1C335A8E0F20F8A200D0D9DF /* ChartTranslationOptionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A780F20F8A200D0D9DF /* ChartTranslationOptionList.cpp */; };
1C335A8F0F20F8A200D0D9DF /* ChartTranslationOptionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A790F20F8A200D0D9DF /* ChartTranslationOptionList.h */; };
1C335A900F20F8A200D0D9DF /* ChartTrellisNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A7A0F20F8A200D0D9DF /* ChartTrellisNode.cpp */; };
1C335A910F20F8A200D0D9DF /* ChartTrellisNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A7B0F20F8A200D0D9DF /* ChartTrellisNode.h */; };
1C335A920F20F8A200D0D9DF /* ChartTrellisPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A7C0F20F8A200D0D9DF /* ChartTrellisPath.cpp */; };
1C335A930F20F8A200D0D9DF /* ChartTrellisPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A7D0F20F8A200D0D9DF /* ChartTrellisPath.h */; };
1C335A940F20F8A200D0D9DF /* ChartTrellisPathCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A7E0F20F8A200D0D9DF /* ChartTrellisPathCollection.cpp */; };
1C335A950F20F8A200D0D9DF /* ChartTrellisPathCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A7F0F20F8A200D0D9DF /* ChartTrellisPathCollection.h */; };
1C335A960F20F8A200D0D9DF /* ChartTrellisPathList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A800F20F8A200D0D9DF /* ChartTrellisPathList.cpp */; };
1C335A970F20F8A200D0D9DF /* ChartTrellisPathList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A810F20F8A200D0D9DF /* ChartTrellisPathList.h */; };
1C335A980F20F8A200D0D9DF /* QueueEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C335A820F20F8A200D0D9DF /* QueueEntry.cpp */; };
1C335A990F20F8A200D0D9DF /* QueueEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C335A830F20F8A200D0D9DF /* QueueEntry.h */; };
1C500AC60FB9EC3100DFD24F /* ChartCellCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C500AC40FB9EC3100DFD24F /* ChartCellCollection.cpp */; };
1C500AC70FB9EC3100DFD24F /* ChartCellCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C500AC50FB9EC3100DFD24F /* ChartCellCollection.h */; };
1C5870CC103AEA97008C67A8 /* Cube.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C5870CA103AEA97008C67A8 /* Cube.h */; };
1C5870CD103AEA97008C67A8 /* Cube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C5870CB103AEA97008C67A8 /* Cube.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1C04F8E1104C4A5C0090020F /* ChartHypothesisCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartHypothesisCollection.cpp; path = src/ChartHypothesisCollection.cpp; sourceTree = "<group>"; };
1C04F8E2104C4A5C0090020F /* ChartHypothesisCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartHypothesisCollection.h; path = src/ChartHypothesisCollection.h; sourceTree = "<group>"; };
1C04F8E3104C4A5C0090020F /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Makefile.am; path = src/Makefile.am; sourceTree = "<group>"; };
1C335A6E0F20F8A200D0D9DF /* ChartCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartCell.cpp; path = src/ChartCell.cpp; sourceTree = "<group>"; };
1C335A6F0F20F8A200D0D9DF /* ChartCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartCell.h; path = src/ChartCell.h; sourceTree = "<group>"; };
1C335A700F20F8A200D0D9DF /* ChartHypothesis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartHypothesis.cpp; path = src/ChartHypothesis.cpp; sourceTree = "<group>"; };
1C335A710F20F8A200D0D9DF /* ChartHypothesis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartHypothesis.h; path = src/ChartHypothesis.h; sourceTree = "<group>"; };
1C335A720F20F8A200D0D9DF /* ChartManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartManager.cpp; path = src/ChartManager.cpp; sourceTree = "<group>"; };
1C335A730F20F8A200D0D9DF /* ChartManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartManager.h; path = src/ChartManager.h; sourceTree = "<group>"; };
1C335A740F20F8A200D0D9DF /* ChartTranslationOption.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTranslationOption.cpp; path = src/ChartTranslationOption.cpp; sourceTree = "<group>"; };
1C335A750F20F8A200D0D9DF /* ChartTranslationOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTranslationOption.h; path = src/ChartTranslationOption.h; sourceTree = "<group>"; };
1C335A760F20F8A200D0D9DF /* ChartTranslationOptionCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTranslationOptionCollection.cpp; path = src/ChartTranslationOptionCollection.cpp; sourceTree = "<group>"; };
1C335A770F20F8A200D0D9DF /* ChartTranslationOptionCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTranslationOptionCollection.h; path = src/ChartTranslationOptionCollection.h; sourceTree = "<group>"; };
1C335A780F20F8A200D0D9DF /* ChartTranslationOptionList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTranslationOptionList.cpp; path = src/ChartTranslationOptionList.cpp; sourceTree = "<group>"; };
1C335A790F20F8A200D0D9DF /* ChartTranslationOptionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTranslationOptionList.h; path = src/ChartTranslationOptionList.h; sourceTree = "<group>"; };
1C335A7A0F20F8A200D0D9DF /* ChartTrellisNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTrellisNode.cpp; path = src/ChartTrellisNode.cpp; sourceTree = "<group>"; };
1C335A7B0F20F8A200D0D9DF /* ChartTrellisNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTrellisNode.h; path = src/ChartTrellisNode.h; sourceTree = "<group>"; };
1C335A7C0F20F8A200D0D9DF /* ChartTrellisPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTrellisPath.cpp; path = src/ChartTrellisPath.cpp; sourceTree = "<group>"; };
1C335A7D0F20F8A200D0D9DF /* ChartTrellisPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTrellisPath.h; path = src/ChartTrellisPath.h; sourceTree = "<group>"; };
1C335A7E0F20F8A200D0D9DF /* ChartTrellisPathCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTrellisPathCollection.cpp; path = src/ChartTrellisPathCollection.cpp; sourceTree = "<group>"; };
1C335A7F0F20F8A200D0D9DF /* ChartTrellisPathCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTrellisPathCollection.h; path = src/ChartTrellisPathCollection.h; sourceTree = "<group>"; };
1C335A800F20F8A200D0D9DF /* ChartTrellisPathList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTrellisPathList.cpp; path = src/ChartTrellisPathList.cpp; sourceTree = "<group>"; };
1C335A810F20F8A200D0D9DF /* ChartTrellisPathList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTrellisPathList.h; path = src/ChartTrellisPathList.h; sourceTree = "<group>"; };
1C335A820F20F8A200D0D9DF /* QueueEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = QueueEntry.cpp; path = src/QueueEntry.cpp; sourceTree = "<group>"; };
1C335A830F20F8A200D0D9DF /* QueueEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QueueEntry.h; path = src/QueueEntry.h; sourceTree = "<group>"; };
1C335AA10F20F8F400D0D9DF /* libmoses-chart.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libmoses-chart.a"; sourceTree = BUILT_PRODUCTS_DIR; };
1C500AC40FB9EC3100DFD24F /* ChartCellCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartCellCollection.cpp; path = src/ChartCellCollection.cpp; sourceTree = "<group>"; };
1C500AC50FB9EC3100DFD24F /* ChartCellCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartCellCollection.h; path = src/ChartCellCollection.h; sourceTree = "<group>"; };
1C5870CA103AEA97008C67A8 /* Cube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Cube.h; path = src/Cube.h; sourceTree = "<group>"; };
1C5870CB103AEA97008C67A8 /* Cube.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Cube.cpp; path = src/Cube.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
D289987405E68DCB004EDB86 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* moses */ = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07 /* Source */,
C6A0FF2B0290797F04C91782 /* Documentation */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = moses;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
1C335A6E0F20F8A200D0D9DF /* ChartCell.cpp */,
1C335A6F0F20F8A200D0D9DF /* ChartCell.h */,
1C500AC40FB9EC3100DFD24F /* ChartCellCollection.cpp */,
1C500AC50FB9EC3100DFD24F /* ChartCellCollection.h */,
1C335A700F20F8A200D0D9DF /* ChartHypothesis.cpp */,
1C335A710F20F8A200D0D9DF /* ChartHypothesis.h */,
1C04F8E1104C4A5C0090020F /* ChartHypothesisCollection.cpp */,
1C04F8E2104C4A5C0090020F /* ChartHypothesisCollection.h */,
1C335A720F20F8A200D0D9DF /* ChartManager.cpp */,
1C335A730F20F8A200D0D9DF /* ChartManager.h */,
1C335A740F20F8A200D0D9DF /* ChartTranslationOption.cpp */,
1C335A750F20F8A200D0D9DF /* ChartTranslationOption.h */,
1C335A760F20F8A200D0D9DF /* ChartTranslationOptionCollection.cpp */,
1C335A770F20F8A200D0D9DF /* ChartTranslationOptionCollection.h */,
1C335A780F20F8A200D0D9DF /* ChartTranslationOptionList.cpp */,
1C335A790F20F8A200D0D9DF /* ChartTranslationOptionList.h */,
1C335A7A0F20F8A200D0D9DF /* ChartTrellisNode.cpp */,
1C335A7B0F20F8A200D0D9DF /* ChartTrellisNode.h */,
1C335A7C0F20F8A200D0D9DF /* ChartTrellisPath.cpp */,
1C335A7D0F20F8A200D0D9DF /* ChartTrellisPath.h */,
1C335A7E0F20F8A200D0D9DF /* ChartTrellisPathCollection.cpp */,
1C335A7F0F20F8A200D0D9DF /* ChartTrellisPathCollection.h */,
1C335A800F20F8A200D0D9DF /* ChartTrellisPathList.cpp */,
1C335A810F20F8A200D0D9DF /* ChartTrellisPathList.h */,
1C5870CB103AEA97008C67A8 /* Cube.cpp */,
1C5870CA103AEA97008C67A8 /* Cube.h */,
1C04F8E3104C4A5C0090020F /* Makefile.am */,
1C335A820F20F8A200D0D9DF /* QueueEntry.cpp */,
1C335A830F20F8A200D0D9DF /* QueueEntry.h */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1C335AA10F20F8F400D0D9DF /* libmoses-chart.a */,
);
name = Products;
sourceTree = "<group>";
};
C6A0FF2B0290797F04C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
);
name = Documentation;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
D2AAC043055464E500DB518D /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
1C335A850F20F8A200D0D9DF /* ChartCell.h in Headers */,
1C335A870F20F8A200D0D9DF /* ChartHypothesis.h in Headers */,
1C335A890F20F8A200D0D9DF /* ChartManager.h in Headers */,
1C335A8B0F20F8A200D0D9DF /* ChartTranslationOption.h in Headers */,
1C335A8D0F20F8A200D0D9DF /* ChartTranslationOptionCollection.h in Headers */,
1C335A8F0F20F8A200D0D9DF /* ChartTranslationOptionList.h in Headers */,
1C335A910F20F8A200D0D9DF /* ChartTrellisNode.h in Headers */,
1C335A930F20F8A200D0D9DF /* ChartTrellisPath.h in Headers */,
1C335A950F20F8A200D0D9DF /* ChartTrellisPathCollection.h in Headers */,
1C335A970F20F8A200D0D9DF /* ChartTrellisPathList.h in Headers */,
1C335A990F20F8A200D0D9DF /* QueueEntry.h in Headers */,
1C500AC70FB9EC3100DFD24F /* ChartCellCollection.h in Headers */,
1C5870CC103AEA97008C67A8 /* Cube.h in Headers */,
1C04F8E5104C4A5C0090020F /* ChartHypothesisCollection.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
D2AAC045055464E500DB518D /* moses-chart */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0396E18C0C0B186F00D95CFF /* Build configuration list for PBXNativeTarget "moses-chart" */;
buildPhases = (
D2AAC043055464E500DB518D /* Headers */,
D2AAC044055464E500DB518D /* Sources */,
D289987405E68DCB004EDB86 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "moses-chart";
productName = moses;
productReference = 1C335AA10F20F8F400D0D9DF /* libmoses-chart.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 0396E1900C0B186F00D95CFF /* Build configuration list for PBXProject "moses-chart" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* moses */;
projectDirPath = "";
projectRoot = "";
targets = (
D2AAC045055464E500DB518D /* moses-chart */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
D2AAC044055464E500DB518D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1C335A840F20F8A200D0D9DF /* ChartCell.cpp in Sources */,
1C335A860F20F8A200D0D9DF /* ChartHypothesis.cpp in Sources */,
1C335A880F20F8A200D0D9DF /* ChartManager.cpp in Sources */,
1C335A8A0F20F8A200D0D9DF /* ChartTranslationOption.cpp in Sources */,
1C335A8C0F20F8A200D0D9DF /* ChartTranslationOptionCollection.cpp in Sources */,
1C335A8E0F20F8A200D0D9DF /* ChartTranslationOptionList.cpp in Sources */,
1C335A900F20F8A200D0D9DF /* ChartTrellisNode.cpp in Sources */,
1C335A920F20F8A200D0D9DF /* ChartTrellisPath.cpp in Sources */,
1C335A940F20F8A200D0D9DF /* ChartTrellisPathCollection.cpp in Sources */,
1C335A960F20F8A200D0D9DF /* ChartTrellisPathList.cpp in Sources */,
1C335A980F20F8A200D0D9DF /* QueueEntry.cpp in Sources */,
1C500AC60FB9EC3100DFD24F /* ChartCellCollection.cpp in Sources */,
1C5870CD103AEA97008C67A8 /* Cube.cpp in Sources */,
1C04F8E4104C4A5C0090020F /* ChartHypothesisCollection.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
0396E18D0C0B186F00D95CFF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
LM_IRST,
LM_SRI,
TRACE_ENABLE,
"_FILE_OFFSET_BITS=64",
_LARGE_FILES,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
../irstlm/include,
../srilm/misc/src,
../srilm/dstruct/src,
../srilm/include,
../srilm/lm/src,
);
INSTALL_PATH = /usr/local/lib;
LIBRARY_STYLE = STATIC;
PREBINDING = NO;
PRODUCT_NAME = "moses-chart";
REZ_PREPROCESSOR_DEFINITIONS = "";
ZERO_LINK = NO;
};
name = Debug;
};
0396E18E0C0B186F00D95CFF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PREPROCESSOR_DEFINITIONS = (
LM_IRST,
LM_SRI,
TRACE_ENABLE,
"_FILE_OFFSET_BITS=64",
_LARGE_FILES,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
../irstlm/include,
../srilm/misc/src,
../srilm/dstruct/src,
../srilm/include,
../srilm/lm/src,
);
INSTALL_PATH = /usr/local/lib;
LIBRARY_STYLE = STATIC;
PREBINDING = NO;
PRODUCT_NAME = "moses-chart";
ZERO_LINK = NO;
};
name = Release;
};
0396E18F0C0B186F00D95CFF /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PREPROCESSOR_DEFINITIONS = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
INSTALL_PATH = /usr/local/lib;
LIBRARY_STYLE = STATIC;
PREBINDING = NO;
PRODUCT_NAME = moses;
};
name = Default;
};
0396E1910C0B186F00D95CFF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_OPTIMIZATION_LEVEL = 0;
VALID_ARCHS = i386;
};
name = Debug;
};
0396E1920C0B186F00D95CFF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_OPTIMIZATION_LEVEL = 0;
};
name = Release;
};
0396E1930C0B186F00D95CFF /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_OPTIMIZATION_LEVEL = 0;
};
name = Default;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0396E18C0C0B186F00D95CFF /* Build configuration list for PBXNativeTarget "moses-chart" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0396E18D0C0B186F00D95CFF /* Debug */,
0396E18E0C0B186F00D95CFF /* Release */,
0396E18F0C0B186F00D95CFF /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
0396E1900C0B186F00D95CFF /* Build configuration list for PBXProject "moses-chart" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0396E1910C0B186F00D95CFF /* Debug */,
0396E1920C0B186F00D95CFF /* Release */,
0396E1930C0B186F00D95CFF /* Default */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Default;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}

View File

@ -0,0 +1,220 @@
#include <algorithm>
#include "ChartCell.h"
#include "ChartTranslationOptionCollection.h"
#include "ChartTranslationOption.h"
#include "ChartCellCollection.h"
#include "Cube.h"
#include "QueueEntry.h"
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/Util.h"
#include "../../moses/src/StaticData.h"
#include "../../moses/src/ChartRule.h"
using namespace std;
using namespace Moses;
namespace Moses
{
extern bool g_debug;
}
namespace MosesChart
{
ChartCell::ChartCell(size_t startPos, size_t endPos, Manager &manager)
:m_coverage(startPos, endPos)
,m_manager(manager)
{
const StaticData &staticData = StaticData::Instance();
m_nBestIsEnabled = staticData.IsNBestEnabled();
}
const HypoList &ChartCell::GetSortedHypotheses(const Moses::Word &headWord) const
{
std::map<Moses::Word, HypothesisCollection>::const_iterator
iter = m_hypoColl.find(headWord);
assert(iter != m_hypoColl.end());
return iter->second.GetSortedHypotheses();
}
bool ChartCell::AddHypothesis(Hypothesis *hypo)
{
const Word &targetLHS = hypo->GetTargetLHS();
return m_hypoColl[targetLHS].AddHypothesis(hypo, m_manager);
}
void ChartCell::PruneToSize()
{
std::map<Moses::Word, HypothesisCollection>::iterator iter;
for (iter = m_hypoColl.begin(); iter != m_hypoColl.end(); ++iter)
{
HypothesisCollection &coll = iter->second;
coll.PruneToSize(m_manager);
}
}
void ChartCell::ProcessSentence(const TranslationOptionList &transOptList
, const ChartCellCollection &allChartCells)
{
const StaticData &staticData = StaticData::Instance();
Cube cube;
// add all trans opt into queue. using only 1st child node.
TranslationOptionList::const_iterator iterList;
for (iterList = transOptList.begin(); iterList != transOptList.end(); ++iterList)
{
const TranslationOption &transOpt = **iterList;
bool isOK;
QueueEntry *queueEntry = new QueueEntry(transOpt, allChartCells, isOK);
if (isOK)
cube.Add(queueEntry);
else
delete queueEntry;
}
// pluck things out of queue and add to hypo collection
const size_t popLimit = staticData.GetCubePruningPopLimit();
for (size_t numPops = 0; numPops < popLimit && !cube.IsEmpty(); ++numPops)
{
QueueEntry *queueEntry = cube.Pop();
queueEntry->GetTranslationOption().GetTotalScore();
Hypothesis *hypo = new Hypothesis(*queueEntry, m_manager);
assert(hypo);
hypo->CalcScore();
AddHypothesis(hypo);
// Expand queue entry
queueEntry->CreateDeviants(cube);
}
}
void ChartCell::SortHypotheses()
{
// sort each mini cells & fill up target lhs list
assert(m_headWords.empty());
m_headWords.reserve(m_hypoColl.size());
std::map<Moses::Word, HypothesisCollection>::iterator iter;
for (iter = m_hypoColl.begin(); iter != m_hypoColl.end(); ++iter)
{
m_headWords.push_back(iter->first);
HypothesisCollection &coll = iter->second;
coll.SortHypotheses();
}
}
const Hypothesis *ChartCell::GetBestHypothesis() const
{
const Hypothesis *ret = NULL;
float bestScore = -std::numeric_limits<float>::infinity();
std::map<Moses::Word, HypothesisCollection>::const_iterator iter;
for (iter = m_hypoColl.begin(); iter != m_hypoColl.end(); ++iter)
{
const HypoList &sortedList = iter->second.GetSortedHypotheses();
assert(sortedList.size() > 0);
const Hypothesis *hypo = sortedList[0];
if (hypo->GetTotalScore() > bestScore)
{
bestScore = hypo->GetTotalScore();
ret = hypo;
};
}
return ret;
}
bool ChartCell::HeadwordExists(const Moses::Word &headWord) const
{
std::map<Moses::Word, HypothesisCollection>::const_iterator iter;
iter = m_hypoColl.find(headWord);
return (iter != m_hypoColl.end());
}
void ChartCell::CleanupArcList()
{
// only necessary if n-best calculations are enabled
if (!m_nBestIsEnabled) return;
std::map<Moses::Word, HypothesisCollection>::iterator iter;
for (iter = m_hypoColl.begin(); iter != m_hypoColl.end(); ++iter)
{
HypothesisCollection &coll = iter->second;
coll.CleanupArcList();
}
}
void ChartCell::OutputSizes(std::ostream &out) const
{
std::map<Moses::Word, HypothesisCollection>::const_iterator iter;
for (iter = m_hypoColl.begin(); iter != m_hypoColl.end(); ++iter)
{
const Moses::Word &targetLHS = iter->first;
const HypothesisCollection &coll = iter->second;
out << targetLHS << "=" << coll.GetSize() << " ";
}
}
size_t ChartCell::GetSize() const
{
size_t ret = 0;
std::map<Moses::Word, HypothesisCollection>::const_iterator iter;
for (iter = m_hypoColl.begin(); iter != m_hypoColl.end(); ++iter)
{
const HypothesisCollection &coll = iter->second;
ret += coll.GetSize();
}
return ret;
}
void ChartCell::GetSearchGraph(long translationId, std::ostream &outputSearchGraphStream) const
{
std::map<Moses::Word, HypothesisCollection>::const_iterator iterOutside;
for (iterOutside = m_hypoColl.begin(); iterOutside != m_hypoColl.end(); ++iterOutside)
{
const HypothesisCollection &coll = iterOutside->second;
coll.GetSearchGraph(translationId, outputSearchGraphStream);
}
}
std::ostream& operator<<(std::ostream &out, const ChartCell &cell)
{
std::map<Moses::Word, HypothesisCollection>::const_iterator iterOutside;
for (iterOutside = cell.m_hypoColl.begin(); iterOutside != cell.m_hypoColl.end(); ++iterOutside)
{
const Moses::Word &targetLHS = iterOutside->first;
cerr << targetLHS << ":" << endl;
const HypothesisCollection &coll = iterOutside->second;
cerr << coll;
}
/*
ChartCell::HCType::const_iterator iter;
for (iter = cell.m_hypos.begin(); iter != cell.m_hypos.end(); ++iter)
{
const Hypothesis &hypo = **iter;
out << hypo << endl;
}
*/
return out;
}
} // namespace

View File

@ -0,0 +1,71 @@
#pragma once
#include <iostream>
#include <queue>
#include <map>
#include <vector>
#include "../../moses/src/Word.h"
#include "../../moses/src/WordsRange.h"
#include "ChartHypothesis.h"
#include "ChartHypothesisCollection.h"
#include "QueueEntry.h"
namespace MosesChart
{
class TranslationOptionCollection;
class TranslationOptionList;
class TranslationOption;
class ChartCellCollection;
class Manager;
class ChartCell
{
friend std::ostream& operator<<(std::ostream&, const ChartCell&);
public:
protected:
std::map<Moses::Word, HypothesisCollection> m_hypoColl;
std::vector<Moses::Word> m_headWords;
Moses::WordsRange m_coverage;
bool m_nBestIsEnabled; /**< flag to determine whether to keep track of old arcs */
Manager &m_manager;
public:
ChartCell(size_t startPos, size_t endPos, Manager &manager);
void ProcessSentence(const TranslationOptionList &transOptList
,const ChartCellCollection &allChartCells);
const HypoList &GetSortedHypotheses(const Moses::Word &headWord) const;
bool AddHypothesis(Hypothesis *hypo);
void SortHypotheses();
void PruneToSize();
const Hypothesis *GetBestHypothesis() const;
bool HeadwordExists(const Moses::Word &headWord) const;
const std::vector<Moses::Word> &GetHeadwords() const
{ return m_headWords; }
void CleanupArcList();
void OutputSizes(std::ostream &out) const;
size_t GetSize() const;
//! transitive comparison used for adding objects into set
inline bool operator<(const ChartCell &compare) const
{
return m_coverage < compare.m_coverage;
}
void GetSearchGraph(long translationId, std::ostream &outputSearchGraphStream) const;
};
}

View File

@ -0,0 +1,38 @@
#include "ChartCellCollection.h"
#include "../../moses/src/InputType.h"
#include "../../moses/src/WordsRange.h"
namespace MosesChart
{
ChartCellCollection::ChartCellCollection(const Moses::InputType &input, Manager &manager)
:m_hypoStackColl(input.GetSize())
{
size_t size = input.GetSize();
for (size_t startPos = 0; startPos < size; ++startPos)
{
InnerCollType &inner = m_hypoStackColl[startPos];
inner.resize(size - startPos);
size_t ind = 0;
for (size_t endPos = startPos ; endPos < size; ++endPos)
{
ChartCell *cell = new ChartCell(startPos, endPos, manager);
inner[ind] = cell;
++ind;
}
}
}
ChartCellCollection::~ChartCellCollection()
{
OuterCollType::iterator iter;
for (iter = m_hypoStackColl.begin(); iter != m_hypoStackColl.end(); ++iter)
{
InnerCollType &inner = *iter;
Moses::RemoveAllInColl(inner);
}
}
} // namespace

View File

@ -0,0 +1,46 @@
#pragma once
#include "ChartCell.h"
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/CellCollection.h"
namespace Moses
{
class InputType;
}
namespace MosesChart
{
class Manager;
class ChartCellCollection : public Moses::CellCollection
{
public:
typedef std::vector<ChartCell*> InnerCollType;
typedef std::vector<InnerCollType> OuterCollType;
protected:
OuterCollType m_hypoStackColl;
public:
ChartCellCollection(const Moses::InputType &input, Manager &manager);
~ChartCellCollection();
ChartCell &Get(const Moses::WordsRange &coverage)
{
return *m_hypoStackColl[coverage.GetStartPos()][coverage.GetEndPos() - coverage.GetStartPos()];
}
const ChartCell &Get(const Moses::WordsRange &coverage) const
{
return *m_hypoStackColl[coverage.GetStartPos()][coverage.GetEndPos() - coverage.GetStartPos()];
}
const std::vector<Moses::Word> &GetHeadwords(const Moses::WordsRange &coverage) const
{
const ChartCell &cell = Get(coverage);
return cell.GetHeadwords();
}
};
}

View File

@ -0,0 +1,417 @@
#include <algorithm>
#include <vector>
#include "ChartHypothesis.h"
#include "QueueEntry.h"
#include "ChartCell.h"
#include "ChartTranslationOption.h"
#include "ChartManager.h"
#include "../../moses/src/TargetPhrase.h"
#include "../../moses/src/Phrase.h"
#include "../../moses/src/StaticData.h"
#include "../../moses/src/DummyScoreProducers.h"
#include "../../moses/src/LMList.h"
#include "../../moses/src/ChartRule.h"
using namespace std;
using namespace Moses;
namespace MosesChart
{
unsigned int Hypothesis::s_HypothesesCreated = 0;
#ifdef USE_HYPO_POOL
ObjectPool<Hypothesis> Hypothesis::s_objectPool("Hypothesis", 300000);
#endif
Hypothesis::Hypothesis(const QueueEntry &queueEntry, Manager &manager)
:m_targetPhrase(queueEntry.GetTranslationOption().GetChartRule().GetTargetPhrase())
,m_wordsConsumedTargetOrder(queueEntry.GetTranslationOption().GetChartRule().GetWordsConsumedTargetOrder())
,m_id(++s_HypothesesCreated)
,m_currSourceWordsRange(queueEntry.GetTranslationOption().GetSourceWordsRange())
,m_contextPrefix(Output, StaticData::Instance().GetAllLM().GetMaxNGramOrder())
,m_contextSuffix(Output, StaticData::Instance().GetAllLM().GetMaxNGramOrder())
,m_arcList(NULL)
,m_manager(manager)
{
assert(m_targetPhrase.GetSize() == m_wordsConsumedTargetOrder.size());
//TRACE_ERR(m_targetPhrase << endl);
m_numTargetTerminals = m_targetPhrase.GetNumTerminals();
const std::vector<ChildEntry> &childEntries = queueEntry.GetChildEntries();
assert(m_prevHypos.empty());
m_prevHypos.reserve(childEntries.size());
vector<ChildEntry>::const_iterator iter;
for (iter = childEntries.begin(); iter != childEntries.end(); ++iter)
{
const ChildEntry &childEntry = *iter;
const Hypothesis *prevHypo = childEntry.GetHypothesis();
m_numTargetTerminals += prevHypo->GetNumTargetTerminals();
m_prevHypos.push_back(prevHypo);
}
size_t maxNGram = StaticData::Instance().GetAllLM().GetMaxNGramOrder();
CalcPrefix(m_contextPrefix, maxNGram - 1);
CalcSuffix(m_contextSuffix, maxNGram - 1);
}
Hypothesis::~Hypothesis()
{
if (m_arcList)
{
ArcList::iterator iter;
for (iter = m_arcList->begin() ; iter != m_arcList->end() ; ++iter)
{
Hypothesis *hypo = *iter;
Delete(hypo);
}
m_arcList->clear();
delete m_arcList;
}
}
void Hypothesis::CreateOutputPhrase(Phrase &outPhrase) const
{
for (size_t pos = 0; pos < m_targetPhrase.GetSize(); ++pos)
{
const Word &word = m_targetPhrase.GetWord(pos);
if (word.IsNonTerminal())
{ // non-term. fill out with prev hypo
size_t nonTermInd = m_wordsConsumedTargetOrder[pos];
const Hypothesis *prevHypo = m_prevHypos[nonTermInd];
prevHypo->CreateOutputPhrase(outPhrase);
}
else
{
outPhrase.AddWord(word);
}
}
}
Phrase Hypothesis::GetOutputPhrase() const
{
Phrase outPhrase(Output);
CreateOutputPhrase(outPhrase);
return outPhrase;
}
size_t Hypothesis::CalcPrefix(Phrase &ret, size_t size) const
{
for (size_t pos = 0; pos < m_targetPhrase.GetSize(); ++pos)
{
const Word &word = m_targetPhrase.GetWord(pos);
if (word.IsNonTerminal())
{
size_t nonTermInd = m_wordsConsumedTargetOrder[pos];
const Hypothesis *prevHypo = m_prevHypos[nonTermInd];
size = prevHypo->CalcPrefix(ret, size);
}
else
{
ret.AddWord(m_targetPhrase.GetWord(pos));
size--;
}
if (size==0)
break;
}
return size;
}
size_t Hypothesis::CalcSuffix(Phrase &ret, size_t size) const
{
assert(m_contextPrefix.GetSize() <= m_numTargetTerminals);
if (m_contextPrefix.GetSize() == m_numTargetTerminals)
{ // small hypo. the prefix will contains the whole hypo
size_t maxCount = min(m_contextPrefix.GetSize(), size)
, pos = m_contextPrefix.GetSize() - 1;
for (size_t ind = 0; ind < maxCount; ++ind)
{
const Word &word = m_contextPrefix.GetWord(pos);
ret.PrependWord(word);
--pos;
}
size -= maxCount;
return size;
}
else
{
for (int pos = (int) m_targetPhrase.GetSize() - 1; pos >= 0 ; --pos)
{
const Word &word = m_targetPhrase.GetWord(pos);
if (word.IsNonTerminal())
{
size_t nonTermInd = m_wordsConsumedTargetOrder[pos];
const Hypothesis *prevHypo = m_prevHypos[nonTermInd];
size = prevHypo->CalcSuffix(ret, size);
}
else
{
ret.PrependWord(m_targetPhrase.GetWord(pos));
size--;
}
if (size==0)
break;
}
return size;
}
}
int Hypothesis::LMContextCompare(const Hypothesis &other) const
{
// prefix
if (m_currSourceWordsRange.GetStartPos() > 0)
{
int ret = GetPrefix().Compare(other.GetPrefix());
if (ret != 0)
return ret;
}
// suffix
size_t inputSize = m_manager.GetSource().GetSize();
if (m_currSourceWordsRange.GetEndPos() < inputSize - 1)
{
int ret = GetSuffix().Compare(other.GetSuffix());
if (ret != 0)
return ret;
}
// they're the same
return 0;
}
void Hypothesis::CalcScore()
{
// total scores from prev hypos
std::vector<const Hypothesis*>::iterator iter;
for (iter = m_prevHypos.begin(); iter != m_prevHypos.end(); ++iter)
{
const Hypothesis &prevHypo = **iter;
const ScoreComponentCollection &scoreBreakdown = prevHypo.GetScoreBreakDown();
m_scoreBreakdown.PlusEquals(scoreBreakdown);
}
// translation models & word penalty
const ScoreComponentCollection &scoreBreakdown = m_targetPhrase.GetScoreBreakdown();
m_scoreBreakdown.PlusEquals(scoreBreakdown);
CalcLMScore();
m_totalScore = m_scoreBreakdown.GetWeightedScore();
}
void Hypothesis::CalcLMScore()
{
assert(m_lmNGram.GetWeightedScore() == 0);
m_scoreBreakdown.ZeroAllLM();
const LMList &lmList = StaticData::Instance().GetAllLM();
Phrase outPhrase(Output); // = GetOutputPhrase();
bool calcNow = false, firstPhrase = true;
for (size_t targetPhrasePos = 0; targetPhrasePos < m_targetPhrase.GetSize(); ++targetPhrasePos)
{
const Word &targetWord = m_targetPhrase.GetWord(targetPhrasePos);
if (!targetWord.IsNonTerminal())
{ // just a word, add to phrase for lm scoring
outPhrase.AddWord(targetWord);
}
else
{
size_t nonTermInd = m_wordsConsumedTargetOrder[targetPhrasePos];
const Hypothesis *prevHypo = m_prevHypos[nonTermInd];
size_t numTargetTerminals = prevHypo->GetNumTargetTerminals();
if (numTargetTerminals >= lmList.GetMaxNGramOrder() - 1)
{ // large hypo (for trigram lm, another hypo equal or over 2 words). just take the prefix & suffix
m_lmNGram.PlusEqualsAllLM(prevHypo->m_lmNGram);
// calc & add overlapping lm scores
// prefix
outPhrase.Append(prevHypo->GetPrefix());
calcNow = true;
}
else
{ // small hypo (for trigram lm, 1-word hypos).
// add target phrase to temp phrase and continue, but don't score yet
outPhrase.Append(prevHypo->GetPrefix());
}
if (calcNow)
{
if (targetPhrasePos == 0 && numTargetTerminals >= lmList.GetMaxNGramOrder() - 1)
{ // get from other prev hypo. faster
m_lmPrefix.Assign(prevHypo->m_lmPrefix);
m_lmNGram.Assign(prevHypo->m_lmNGram);
}
else
{ // calc
lmList.CalcAllLMScores(outPhrase
, m_lmNGram
, (firstPhrase) ? &m_lmPrefix : NULL);
}
// create new phrase from suffix. score later when appended with next words
outPhrase.Clear();
outPhrase.Append(prevHypo->GetSuffix());
firstPhrase = false;
calcNow = false;
}
} // if (!targetWord.IsNonTerminal())
} // for (size_t targetPhrasePos
lmList.CalcAllLMScores(outPhrase
, m_lmNGram
, (firstPhrase) ? &m_lmPrefix : NULL);
m_scoreBreakdown.PlusEqualsAllLM(m_lmPrefix);
m_scoreBreakdown.PlusEqualsAllLM(m_lmNGram);
/*
// lazy way. keep for comparison
Phrase outPhrase = GetOutputPhrase();
// cerr << outPhrase << " ";
float retFullScore, retNGramScore;
StaticData::Instance().GetAllLM().CalcScore(outPhrase
, retFullScore
, retNGramScore
, m_scoreBreakdown
, &m_lmNGram
, false);
*/
}
void Hypothesis::AddArc(Hypothesis *loserHypo)
{
if (!m_arcList) {
if (loserHypo->m_arcList) // we don't have an arcList, but loser does
{
this->m_arcList = loserHypo->m_arcList; // take ownership, we'll delete
loserHypo->m_arcList = 0; // prevent a double deletion
}
else
{ this->m_arcList = new ArcList(); }
} else {
if (loserHypo->m_arcList) { // both have an arc list: merge. delete loser
size_t my_size = m_arcList->size();
size_t add_size = loserHypo->m_arcList->size();
this->m_arcList->resize(my_size + add_size, 0);
std::memcpy(&(*m_arcList)[0] + my_size, &(*loserHypo->m_arcList)[0], add_size * sizeof(Hypothesis *));
delete loserHypo->m_arcList;
loserHypo->m_arcList = 0;
} else { // loserHypo doesn't have any arcs
// DO NOTHING
}
}
m_arcList->push_back(loserHypo);
}
// sorting helper
struct CompareChartHypothesisTotalScore
{
bool operator()(const Hypothesis* hypo1, const Hypothesis* hypo2) const
{
return hypo1->GetTotalScore() > hypo2->GetTotalScore();
}
};
void Hypothesis::CleanupArcList()
{
// point this hypo's main hypo to itself
m_winningHypo = this;
if (!m_arcList) return;
/* keep only number of arcs we need to create all n-best paths.
* However, may not be enough if only unique candidates are needed,
* so we'll keep all of arc list if nedd distinct n-best list
*/
const StaticData &staticData = StaticData::Instance();
size_t nBestSize = staticData.GetNBestSize();
bool distinctNBest = staticData.GetDistinctNBest() || staticData.UseMBR() || staticData.GetOutputSearchGraph();
if (!distinctNBest && m_arcList->size() > nBestSize)
{ // prune arc list only if there too many arcs
nth_element(m_arcList->begin()
, m_arcList->begin() + nBestSize - 1
, m_arcList->end()
, CompareChartHypothesisTotalScore());
// delete bad ones
ArcList::iterator iter;
for (iter = m_arcList->begin() + nBestSize ; iter != m_arcList->end() ; ++iter)
{
Hypothesis *arc = *iter;
Hypothesis::Delete(arc);
}
m_arcList->erase(m_arcList->begin() + nBestSize
, m_arcList->end());
}
// set all arc's main hypo variable to this hypo
ArcList::iterator iter = m_arcList->begin();
for (; iter != m_arcList->end() ; ++iter)
{
Hypothesis *arc = *iter;
arc->SetWinningHypo(this);
}
//cerr << m_arcList->size() << " ";
}
void Hypothesis::SetWinningHypo(const Hypothesis *hypo)
{
m_winningHypo = hypo;
// never gonna use to recombine. clear prefix & suffix phrases to save mem
m_contextPrefix.Clear();
m_contextSuffix.Clear();
}
TO_STRING_BODY(Hypothesis)
// friend
ostream& operator<<(ostream& out, const Hypothesis& hypo)
{
//Phrase outPhrase(Output);
//hypo.CreateOutputPhrase(outPhrase);
// words bitmap
out << " " << hypo.GetId()
<< " " << hypo.m_targetPhrase
//<< " " << outPhrase
<< " " << hypo.GetCurrSourceRange()
//<< " " << hypo.m_currSourceWordsRange
<< " " << hypo.GetTotalScore()
<< " " << hypo.GetScoreBreakDown();
HypoList::const_iterator iter;
for (iter = hypo.GetPrevHypos().begin(); iter != hypo.GetPrevHypos().end(); ++iter)
{
const Hypothesis &prevHypo = **iter;
out << " " << prevHypo.GetId();
}
//out << endl;
return out;
}
}

View File

@ -0,0 +1,139 @@
#pragma once
#include <vector>
#include "../../moses/src/Util.h"
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/ScoreComponentCollection.h"
#include "../../moses/src/Phrase.h"
#include "../../moses/src/TargetPhrase.h"
#include "../../moses/src/ObjectPool.h"
namespace MosesChart
{
class QueueEntry;
class Hypothesis;
class Manager;
typedef std::vector<Hypothesis*> ArcList;
class Hypothesis
{
friend std::ostream& operator<<(std::ostream&, const Hypothesis&);
protected:
#ifdef USE_HYPO_POOL
static ObjectPool<Hypothesis> s_objectPool;
#endif
static unsigned int s_HypothesesCreated;
int m_id; /**< numeric ID of this hypothesis, used for logging */
const Moses::TargetPhrase &m_targetPhrase; /**< target phrase being created at the current decoding step */
Moses::Phrase m_contextPrefix, m_contextSuffix;
const std::vector<size_t> &m_wordsConsumedTargetOrder; // same size as target phrase ?
Moses::WordsRange m_currSourceWordsRange;
Moses::ScoreComponentCollection m_scoreBreakdown /*! detailed score break-down by components (for instance language model, word penalty, etc) */
,m_lmNGram
,m_lmPrefix;
float m_totalScore;
size_t m_numTargetTerminals;
ArcList *m_arcList; /*! all arcs that end at the same trellis point as this hypothesis */
const Hypothesis *m_winningHypo;
std::vector<const Hypothesis*> m_prevHypos;
Manager& m_manager;
size_t CalcPrefix(Moses::Phrase &ret, size_t size) const;
size_t CalcSuffix(Moses::Phrase &ret, size_t size) const;
void CalcLMScore();
Hypothesis(); // not implemented
Hypothesis(const Hypothesis &copy); // not implemented
public:
static void ResetHypoCount()
{ s_HypothesesCreated = 0; }
static unsigned int GetHypoCount()
{ return s_HypothesesCreated; }
#ifdef USE_HYPO_POOL
void *operator new(size_t num_bytes)
{
void *ptr = s_objectPool.getPtr();
return ptr;
}
static void Delete(Hypothesis *hypo)
{
s_objectPool.freeObject(hypo);
}
#else
static void Delete(Hypothesis *hypo)
{
delete hypo;
}
#endif
explicit Hypothesis(const QueueEntry &queueEntry, Manager &manager);
~Hypothesis();
int GetId()const
{ return m_id;}
const Moses::TargetPhrase &GetCurrTargetPhrase()const
{ return m_targetPhrase; }
const Moses::WordsRange &GetCurrSourceRange()const
{ return m_currSourceWordsRange; }
inline const ArcList* GetArcList() const
{
return m_arcList;
}
void CreateOutputPhrase(Moses::Phrase &outPhrase) const;
Moses::Phrase GetOutputPhrase() const;
int LMContextCompare(const Hypothesis &other) const;
const Moses::Phrase &GetPrefix() const
{ return m_contextPrefix; }
const Moses::Phrase &GetSuffix() const
{ return m_contextSuffix; }
void CalcScore();
void AddArc(Hypothesis *loserHypo);
void CleanupArcList();
void SetWinningHypo(const Hypothesis *hypo);
const Moses::ScoreComponentCollection &GetScoreBreakDown() const
{ return m_scoreBreakdown; }
float GetTotalScore() const
{ return m_totalScore; }
const std::vector<const Hypothesis*> &GetPrevHypos() const
{ return m_prevHypos; }
size_t GetWordsConsumedTargetOrder(size_t pos) const
{
assert(pos < m_wordsConsumedTargetOrder.size());
return m_wordsConsumedTargetOrder[pos];
}
const Moses::Word &GetTargetLHS() const
{ return m_targetPhrase.GetTargetLHS(); }
size_t GetNumTargetTerminals() const
{
return m_numTargetTerminals;
}
TO_STRING();
}; // class Hypothesis
}

View File

@ -0,0 +1,295 @@
/*
* ChartHypothesisCollection.cpp
* moses-chart
*
* Created by Hieu Hoang on 31/08/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <algorithm>
#include "../../moses/src/StaticData.h"
#include "ChartHypothesisCollection.h"
#include "ChartHypothesis.h"
#include "ChartManager.h"
using namespace std;
using namespace Moses;
namespace MosesChart
{
HypothesisCollection::HypothesisCollection()
{
const StaticData &staticData = StaticData::Instance();
m_beamWidth = staticData.GetBeamWidth();
m_maxHypoStackSize = staticData.GetMaxHypoStackSize();
m_nBestIsEnabled = staticData.IsNBestEnabled();
m_bestScore = -std::numeric_limits<float>::infinity();
}
HypothesisCollection::~HypothesisCollection()
{
HCType::iterator iter;
for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter)
{
Hypothesis *hypo = *iter;
Hypothesis::Delete(hypo);
}
//Moses::RemoveAllInColl(m_hypos);
}
bool HypothesisCollection::AddHypothesis(Hypothesis *hypo, Manager &manager)
{
if (hypo->GetTotalScore() < m_bestScore + m_beamWidth)
{ // really bad score. don't bother adding hypo into collection
manager.GetSentenceStats().AddDiscarded();
VERBOSE(3,"discarded, too bad for stack" << std::endl);
Hypothesis::Delete(hypo);
return false;
}
// over threshold, try to add to collection
std::pair<HCType::iterator, bool> addRet = Add(hypo, manager);
if (addRet.second)
{ // nothing found. add to collection
return true;
}
// equiv hypo exists, recombine with other hypo
HCType::iterator &iterExisting = addRet.first;
Hypothesis *hypoExisting = *iterExisting;
assert(iterExisting != m_hypos.end());
//StaticData::Instance().GetSentenceStats().AddRecombination(*hypo, **iterExisting);
// found existing hypo with same target ending.
// keep the best 1
if (hypo->GetTotalScore() > hypoExisting->GetTotalScore())
{ // incoming hypo is better than the one we have
VERBOSE(3,"better than matching hyp " << hypoExisting->GetId() << ", recombining, ");
if (m_nBestIsEnabled) {
hypo->AddArc(hypoExisting);
Detach(iterExisting);
} else {
Remove(iterExisting);
}
bool added = Add(hypo, manager).second;
if (!added)
{
iterExisting = m_hypos.find(hypo);
TRACE_ERR("Offending hypo = " << **iterExisting << endl);
abort();
}
return false;
}
else
{ // already storing the best hypo. discard current hypo
VERBOSE(3,"worse than matching hyp " << hypoExisting->GetId() << ", recombining" << std::endl)
if (m_nBestIsEnabled) {
hypoExisting->AddArc(hypo);
} else {
Hypothesis::Delete(hypo);
}
return false;
}
}
pair<HypothesisCollection::HCType::iterator, bool> HypothesisCollection::Add(Hypothesis *hypo, Manager &manager)
{
std::pair<HCType::iterator, bool> ret = m_hypos.insert(hypo);
if (ret.second)
{ // equiv hypo doesn't exists
VERBOSE(3,"added hyp to stack");
// Update best score, if this hypothesis is new best
if (hypo->GetTotalScore() > m_bestScore)
{
VERBOSE(3,", best on stack");
m_bestScore = hypo->GetTotalScore();
}
// Prune only if stack is twice as big as needed (lazy pruning)
VERBOSE(3,", now size " << m_hypos.size());
if (m_hypos.size() > 2*m_maxHypoStackSize-1)
{
PruneToSize(manager);
}
else {
VERBOSE(3,std::endl);
}
}
return ret;
}
/** Remove hypothesis pointed to by iterator but don't delete the object. */
void HypothesisCollection::Detach(const HCType::iterator &iter)
{
m_hypos.erase(iter);
}
void HypothesisCollection::Remove(const HCType::iterator &iter)
{
Hypothesis *h = *iter;
/*
stringstream strme("");
strme << h->GetOutputPhrase();
string toFind = "the goal of gene scientists is ";
size_t pos = toFind.find(strme.str());
if (pos == 0)
{
cerr << pos << " " << strme.str() << *h << endl;
cerr << *this << endl;
}
*/
Detach(iter);
Hypothesis::Delete(h);
}
void HypothesisCollection::PruneToSize(Manager &manager)
{
if (GetSize() > m_maxHypoStackSize) // ok, if not over the limit
{
priority_queue<float> bestScores;
// push all scores to a heap
// (but never push scores below m_bestScore+m_beamWidth)
HCType::iterator iter = m_hypos.begin();
float score = 0;
while (iter != m_hypos.end())
{
Hypothesis *hypo = *iter;
score = hypo->GetTotalScore();
if (score > m_bestScore+m_beamWidth)
{
bestScores.push(score);
}
++iter;
}
// pop the top newSize scores (and ignore them, these are the scores of hyps that will remain)
// ensure to never pop beyond heap size
size_t minNewSizeHeapSize = m_maxHypoStackSize > bestScores.size() ? bestScores.size() : m_maxHypoStackSize;
for (size_t i = 1 ; i < minNewSizeHeapSize ; i++)
bestScores.pop();
// and remember the threshold
float scoreThreshold = bestScores.top();
// delete all hypos under score threshold
iter = m_hypos.begin();
while (iter != m_hypos.end())
{
Hypothesis *hypo = *iter;
float score = hypo->GetTotalScore();
if (score < scoreThreshold)
{
HCType::iterator iterRemove = iter++;
Remove(iterRemove);
manager.GetSentenceStats().AddPruning();
}
else
{
++iter;
}
}
VERBOSE(3,", pruned to size " << m_hypos.size() << endl);
IFVERBOSE(3)
{
TRACE_ERR("stack now contains: ");
for(iter = m_hypos.begin(); iter != m_hypos.end(); iter++)
{
Hypothesis *hypo = *iter;
TRACE_ERR( hypo->GetId() << " (" << hypo->GetTotalScore() << ") ");
}
TRACE_ERR( endl);
}
// desperation pruning
if (m_hypos.size() > m_maxHypoStackSize * 2)
{
std::vector<Hypothesis*> hyposOrdered;
// sort hypos
std::copy(m_hypos.begin(), m_hypos.end(), std::inserter(hyposOrdered, hyposOrdered.end()));
std::sort(hyposOrdered.begin(), hyposOrdered.end(), ChartHypothesisScoreOrderer());
//keep only |size|. delete the rest
std::vector<Hypothesis*>::iterator iter;
for (iter = hyposOrdered.begin() + (m_maxHypoStackSize * 2); iter != hyposOrdered.end(); ++iter)
{
Hypothesis *hypo = *iter;
HCType::iterator iterFindHypo = m_hypos.find(hypo);
assert(iterFindHypo != m_hypos.end());
Remove(iterFindHypo);
}
}
}
}
void HypothesisCollection::SortHypotheses()
{
assert(m_hyposOrdered.empty());
if (!m_hypos.empty())
{
// done everything for this cell.
// sort
// put into vec
m_hyposOrdered.reserve(m_hypos.size());
std::copy(m_hypos.begin(), m_hypos.end(), back_inserter(m_hyposOrdered));
std::sort(m_hyposOrdered.begin(), m_hyposOrdered.end(), ChartHypothesisScoreOrderer());
}
}
void HypothesisCollection::CleanupArcList()
{
HCType::iterator iter;
for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter)
{
Hypothesis *mainHypo = *iter;
mainHypo->CleanupArcList();
}
}
void HypothesisCollection::GetSearchGraph(long translationId, std::ostream &outputSearchGraphStream) const
{
HCType::const_iterator iter;
for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter)
{
Hypothesis &mainHypo = **iter;
outputSearchGraphStream << translationId << " " << mainHypo << endl;
const ArcList *arcList = mainHypo.GetArcList();
if (arcList)
{
ArcList::const_iterator iterArc;
for (iterArc = arcList->begin(); iterArc != arcList->end(); ++iterArc)
{
const Hypothesis &arc = **iterArc;
outputSearchGraphStream << translationId << " " << arc << endl;
}
}
}
}
std::ostream& operator<<(std::ostream &out, const HypothesisCollection &coll)
{
HypoList::const_iterator iterInside;
for (iterInside = coll.m_hyposOrdered.begin(); iterInside != coll.m_hyposOrdered.end(); ++iterInside)
{
const Hypothesis &hypo = **iterInside;
out << hypo << endl;
}
return out;
}
} // namespace

View File

@ -0,0 +1,119 @@
#pragma once
/*
* ChartHypothesisCollection.h
* moses-chart
*
* Created by Hieu Hoang on 31/08/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <set>
#include "ChartHypothesis.h"
#include "QueueEntry.h"
namespace MosesChart
{
// order by descending score
class ChartHypothesisScoreOrderer
{
public:
bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const
{
return hypoA->GetTotalScore() > hypoB->GetTotalScore();
}
};
class HypothesisRecombinationOrderer
{
public:
bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const
{
// assert in same cell
const Moses::WordsRange &rangeA = hypoA->GetCurrSourceRange()
, &rangeB = hypoB->GetCurrSourceRange();
assert(rangeA == rangeB);
/*
int ret = Moses::Word::Compare(hypoA->GetTargetLHS(), hypoB->GetTargetLHS());
if (ret != 0)
return (ret < 0);
*/
// shouldn't be mixing hypos with different lhs
assert(hypoA->GetTargetLHS() == hypoB->GetTargetLHS());
int ret = hypoA->LMContextCompare(*hypoB);
if (ret != 0)
return (ret < 0);
return false;
}
};
// order by descending score
class HypothesisScoreOrderer
{
public:
bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const
{
return hypoA->GetTotalScore() > hypoB->GetTotalScore();
}
};
// 1 of these for each target LHS in each cell
class HypothesisCollection
{
friend std::ostream& operator<<(std::ostream&, const HypothesisCollection&);
protected:
typedef std::set<Hypothesis*, HypothesisRecombinationOrderer> HCType;
HCType m_hypos;
HypoList m_hyposOrdered;
float m_bestScore; /**< score of the best hypothesis in collection */
float m_beamWidth; /**< minimum score due to threashold pruning */
size_t m_maxHypoStackSize; /**< maximum number of hypothesis allowed in this stack */
bool m_nBestIsEnabled; /**< flag to determine whether to keep track of old arcs */
/** add hypothesis to stack. Prune if necessary.
* Returns false if equiv hypo exists in collection, otherwise returns true
*/
std::pair<HCType::iterator, bool> Add(Hypothesis *hypo, Manager &manager);
public:
typedef HCType::iterator iterator;
typedef HCType::const_iterator const_iterator;
//! iterators
const_iterator begin() const { return m_hypos.begin(); }
const_iterator end() const { return m_hypos.end(); }
HypothesisCollection();
~HypothesisCollection();
bool AddHypothesis(Hypothesis *hypo, Manager &manager);
//! remove hypothesis pointed to by iterator but don't delete the object
void Detach(const HCType::iterator &iter);
/** destroy Hypothesis pointed to by iterator (object pool version) */
void Remove(const HCType::iterator &iter);
void PruneToSize(Manager &manager);
size_t GetSize() const
{ return m_hypos.size(); }
size_t GetHypo() const
{ return m_hypos.size(); }
void SortHypotheses();
void CleanupArcList();
const HypoList &GetSortedHypotheses() const
{ return m_hyposOrdered; }
void GetSearchGraph(long translationId, std::ostream &outputSearchGraphStream) const;
};
} // namespace

View File

@ -0,0 +1,195 @@
#include <stdio.h>
#include "ChartManager.h"
#include "ChartCell.h"
#include "ChartHypothesis.h"
#include "ChartTrellisPath.h"
#include "ChartTrellisPathList.h"
#include "ChartTrellisPathCollection.h"
#include "../../moses/src/StaticData.h"
using namespace std;
using namespace Moses;
namespace Moses
{
extern bool g_debug;
}
namespace MosesChart
{
Manager::Manager(InputType const& source)
:m_source(source)
,m_hypoStackColl(source, *this)
,m_transOptColl(source, StaticData::Instance().GetDecodeStepVL(source), m_hypoStackColl)
{
const StaticData &staticData = StaticData::Instance();
staticData.InitializeBeforeSentenceProcessing(source);
}
Manager::~Manager()
{
StaticData::Instance().CleanUpAfterSentenceProcessing();
}
void Manager::ProcessSentence()
{
VERBOSE(1,"Translating: " << m_source << endl);
ResetSentenceStats(m_source);
VERBOSE(2,"Decoding: " << endl);
//Hypothesis::ResetHypoCount();
// MAIN LOOP
size_t size = m_source.GetSize();
for (size_t width = 1; width <= size; ++width)
{
for (size_t startPos = 0; startPos <= size-width; ++startPos)
{
size_t endPos = startPos + width - 1;
WordsRange range(startPos, endPos);
TRACE_ERR(" " << range << "=");
// create trans opt
m_transOptColl.CreateTranslationOptionsForRange(startPos, endPos);
//if (g_debug)
// cerr << m_transOptColl.GetTranslationOptionList(WordsRange(startPos, endPos));
// decode
ChartCell &cell = m_hypoStackColl.Get(range);
cell.ProcessSentence(m_transOptColl.GetTranslationOptionList(range)
,m_hypoStackColl);
cell.PruneToSize();
cell.CleanupArcList();
cell.SortHypotheses();
cerr << cell.GetSize();
//cerr << cell << endl;
//cell.OutputSizes(cerr);
}
}
IFVERBOSE(1) {
cerr << "Num of hypo = " << Hypothesis::GetHypoCount() << " --- cells:" << endl;
for (size_t startPos = 0; startPos < size; ++startPos)
{
cerr.width(3);
cerr << startPos << " ";
}
cerr << endl;
for (size_t width = 1; width <= size; width++)
{
for( size_t space = 0; space < width-1; space++ )
{
cerr << " ";
}
for (size_t startPos = 0; startPos <= size-width; ++startPos)
{
WordsRange range(startPos, startPos+width-1);
cerr.width(3);
cerr << m_hypoStackColl.Get(range).GetSize() << " ";
}
cerr << endl;
}
}
}
const Hypothesis *Manager::GetBestHypothesis() const
{
size_t size = m_source.GetSize();
if (size == 0) // empty source
return NULL;
else
{
WordsRange range(0, size-1);
const ChartCell &lastCell = m_hypoStackColl.Get(range);
return lastCell.GetBestHypothesis();
}
}
void Manager::CalcNBest(size_t count, TrellisPathList &ret,bool onlyDistinct) const
{
size_t size = m_source.GetSize();
if (count == 0 || size == 0)
return;
TrellisPathCollection contenders;
set<Phrase> distinctHyps;
// add all pure paths
WordsRange range(0, size-1);
const ChartCell &lastCell = m_hypoStackColl.Get(range);
const Hypothesis *hypo = lastCell.GetBestHypothesis();
if (hypo == NULL)
{ // no hypothesis
return;
}
MosesChart::TrellisPath *purePath = new TrellisPath(hypo);
contenders.Add(purePath);
// factor defines stopping point for distinct n-best list if too many candidates identical
size_t nBestFactor = StaticData::Instance().GetNBestFactor();
if (nBestFactor < 1) nBestFactor = 1000; // 0 = unlimited
// MAIN loop
for (size_t iteration = 0 ; (onlyDistinct ? distinctHyps.size() : ret.GetSize()) < count && contenders.GetSize() > 0 && (iteration < count * nBestFactor) ; iteration++)
{
// get next best from list of contenders
TrellisPath *path = contenders.pop();
assert(path);
// create deviations from current best
path->CreateDeviantPaths(contenders);
if(onlyDistinct)
{
Phrase tgtPhrase = path->GetOutputPhrase();
if (distinctHyps.insert(tgtPhrase).second)
ret.Add(path);
else
delete path;
const size_t nBestFactor = StaticData::Instance().GetNBestFactor();
if (nBestFactor > 0)
contenders.Prune(count * nBestFactor);
}
else
{
ret.Add(path);
contenders.Prune(count);
}
}
}
void Manager::CalcDecoderStatistics() const
{
}
void Manager::GetSearchGraph(long translationId, std::ostream &outputSearchGraphStream) const
{
size_t size = m_source.GetSize();
for (size_t width = 1; width <= size; ++width)
{
for (size_t startPos = 0; startPos <= size-width; ++startPos)
{
size_t endPos = startPos + width - 1;
WordsRange range(startPos, endPos);
TRACE_ERR(" " << range << "=");
const ChartCell &cell = m_hypoStackColl.Get(range);
cell.GetSearchGraph(translationId, outputSearchGraphStream);
}
}
}
} // namespace

View File

@ -0,0 +1,54 @@
#pragma once
#include <vector>
#include "ChartCell.h"
#include "ChartTranslationOptionCollection.h"
#include "ChartCellCollection.h"
#include "../../moses/src/InputType.h"
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/TrellisPathList.h"
#include "../../moses/src/SentenceStats.h"
namespace MosesChart
{
class Hypothesis;
class TrellisPathList;
class Manager
{
protected:
Moses::InputType const& m_source; /**< source sentence to be translated */
ChartCellCollection m_hypoStackColl;
TranslationOptionCollection m_transOptColl; /**< pre-computed list of translation options for the phrases in this sentence */
std::auto_ptr<Moses::SentenceStats> m_sentenceStats;
public:
Manager(Moses::InputType const& source);
~Manager();
void ProcessSentence();
const Hypothesis *GetBestHypothesis() const;
void CalcNBest(size_t count, MosesChart::TrellisPathList &ret,bool onlyDistinct=0) const;
void GetSearchGraph(long translationId, std::ostream &outputSearchGraphStream) const;
const Moses::InputType& GetSource() const {return m_source;}
Moses::SentenceStats& GetSentenceStats() const
{
return *m_sentenceStats;
}
/***
* to be called after processing a sentence (which may consist of more than just calling ProcessSentence() )
*/
void CalcDecoderStatistics() const;
void ResetSentenceStats(const Moses::InputType& source)
{
m_sentenceStats = std::auto_ptr<Moses::SentenceStats>(new Moses::SentenceStats(source));
}
};
}

View File

@ -0,0 +1,40 @@
#include "ChartTranslationOption.h"
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/InputType.h"
#include "../../moses/src/ChartRule.h"
#include "../../moses/src/WordConsumed.h"
using namespace std;
using namespace Moses;
namespace MosesChart
{
TranslationOption::TranslationOption(const WordsRange &wordsRange
, const ChartRule &rule)
:m_rule(rule)
,m_wordsRange(wordsRange)
{
//assert(wordsRange.GetStartPos() == rule.GetWordsConsumed().front()->GetWordsRange().GetStartPos());
assert(wordsRange.GetEndPos() == rule.GetLastWordConsumed().GetWordsRange().GetEndPos());
}
TranslationOption::~TranslationOption()
{
}
// friend
ostream& operator<<(ostream& out, const TranslationOption& transOpt)
{
out << transOpt.GetTotalScore()
<< " " << transOpt.GetChartRule().GetTargetPhrase()
<< " " << transOpt.GetChartRule().GetTargetPhrase().GetScoreBreakdown()
<< " " << transOpt.m_rule;
return out;
}
}

View File

@ -0,0 +1,45 @@
#pragma once
#include <iostream>
#include <vector>
#include "../../moses/src/TargetPhrase.h"
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/InputType.h"
#include "../../moses/src/ChartRule.h"
namespace MosesChart
{
class TranslationOption
{
friend std::ostream& operator<<(std::ostream& out, const TranslationOption &transOpt);
protected:
const Moses::ChartRule &m_rule; /*< output phrase when using this translation option */
const Moses::WordsRange &m_wordsRange;
public:
TranslationOption(const Moses::WordsRange &wordsRange
, const Moses::ChartRule &chartRule);
~TranslationOption();
const Moses::ChartRule &GetChartRule() const
{ return m_rule; }
const Moses::WordsRange &GetSourceWordsRange() const
{ return m_wordsRange; }
/** return estimate of total cost of this option */
inline size_t GetArity() const
{
return m_rule.GetTargetPhrase().GetArity();
}
/** return estimate of total cost of this option */
inline float GetTotalScore() const
{
return m_rule.GetTargetPhrase().GetFutureScore();
}
};
}

View File

@ -0,0 +1,315 @@
#include <cassert>
#include "ChartTranslationOptionCollection.h"
#include "ChartTranslationOption.h"
#include "ChartCellCollection.h"
#include "../../moses/src/InputType.h"
#include "../../moses/src/StaticData.h"
#include "../../moses/src/DecodeStep.h"
#include "../../moses/src/ChartRuleCollection.h"
#include "../../moses/src/DummyScoreProducers.h"
#include "../../moses/src/WordConsumed.h"
#include "../../moses/src/Util.h"
using namespace std;
using namespace Moses;
namespace MosesChart
{
TranslationOptionCollection::TranslationOptionCollection(InputType const& source
, const std::vector<DecodeGraph*> &decodeGraphList
, const ChartCellCollection &hypoStackColl)
:m_source(source)
,m_decodeGraphList(decodeGraphList)
,m_hypoStackColl(hypoStackColl)
,m_collection(source.GetSize())
{
// create 2-d vector
size_t size = source.GetSize();
for (size_t startPos = 0 ; startPos < size ; ++startPos)
{
m_collection[startPos].reserve(size-startPos);
for (size_t endPos = startPos ; endPos < size ; ++endPos)
{
m_collection[startPos].push_back( TranslationOptionList(WordsRange(startPos, endPos)) );
}
}
}
TranslationOptionCollection::~TranslationOptionCollection()
{
RemoveAllInColl(m_unksrcs);
RemoveAllInColl(m_cacheChartRule);
RemoveAllInColl(m_cacheTargetPhrase);
RemoveAllInColl(m_decodeGraphList);
std::list<std::vector<Moses::WordConsumed*>* >::iterator iterOuter;
for (iterOuter = m_cachedWordsConsumed.begin(); iterOuter != m_cachedWordsConsumed.end(); ++iterOuter)
{
std::vector<Moses::WordConsumed*> &inner = **iterOuter;
RemoveAllInColl(inner);
}
RemoveAllInColl(m_cachedWordsConsumed);
}
void TranslationOptionCollection::CreateTranslationOptionsForRange(
size_t startPos
, size_t endPos)
{
std::vector <DecodeGraph*>::const_iterator iterDecodeGraph;
for (iterDecodeGraph = m_decodeGraphList.begin(); iterDecodeGraph != m_decodeGraphList.end(); ++iterDecodeGraph)
{
const DecodeGraph &decodeGraph = **iterDecodeGraph;
size_t maxSpan = decodeGraph.GetMaxChartSpan();
if (maxSpan == 0 || (endPos-startPos+1) <= maxSpan)
{
CreateTranslationOptionsForRange(decodeGraph, startPos, endPos, true);
}
}
ProcessUnknownWord(startPos, endPos);
Prune(startPos, endPos);
Sort(startPos, endPos);
}
//! Force a creation of a translation option where there are none for a particular source position.
void TranslationOptionCollection::ProcessUnknownWord(size_t startPos, size_t endPos)
{
if (startPos != endPos)
{ // only for 1 word phrases
return;
}
TranslationOptionList &fullList = GetTranslationOptionList(startPos, startPos);
// try to translation for coverage with no trans by expanding table limit
std::vector <DecodeGraph*>::const_iterator iterDecodeGraph;
for (iterDecodeGraph = m_decodeGraphList.begin(); iterDecodeGraph != m_decodeGraphList.end(); ++iterDecodeGraph)
{
const DecodeGraph &decodeGraph = **iterDecodeGraph;
size_t numTransOpt = fullList.GetSize();
if (numTransOpt == 0)
{
CreateTranslationOptionsForRange(decodeGraph, startPos, startPos, false);
}
}
bool alwaysCreateDirectTranslationOption = StaticData::Instance().IsAlwaysCreateDirectTranslationOption();
// create unknown words for 1 word coverage where we don't have any trans options
if (fullList.GetSize() == 0 || alwaysCreateDirectTranslationOption)
ProcessUnknownWord(startPos);
}
void TranslationOptionCollection::CreateTranslationOptionsForRange(
const DecodeGraph &decodeGraph
, size_t startPos
, size_t endPos
, bool adhereTableLimit)
{
assert(decodeGraph.GetSize() == 1);
const DecodeStep &decodeStep = **decodeGraph.begin();
// get wordsrange that doesn't go away until after sentence processing
const WordsRange &wordsRange = GetTranslationOptionList(startPos, endPos).GetSourceRange();
TranslationOptionList &translationOptionList = GetTranslationOptionList(startPos, endPos);
const PhraseDictionary &phraseDictionary = decodeStep.GetPhraseDictionary();
//cerr << phraseDictionary.GetScoreProducerDescription() << endl;
const ChartRuleCollection *chartRuleCollection = phraseDictionary.GetChartRuleCollection(
m_source
, wordsRange
, adhereTableLimit
, m_hypoStackColl);
assert(chartRuleCollection != NULL);
//cerr << "chartRuleCollection size=" << chartRuleCollection->GetSize();
translationOptionList.Reserve(translationOptionList.GetSize()+chartRuleCollection->GetSize());
ChartRuleCollection::const_iterator iterTargetPhrase;
for (iterTargetPhrase = chartRuleCollection->begin(); iterTargetPhrase != chartRuleCollection->end(); ++iterTargetPhrase)
{
const ChartRule &rule = **iterTargetPhrase;
TranslationOption *transOpt = new TranslationOption(wordsRange, rule);
translationOptionList.Add(transOpt);
}
}
TranslationOptionList &TranslationOptionCollection::GetTranslationOptionList(size_t startPos, size_t endPos)
{
size_t sizeVec = m_collection[startPos].size();
assert(endPos-startPos < sizeVec);
return m_collection[startPos][endPos - startPos];
}
const TranslationOptionList &TranslationOptionCollection::GetTranslationOptionList(size_t startPos, size_t endPos) const
{
size_t sizeVec = m_collection[startPos].size();
assert(endPos-startPos < sizeVec);
return m_collection[startPos][endPos - startPos];
}
std::ostream& operator<<(std::ostream &out, const TranslationOptionCollection &coll)
{
std::vector< std::vector< TranslationOptionList > >::const_iterator iterOuter;
for (iterOuter = coll.m_collection.begin(); iterOuter != coll.m_collection.end(); ++iterOuter)
{
const std::vector< TranslationOptionList > &vecInner = *iterOuter;
std::vector< TranslationOptionList >::const_iterator iterInner;
for (iterInner = vecInner.begin(); iterInner != vecInner.end(); ++iterInner)
{
const TranslationOptionList &list = *iterInner;
out << list.GetSourceRange() << " = " << list.GetSize() << std::endl;
}
}
return out;
}
// taken from TranslationOptionCollectionText.
void TranslationOptionCollection::ProcessUnknownWord(size_t sourcePos)
{
const Word &sourceWord = m_source.GetWord(sourcePos);
ProcessOneUnknownWord(sourceWord,sourcePos);
}
//! special handling of ONE unknown words.
void TranslationOptionCollection::ProcessOneUnknownWord(const Moses::Word &sourceWord
, size_t sourcePos, size_t length)
{
// unknown word, add as trans opt
const StaticData &staticData = StaticData::Instance();
const UnknownWordPenaltyProducer *unknownWordPenaltyProducer = staticData.GetUnknownWordPenaltyProducer();
const WordPenaltyProducer *wordPenaltyProducer = staticData.GetWordPenaltyProducer();
vector<float> wordPenaltyScore(1, -0.434294482);
size_t isDigit = 0;
if (staticData.GetDropUnknown())
{
const Factor *f = sourceWord[0]; // TODO hack. shouldn't know which factor is surface
const string &s = f->GetString();
isDigit = s.find_first_of("0123456789");
if (isDigit == string::npos)
isDigit = 0;
else
isDigit = 1;
// modify the starting bitmap
}
Phrase* m_unksrc = new Phrase(Input);
m_unksrc->AddWord() = sourceWord;
m_unksrcs.push_back(m_unksrc);
TranslationOption *transOpt;
if (! staticData.GetDropUnknown() || isDigit)
{
// words consumed
std::vector<WordConsumed*> *wordsConsumed = new std::vector<WordConsumed*>();
m_cachedWordsConsumed.push_back(wordsConsumed);
WordConsumed *wc = new WordConsumed(sourcePos, sourcePos, sourceWord, NULL);
wordsConsumed->push_back(wc);
assert(wordsConsumed->size());
// loop
const UnknownLHSList &lhsList = staticData.GetUnknownLHS();
UnknownLHSList::const_iterator iterLHS;
for (iterLHS = lhsList.begin(); iterLHS != lhsList.end(); ++iterLHS)
{
const string &targetLHSStr = iterLHS->first;
float prob = iterLHS->second;
// lhs
const Word &sourceLHS = staticData.GetInputDefaultNonTerminal();
Word targetLHS(true);
targetLHS.CreateFromString(Output, staticData.GetOutputFactorOrder(), targetLHSStr, true);
assert(targetLHS.GetFactor(0) != NULL);
// add to dictionary
TargetPhrase *targetPhrase = new TargetPhrase(Output);
m_cacheTargetPhrase.push_back(targetPhrase);
Word &targetWord = targetPhrase->AddWord();
targetWord.CreateUnknownWord(sourceWord);
// scores
vector<float> unknownScore(1, FloorScore(TransformScore(prob)));
//targetPhrase->SetScore();
targetPhrase->SetScore(unknownWordPenaltyProducer, unknownScore);
targetPhrase->SetScore(wordPenaltyProducer, wordPenaltyScore);
targetPhrase->SetSourcePhrase(m_unksrc);
targetPhrase->SetTargetLHS(targetLHS);
// chart rule
ChartRule *chartRule = new ChartRule(*targetPhrase
, *wordsConsumed->back());
chartRule->CreateNonTermIndex();
m_cacheChartRule.push_back(chartRule);
transOpt = new TranslationOption(wc->GetWordsRange(), *chartRule);
//transOpt->CalcScore();
Add(transOpt, sourcePos);
} // for (iterLHS
}
else
{ // drop source word. create blank trans opt
vector<float> unknownScore(1, FloorScore(-numeric_limits<float>::infinity()));
TargetPhrase *targetPhrase = new TargetPhrase(Output);
m_cacheTargetPhrase.push_back(targetPhrase);
targetPhrase->SetSourcePhrase(m_unksrc);
targetPhrase->SetScore(unknownWordPenaltyProducer, unknownScore);
// words consumed
std::vector<WordConsumed*> *wordsConsumed = new std::vector<WordConsumed*>;
m_cachedWordsConsumed.push_back(wordsConsumed);
wordsConsumed->push_back(new WordConsumed(sourcePos, sourcePos, sourceWord, NULL));
// chart rule
assert(wordsConsumed->size());
ChartRule *chartRule = new ChartRule(*targetPhrase
, *wordsConsumed->back());
chartRule->CreateNonTermIndex();
m_cacheChartRule.push_back(chartRule);
transOpt = new TranslationOption(Moses::WordsRange(sourcePos, sourcePos)
, *chartRule);
//transOpt->CalcScore();
Add(transOpt, sourcePos);
}
}
void TranslationOptionCollection::Add(TranslationOption *transOpt, size_t pos)
{
TranslationOptionList &transOptList = GetTranslationOptionList(pos, pos);
transOptList.Add(transOpt);
}
//! pruning: only keep the top n (m_maxNoTransOptPerCoverage) elements */
void TranslationOptionCollection::Prune(size_t startPos, size_t endPos)
{
}
//! sort all trans opt in each list for cube pruning */
void TranslationOptionCollection::Sort(size_t startPos, size_t endPos)
{
TranslationOptionList &list = GetTranslationOptionList(startPos, endPos);
list.Sort();
}
} // namespace

View File

@ -0,0 +1,79 @@
#pragma once
#include <vector>
#include "ChartTranslationOptionList.h"
#include "../../moses/src/InputType.h"
#include "../../moses/src/DecodeGraph.h"
namespace Moses
{
class DecodeGraph;
class Word;
class ChartRule;
class WordConsumed;
};
namespace MosesChart
{
class ChartCellCollection;
class TranslationOptionCollection
{
friend std::ostream& operator<<(std::ostream&, const TranslationOptionCollection&);
protected:
const Moses::InputType &m_source;
std::vector<Moses::DecodeGraph*> m_decodeGraphList;
const ChartCellCollection &m_hypoStackColl;
std::vector< std::vector< TranslationOptionList > > m_collection; /*< contains translation options */
std::vector<Moses::Phrase*> m_unksrcs;
std::list<Moses::ChartRule*> m_cacheChartRule;
std::list<Moses::TargetPhrase*> m_cacheTargetPhrase;
std::list<std::vector<Moses::WordConsumed*>* > m_cachedWordsConsumed;
virtual void CreateTranslationOptionsForRange(const Moses::DecodeGraph &decodeStepList
, size_t startPosition
, size_t endPosition
, bool adhereTableLimit);
void Add(TranslationOptionList &translationOptionList);
// for adding 1 trans opt in unknown word proc
void Add(TranslationOption *transOpt, size_t pos);
TranslationOptionList &GetTranslationOptionList(size_t startPos, size_t endPos);
const TranslationOptionList &GetTranslationOptionList(size_t startPos, size_t endPos) const;
void ProcessUnknownWord(size_t startPos, size_t endPos);
// taken from TranslationOptionCollectionText.
void ProcessUnknownWord(size_t sourcePos);
//! special handling of ONE unknown words.
virtual void ProcessOneUnknownWord(const Moses::Word &sourceWord
, size_t sourcePos, size_t length = 1);
//! pruning: only keep the top n (m_maxNoTransOptPerCoverage) elements */
void Prune(size_t startPos, size_t endPos);
//! sort all trans opt in each list for cube pruning */
void Sort(size_t startPos, size_t endPos);
public:
TranslationOptionCollection(Moses::InputType const& source
, const std::vector<Moses::DecodeGraph*> &decodeGraphList
, const ChartCellCollection &hypoStackColl);
virtual ~TranslationOptionCollection();
//virtual void CreateTranslationOptions(const std::vector <Moses::DecodeGraph*> &decodeGraphList);
void CreateTranslationOptionsForRange(size_t startPos
, size_t endPos);
const TranslationOptionList &GetTranslationOptionList(const Moses::WordsRange &range) const
{
return GetTranslationOptionList(range.GetStartPos(), range.GetEndPos());
}
};
}

View File

@ -0,0 +1,69 @@
#include <algorithm>
#include <iostream>
#include "ChartTranslationOptionList.h"
#include "../../moses/src/Util.h"
#include "../../moses/src/StaticData.h"
using namespace Moses;
using namespace std;
namespace MosesChart
{
TranslationOptionList::~TranslationOptionList()
{
RemoveAllInColl(m_coll);
}
void TranslationOptionList::Add(TranslationOption *transOpt)
{
m_coll.push_back(transOpt);
}
void TranslationOptionList::Sort()
{
// keep only those over best + threshold
float scoreThreshold = -std::numeric_limits<float>::infinity();
CollType::const_iterator iter;
for (iter = m_coll.begin(); iter != m_coll.end(); ++iter)
{
const TranslationOption *transOpt = *iter;
float score = transOpt->GetTotalScore();
scoreThreshold = (score > scoreThreshold) ? score : scoreThreshold;
}
scoreThreshold += StaticData::Instance().GetTranslationOptionThreshold();
size_t ind = 0;
while (ind < m_coll.size())
{
const TranslationOption *transOpt = m_coll[ind];
if (transOpt->GetTotalScore() < scoreThreshold)
{
delete transOpt;
m_coll.erase(m_coll.begin() + ind);
}
else
{
ind++;
}
}
std::sort(m_coll.begin(), m_coll.end(), ChartTranslationOptionOrderer());
}
std::ostream& operator<<(std::ostream &out, const TranslationOptionList &list)
{
TranslationOptionList::const_iterator iter;
for (iter = list.begin(); iter != list.end(); ++iter)
{
out << **iter << endl;
}
return out;
}
}

View File

@ -0,0 +1,60 @@
#pragma once
#include <vector>
#include "../../moses/src/WordsRange.h"
#include "ChartTranslationOption.h"
namespace MosesChart
{
class ChartTranslationOptionOrderer
{
public:
bool operator()(const TranslationOption* transOptA, const TranslationOption* transOptB) const
{
/*
if (transOptA->GetArity() != transOptB->GetArity())
{
return transOptA->GetArity() < transOptB->GetArity();
}
*/
return transOptA->GetTotalScore() > transOptB->GetTotalScore();
}
};
class TranslationOptionList
{
friend std::ostream& operator<<(std::ostream&, const TranslationOptionList&);
protected:
typedef std::vector<TranslationOption*> CollType;
CollType m_coll;
Moses::WordsRange m_range;
public:
typedef CollType::iterator iterator;
typedef CollType::const_iterator const_iterator;
const_iterator begin() const { return m_coll.begin(); }
const_iterator end() const { return m_coll.end(); }
iterator begin() { return m_coll.begin(); }
iterator end() { return m_coll.end(); }
TranslationOptionList(const Moses::WordsRange &range)
: m_range(range)
{}
~TranslationOptionList();
size_t GetSize() const
{ return m_coll.size(); }
const Moses::WordsRange &GetSourceRange() const
{ return m_range; }
void Add(TranslationOption *transOpt);
void Sort();
void Reserve(CollType::size_type n) { m_coll.reserve(n); }
};
}

View File

@ -0,0 +1,121 @@
#include "ChartTrellisNode.h"
#include "ChartHypothesis.h"
#include "../../moses/src/ScoreComponentCollection.h"
using namespace std;
namespace MosesChart
{
TrellisNode::TrellisNode(const Hypothesis *hypo)
:m_hypo(hypo)
{
const std::vector<const Hypothesis*> &prevHypos = hypo->GetPrevHypos();
m_edge.reserve(prevHypos.size());
for (size_t ind = 0; ind < prevHypos.size(); ++ind)
{
const Hypothesis *prevHypo = prevHypos[ind];
TrellisNode *child = new TrellisNode(prevHypo);
m_edge.push_back(child);
}
assert(m_hypo);
}
TrellisNode::TrellisNode(const TrellisNode &origNode
, const TrellisNode &soughtNode
, const Hypothesis &replacementHypo
, Moses::ScoreComponentCollection &scoreChange
, const TrellisNode *&nodeChanged)
{
if (&origNode.GetHypothesis() == &soughtNode.GetHypothesis())
{ // this node should be replaced
m_hypo = &replacementHypo;
nodeChanged = this;
// scores
assert(scoreChange.GetWeightedScore() == 0); // should only be changing 1 node
scoreChange = replacementHypo.GetScoreBreakDown();
scoreChange.MinusEquals(origNode.GetHypothesis().GetScoreBreakDown());
float deltaScore = scoreChange.GetWeightedScore();
assert(deltaScore <= 0.0005);
// follow prev hypos back to beginning
const std::vector<const Hypothesis*> &prevHypos = replacementHypo.GetPrevHypos();
vector<const Hypothesis*>::const_iterator iter;
assert(m_edge.empty());
m_edge.reserve(prevHypos.size());
for (iter = prevHypos.begin(); iter != prevHypos.end(); ++iter)
{
const Hypothesis *prevHypo = *iter;
TrellisNode *prevNode = new TrellisNode(prevHypo);
m_edge.push_back(prevNode);
}
}
else
{ // not the node we're looking for. Copy as-is and continue finding node
m_hypo = &origNode.GetHypothesis();
NodeChildren::const_iterator iter;
assert(m_edge.empty());
m_edge.reserve(origNode.m_edge.size());
for (iter = origNode.m_edge.begin(); iter != origNode.m_edge.end(); ++iter)
{
const TrellisNode &prevNode = **iter;
TrellisNode *newPrevNode = new TrellisNode(prevNode, soughtNode, replacementHypo, scoreChange, nodeChanged);
m_edge.push_back(newPrevNode);
}
}
assert(m_hypo);
}
TrellisNode::~TrellisNode()
{
Moses::RemoveAllInColl(m_edge);
}
Moses::Phrase TrellisNode::GetOutputPhrase() const
{
// exactly like same fn in hypothesis, but use trellis nodes instead of prevHypos pointer
Moses::Phrase ret(Moses::Output);
const Moses::Phrase &currTargetPhrase = m_hypo->GetCurrTargetPhrase();
for (size_t pos = 0; pos < currTargetPhrase.GetSize(); ++pos)
{
const Moses::Word &word = currTargetPhrase.GetWord(pos);
if (word.IsNonTerminal())
{ // non-term. fill out with prev hypo
size_t nonTermInd = m_hypo->GetWordsConsumedTargetOrder(pos);
const TrellisNode &childNode = GetChild(nonTermInd);
Moses::Phrase childPhrase = childNode.GetOutputPhrase();
ret.Append(childPhrase);
}
else
{
ret.AddWord(word);
}
}
return ret;
}
std::ostream& operator<<(std::ostream &out, const TrellisNode &node)
{
out << "* " << node.GetHypothesis() << endl;
TrellisNode::NodeChildren::const_iterator iter;
for (iter = node.GetChildren().begin(); iter != node.GetChildren().end(); ++iter)
{
out << **iter;
}
return out;
}
}

View File

@ -0,0 +1,49 @@
#pragma once
#include <vector>
#include "../../moses/src/Phrase.h"
namespace Moses
{
class ScoreComponentCollection;
}
namespace MosesChart
{
class Hypothesis;
class TrellisNode
{
friend std::ostream& operator<<(std::ostream&, const TrellisNode&);
public:
typedef std::vector<TrellisNode*> NodeChildren;
protected:
const Hypothesis *m_hypo;
NodeChildren m_edge;
public:
TrellisNode(const Hypothesis *hypo);
TrellisNode(const TrellisNode &origNode
, const TrellisNode &soughtNode
, const Hypothesis &replacementHypo
, Moses::ScoreComponentCollection &scoreChange
, const TrellisNode *&nodeChanged);
~TrellisNode();
const Hypothesis &GetHypothesis() const
{
return *m_hypo;
}
const NodeChildren &GetChildren() const
{ return m_edge; }
const TrellisNode &GetChild(size_t ind) const
{ return *m_edge[ind]; }
Moses::Phrase GetOutputPhrase() const;
};
}

View File

@ -0,0 +1,113 @@
#include "ChartTrellisPath.h"
#include "ChartHypothesis.h"
#include "ChartTrellisPathCollection.h"
#include "../../moses/src/StaticData.h"
#include "../../moses/src/Word.h"
using namespace std;
namespace MosesChart
{
TrellisPath::TrellisPath(const Hypothesis *hypo)
:m_finalNode(new TrellisNode(hypo))
,m_scoreBreakdown(hypo->GetScoreBreakDown())
,m_totalScore(hypo->GetTotalScore())
,m_prevNodeChanged(NULL)
,m_prevPath(NULL)
{
}
TrellisPath::TrellisPath(const TrellisPath &origPath
, const TrellisNode &soughtNode
, const Hypothesis &replacementHypo
, Moses::ScoreComponentCollection &scoreChange)
:m_scoreBreakdown(origPath.GetScoreBreakdown())
,m_prevPath(&origPath)
{
m_finalNode = new TrellisNode(origPath.GetFinalNode()
, soughtNode
, replacementHypo
, scoreChange
, m_prevNodeChanged);
m_scoreBreakdown.PlusEquals(scoreChange);
m_totalScore = m_scoreBreakdown.GetWeightedScore();
}
TrellisPath::~TrellisPath()
{
delete m_finalNode;
}
Moses::Phrase TrellisPath::GetOutputPhrase() const
{
Moses::Phrase ret = GetFinalNode().GetOutputPhrase();
return ret;
}
void TrellisPath::CreateDeviantPaths(TrellisPathCollection &pathColl, const TrellisNode &soughtNode) const
{
// copy this path but replace startHypo with its arc
const ArcList *arcList = soughtNode.GetHypothesis().GetArcList();
if (arcList)
{
ArcList::const_iterator iterArcList;
for (iterArcList = arcList->begin(); iterArcList != arcList->end(); ++iterArcList)
{
Moses::ScoreComponentCollection scoreChange;
const Hypothesis &replacementHypo = **iterArcList;
TrellisPath *newPath = new TrellisPath(*this, soughtNode, replacementHypo, scoreChange);
pathColl.Add(newPath);
}
}
// recusively create deviant paths for child nodes
const TrellisNode::NodeChildren &children = soughtNode.GetChildren();
TrellisNode::NodeChildren::const_iterator iter;
for (iter = children.begin(); iter != children.end(); ++iter)
{
const TrellisNode &child = **iter;
CreateDeviantPaths(pathColl, child);
}
}
void TrellisPath::CreateDeviantPaths(TrellisPathCollection &pathColl) const
{
if (m_prevNodeChanged == NULL)
{ // initial enumeration from a pure hypo
CreateDeviantPaths(pathColl, GetFinalNode());
}
else
{ // don't change m_prevNodeChanged, just it's children
const TrellisNode::NodeChildren &children = m_prevNodeChanged->GetChildren();
TrellisNode::NodeChildren::const_iterator iter;
for (iter = children.begin(); iter != children.end(); ++iter)
{
const TrellisNode &child = **iter;
CreateDeviantPaths(pathColl, child);
}
}
}
std::ostream& operator<<(std::ostream &out, const TrellisPath &path)
{
out << &path << " " << path.m_prevPath << " " << path.GetOutputPhrase() << endl;
if (path.m_prevNodeChanged)
{
out << "changed " << path.m_prevNodeChanged->GetHypothesis() << endl;
}
out << path.GetFinalNode() << endl;
return out;
}
};

View File

@ -0,0 +1,61 @@
#pragma once
#include "ChartTrellisNode.h"
#include "../../moses/src/ScoreComponentCollection.h"
#include "../../moses/src/Phrase.h"
namespace MosesChart
{
class Hypothesis;
class TrellisPathCollection;
class TrellisPath
{
friend std::ostream& operator<<(std::ostream&, const TrellisPath&);
protected:
// recursively point backwards
TrellisNode *m_finalNode;
const TrellisNode *m_prevNodeChanged;
const TrellisPath *m_prevPath;
Moses::ScoreComponentCollection m_scoreBreakdown;
float m_totalScore;
// deviate by 1 hypo
TrellisPath(const TrellisPath &origPath
, const TrellisNode &soughtNode
, const Hypothesis &replacementHypo
, Moses::ScoreComponentCollection &scoreChange);
void CreateDeviantPaths(TrellisPathCollection &pathColl, const TrellisNode &soughtNode) const;
const TrellisNode &GetFinalNode() const
{
assert (m_finalNode);
return *m_finalNode;
}
public:
TrellisPath(const Hypothesis *hypo);
~TrellisPath();
//! get score for this path throught trellis
inline float GetTotalScore() const
{ return m_totalScore; }
Moses::Phrase GetOutputPhrase() const;
/** returns detailed component scores */
inline const Moses::ScoreComponentCollection &GetScoreBreakdown() const
{
return m_scoreBreakdown;
}
void CreateDeviantPaths(TrellisPathCollection &pathColl) const;
};
}

View File

@ -0,0 +1,46 @@
#include "ChartTrellisPathCollection.h"
#include "ChartTrellisPath.h"
namespace MosesChart
{
TrellisPathCollection::~TrellisPathCollection()
{
// clean up
Moses::RemoveAllInColl(m_collection);
}
void TrellisPathCollection::Add(TrellisPath *path)
{
m_collection.insert(path);
}
void TrellisPathCollection::Prune(size_t newSize)
{
size_t currSize = m_collection.size();
if (currSize <= newSize)
return; // don't need to prune
CollectionType::reverse_iterator iterRev;
for (iterRev = m_collection.rbegin() ; iterRev != m_collection.rend() ; ++iterRev)
{
TrellisPath *trellisPath = *iterRev;
delete trellisPath;
currSize--;
if (currSize == newSize)
break;
}
// delete path in m_collection
CollectionType::iterator iter = m_collection.begin();
for (size_t i = 0 ; i < newSize ; ++i)
iter++;
m_collection.erase(iter, m_collection.end());
}
}

View File

@ -0,0 +1,47 @@
#pragma once
#include <set>
#include "ChartTrellisPath.h"
namespace MosesChart
{
class TrellisPath;
struct CompareTrellisPathCollection
{
bool operator()(const TrellisPath* pathA, const TrellisPath* pathB) const
{
return (pathA->GetTotalScore() > pathB->GetTotalScore());
}
};
class TrellisPathCollection
{
protected:
typedef std::multiset<TrellisPath*, CompareTrellisPathCollection> CollectionType;
CollectionType m_collection;
public:
~TrellisPathCollection();
size_t GetSize() const
{ return m_collection.size(); }
void Add(TrellisPath *path);
void Prune(size_t newSize);
TrellisPath *pop()
{
TrellisPath *top = *m_collection.begin();
// Detach
m_collection.erase(m_collection.begin());
return top;
}
};
}

View File

@ -0,0 +1,17 @@
#include "ChartTrellisPathList.h"
#include "ChartTrellisPath.h"
#include "../../moses/src/Util.h"
using namespace std;
namespace MosesChart
{
TrellisPathList::~TrellisPathList()
{
// clean up
Moses::RemoveAllInColl(m_collection);
}
} // namespace

View File

@ -0,0 +1,40 @@
#pragma once
#include <vector>
namespace MosesChart
{
class TrellisPath;
class TrellisPathList
{
protected:
typedef std::vector<const TrellisPath*> CollType;
CollType m_collection;
public:
// iters
typedef CollType::iterator iterator;
typedef CollType::const_iterator const_iterator;
iterator begin() { return m_collection.begin(); }
iterator end() { return m_collection.end(); }
const_iterator begin() const { return m_collection.begin(); }
const_iterator end() const { return m_collection.end(); }
void clear() { m_collection.clear(); }
virtual ~TrellisPathList();
size_t GetSize() const
{ return m_collection.size(); }
//! add a new entry into collection
void Add(TrellisPath *trellisPath)
{
m_collection.push_back(trellisPath);
}
};
} // namespace

66
moses-chart/src/Cube.cpp Normal file
View File

@ -0,0 +1,66 @@
/*
* Cube.cpp
* moses-chart
*
* Created by Hieu Hoang on 18/08/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include "Cube.h"
using namespace std;
namespace MosesChart
{
Cube::~Cube()
{
clear();
}
void
Cube::clear()
{
while (!m_sortedByScore.empty())
{
m_sortedByScore.pop();
}
UniqueCubeEntry::iterator iter;
for (iter = m_uniqueEntry.begin(); iter != m_uniqueEntry.end(); ++iter)
{
QueueEntry *entry = *iter;
delete entry;
}
m_uniqueEntry.clear();
}
bool Cube::Add(QueueEntry *queueEntry)
{
pair<UniqueCubeEntry::iterator, bool> inserted = m_uniqueEntry.insert(queueEntry);
if (inserted.second)
{ // inserted
m_sortedByScore.push(queueEntry);
}
else
{ // already there
//cerr << "already there\n";
delete queueEntry;
}
//assert(m_uniqueEntry.size() == m_sortedByScore.size());
return inserted.second;
}
QueueEntry *Cube::Pop()
{
QueueEntry *entry = m_sortedByScore.top();
m_sortedByScore.pop();
return entry;
}
}

59
moses-chart/src/Cube.h Normal file
View File

@ -0,0 +1,59 @@
/*
* Cube.h
* moses-chart
*
* Created by Hieu Hoang on 18/08/2009.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#include <queue>
#include <vector>
#include <set>
#include "QueueEntry.h"
namespace MosesChart
{
class QueueEntryUniqueOrderer
{
public:
bool operator()(const QueueEntry* entryA, const QueueEntry* entryB) const
{
return (*entryA) < (*entryB);
}
};
class QueueEntryScoreOrderer
{
public:
bool operator()(const QueueEntry* entryA, const QueueEntry* entryB) const
{
return (entryA->GetCombinedScore() < entryB->GetCombinedScore());
}
};
class Cube
{
protected:
typedef std::set<QueueEntry*, QueueEntryUniqueOrderer> UniqueCubeEntry;
UniqueCubeEntry m_uniqueEntry;
typedef std::priority_queue<QueueEntry*, std::vector<QueueEntry*>, QueueEntryScoreOrderer> SortedByScore;
SortedByScore m_sortedByScore;
public:
~Cube();
bool IsEmpty() const
{ return m_sortedByScore.empty(); }
QueueEntry *Pop();
bool Add(QueueEntry *queueEntry);
void clear();
};
};

View File

@ -0,0 +1,22 @@
lib_LIBRARIES = libmoses-chart.a
AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
libmoses_chart_a_SOURCES = \
ChartCell.cpp \
ChartCellCollection.cpp \
ChartHypothesis.cpp \
ChartHypothesisCollection.cpp \
ChartManager.cpp \
ChartTranslationOption.cpp \
ChartTranslationOptionCollection.cpp \
ChartTranslationOptionList.cpp \
ChartTrellisNode.cpp \
ChartTrellisPath.cpp \
ChartTrellisPathCollection.cpp \
ChartTrellisPathList.cpp \
Cube.cpp \
QueueEntry.cpp
CLEANFILES = $(BUILT_SOURCES)

View File

@ -0,0 +1,133 @@
#include "QueueEntry.h"
#include "ChartCell.h"
#include "ChartTranslationOption.h"
#include "ChartTranslationOptionList.h"
#include "ChartTranslationOptionCollection.h"
#include "ChartCellCollection.h"
#include "Cube.h"
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/ChartRule.h"
#include "../../moses/src/Util.h"
#include "../../moses/src/WordConsumed.h"
using namespace std;
using namespace Moses;
namespace MosesChart
{
QueueEntry::QueueEntry(const TranslationOption &transOpt
, const ChartCellCollection &allChartCells
, bool &isOK)
:m_transOpt(transOpt)
{
isOK = false;
const WordConsumed *wordsConsumed = &transOpt.GetChartRule().GetLastWordConsumed();
isOK = CreateChildEntry(wordsConsumed, allChartCells);
if (isOK)
CalcScore();
}
bool QueueEntry::CreateChildEntry(const Moses::WordConsumed *wordsConsumed, const ChartCellCollection &allChartCells)
{
bool ret;
// recursvile do the 1st first
const WordConsumed *prevWordsConsumed = wordsConsumed->GetPrevWordsConsumed();
if (prevWordsConsumed)
ret = CreateChildEntry(prevWordsConsumed, allChartCells);
else
ret = true;
if (ret && wordsConsumed->IsNonTerminal())
{ // non-term
const WordsRange &childRange = wordsConsumed->GetWordsRange();
const ChartCell &childCell = allChartCells.Get(childRange);
const Word &headWord = wordsConsumed->GetSourceWord();
if (childCell.GetSortedHypotheses(headWord).size() == 0)
{ // can't create hypo out of this. child cell is empty
return false;
}
const Moses::Word &nonTerm = wordsConsumed->GetSourceWord();
assert(nonTerm.IsNonTerminal());
ChildEntry childEntry(0, childCell.GetSortedHypotheses(nonTerm), nonTerm);
m_childEntries.push_back(childEntry);
}
return ret;
}
QueueEntry::QueueEntry(const QueueEntry &copy, size_t childEntryIncr)
:m_transOpt(copy.m_transOpt)
,m_childEntries(copy.m_childEntries)
{
ChildEntry &childEntry = m_childEntries[childEntryIncr];
childEntry.IncrementPos();
CalcScore();
}
QueueEntry::~QueueEntry()
{
//Moses::RemoveAllInColl(m_childEntries);
}
void QueueEntry::CreateDeviants(Cube &cube) const
{
for (size_t ind = 0; ind < m_childEntries.size(); ind++)
{
const ChildEntry &childEntry = m_childEntries[ind];
if (childEntry.HasMoreHypo())
{
QueueEntry *newEntry = new QueueEntry(*this, ind);
cube.Add(newEntry);
}
}
}
void QueueEntry::CalcScore()
{
m_combinedScore = m_transOpt.GetTotalScore();
for (size_t ind = 0; ind < m_childEntries.size(); ind++)
{
const ChildEntry &childEntry = m_childEntries[ind];
const Hypothesis *hypo = childEntry.GetHypothesis();
m_combinedScore += hypo->GetTotalScore();
}
}
bool QueueEntry::operator<(const QueueEntry &compare) const
{
if (&m_transOpt != &compare.m_transOpt)
return &m_transOpt < &compare.m_transOpt;
bool ret = m_childEntries < compare.m_childEntries;
return ret;
}
std::ostream& operator<<(std::ostream &out, const ChildEntry &entry)
{
out << *entry.GetHypothesis();
return out;
}
std::ostream& operator<<(std::ostream &out, const QueueEntry &entry)
{
out << entry.GetTranslationOption() << endl;
std::vector<ChildEntry>::const_iterator iter;
for (iter = entry.GetChildEntries().begin(); iter != entry.GetChildEntries().end(); ++iter)
{
out << *iter << endl;
}
return out;
}
}

View File

@ -0,0 +1,105 @@
#pragma once
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <iostream>
#include "../../moses/src/WordsRange.h"
#include "../../moses/src/Word.h"
#include "ChartHypothesis.h"
namespace Moses
{
class WordConsumed;
extern bool g_debug;
};
namespace MosesChart
{
class TranslationOptionCollection;
class TranslationOptionList;
class TranslationOption;
class ChartCell;
class ChartCellCollection;
class QueueEntry;
class Cube;
typedef std::vector<const Hypothesis*> HypoList;
// wrapper around list of hypothese for a particular non-term of a trans opt
class ChildEntry
{
friend std::ostream& operator<<(std::ostream&, const ChildEntry&);
protected:
size_t m_pos;
const HypoList *m_orderedHypos;
public:
ChildEntry(size_t pos, const HypoList &orderedHypos, const Moses::Word &headWord)
:m_pos(pos)
,m_orderedHypos(&orderedHypos)
//,m_headWord(headWord)
{}
size_t IncrementPos()
{ return m_pos++; }
bool HasMoreHypo() const
{
return m_pos + 1 < m_orderedHypos->size();
}
const Hypothesis *GetHypothesis() const
{
return (*m_orderedHypos)[m_pos];
}
//const Moses::Word &GetHeadWord() const
//{ return m_headWord; }
//! transitive comparison used for adding objects into FactorCollection
bool operator<(const ChildEntry &compare) const
{
return GetHypothesis() < compare.GetHypothesis();
}
};
// entry in the cub of 1 trans opt and all the hypotheses that goes with each non term.
class QueueEntry
{
friend std::ostream& operator<<(std::ostream&, const QueueEntry&);
protected:
const TranslationOption &m_transOpt;
std::vector<ChildEntry> m_childEntries;
float m_combinedScore;
QueueEntry(const QueueEntry &copy, size_t childEntryIncr);
bool CreateChildEntry(const Moses::WordConsumed *wordsConsumed, const ChartCellCollection &allChartCells);
void CalcScore();
public:
QueueEntry(const TranslationOption &transOpt
, const ChartCellCollection &allChartCells
, bool &isOK);
~QueueEntry();
const TranslationOption &GetTranslationOption() const
{ return m_transOpt; }
const std::vector<ChildEntry> &GetChildEntries() const
{ return m_childEntries; }
float GetCombinedScore() const
{ return m_combinedScore; }
void CreateDeviants(Cube &) const;
bool operator<(const QueueEntry &compare) const;
};
}

View File

@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="9.00"
Name="moses-cmd"
ProjectGUID="{5BBAC701-84F5-438E-8F54-B3391F451F2A}"
ProjectGUID="{E2233DB1-5592-46FE-9420-E529420612FA}"
RootNamespace="mosescmd"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
@ -41,8 +41,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\moses\src&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;EXIT_RETURN"
AdditionalIncludeDirectories="&quot;../moses/src&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -62,8 +62,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(SolutionDir)$(ConfigurationName)\moses.lib&quot; zdll.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalDependencies="zdll.lib &quot;$(OutDir)\moses.lib&quot; &quot;$(OutDir)\OnDiskPt.lib&quot;"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
@ -118,8 +117,8 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\moses\src&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;EXIT_RETURN"
AdditionalIncludeDirectories="&quot;../moses/src&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
@ -137,8 +136,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(SolutionDir)$(ConfigurationName)\moses.lib&quot; zdll.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalDependencies="zdll.lib &quot;$(OutDir)\moses.lib&quot; &quot;$(OutDir)\OnDiskPt.lib&quot;"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
@ -170,192 +168,10 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release-withSRILM|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="&quot;$(SolutionDir)\moses\src&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;LM_SRI;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;EXIT_RETURN"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/FORCE:MULTIPLE"
AdditionalDependencies="&quot;$(SolutionDir)$(ConfigurationName)\moses.lib&quot; zdll.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug-withSRILM|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="&quot;$(SolutionDir)\moses\src&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;LM_SRI;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;EXIT_RETURN"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/FORCE:MULTIPLE"
AdditionalDependencies="&quot;$(SolutionDir)$(ConfigurationName)\moses.lib&quot; zdll.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<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\IOWrapper.cpp"
>
</File>
<File
RelativePath=".\src\LatticeMBR.cpp"
>
</File>
<File
RelativePath=".\src\Main.cpp"
>
</File>
<File
RelativePath=".\src\mbr.cpp"
>
</File>
<File
RelativePath=".\src\TranslationAnalysis.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
@ -381,17 +197,27 @@
RelativePath=".\src\TranslationAnalysis.h"
>
</File>
<File
RelativePath=".\src\utf8.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}"
<File
RelativePath=".\src\IOWrapper.cpp"
>
</Filter>
</File>
<File
RelativePath=".\src\LatticeMBR.cpp"
>
</File>
<File
RelativePath=".\src\Main.cpp"
>
</File>
<File
RelativePath=".\src\mbr.cpp"
>
</File>
<File
RelativePath=".\src\TranslationAnalysis.cpp"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -13,6 +13,7 @@
1C8CFF4E0AD68D3600FA22E2 /* Main.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1C8CFF460AD68D3600FA22E2 /* Main.h */; };
1C8CFF4F0AD68D3600FA22E2 /* TranslationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8CFF470AD68D3600FA22E2 /* TranslationAnalysis.cpp */; };
1C8CFF500AD68D3600FA22E2 /* TranslationAnalysis.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1C8CFF480AD68D3600FA22E2 /* TranslationAnalysis.h */; };
1CE646E411679F6900EC77CC /* libOnDiskPt.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CE646E311679F5F00EC77CC /* libOnDiskPt.a */; };
B219B8540E93812700EAB407 /* libmoses.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03306D670C0B240B00CA1311 /* libmoses.a */; };
B219B8580E9381AC00EAB407 /* IOWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B219B8560E9381AC00EAB407 /* IOWrapper.cpp */; };
B28B1ED3110F52BB00AAD188 /* LatticeMBR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28B1ED2110F52BB00AAD188 /* LatticeMBR.cpp */; };
@ -33,6 +34,20 @@
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = moses;
};
1CE646E211679F5F00EC77CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1CE646DB11679F5F00EC77CC /* OnDiskPt.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D2AAC046055464E500DB518D;
remoteInfo = OnDiskPt;
};
1CE6472D1167A11600EC77CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1CE646DB11679F5F00EC77CC /* OnDiskPt.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = OnDiskPt;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@ -58,6 +73,7 @@
1C8CFF460AD68D3600FA22E2 /* Main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Main.h; path = src/Main.h; sourceTree = "<group>"; };
1C8CFF470AD68D3600FA22E2 /* TranslationAnalysis.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = TranslationAnalysis.cpp; path = src/TranslationAnalysis.cpp; sourceTree = "<group>"; };
1C8CFF480AD68D3600FA22E2 /* TranslationAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TranslationAnalysis.h; path = src/TranslationAnalysis.h; sourceTree = "<group>"; };
1CE646DB11679F5F00EC77CC /* OnDiskPt.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OnDiskPt.xcodeproj; path = ../OnDiskPt/OnDiskPt.xcodeproj; sourceTree = SOURCE_ROOT; };
8DD76F6C0486A84900D96B5E /* moses-cmd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "moses-cmd"; sourceTree = BUILT_PRODUCTS_DIR; };
B219B8560E9381AC00EAB407 /* IOWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOWrapper.cpp; path = src/IOWrapper.cpp; sourceTree = "<group>"; };
B219B8570E9381AC00EAB407 /* IOWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOWrapper.h; path = src/IOWrapper.h; sourceTree = "<group>"; };
@ -70,6 +86,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1CE646E411679F6900EC77CC /* libOnDiskPt.a in Frameworks */,
B219B8540E93812700EAB407 /* libmoses.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -88,6 +105,7 @@
08FB7794FE84155DC02AAC07 /* moses-cmd */ = {
isa = PBXGroup;
children = (
1CE646DB11679F5F00EC77CC /* OnDiskPt.xcodeproj */,
03306D5F0C0B240B00CA1311 /* moses.xcodeproj */,
08FB7795FE84155DC02AAC07 /* Source */,
C6859E8C029090F304C91782 /* Documentation */,
@ -121,6 +139,14 @@
name = Products;
sourceTree = "<group>";
};
1CE646DC11679F5F00EC77CC /* Products */ = {
isa = PBXGroup;
children = (
1CE646E311679F5F00EC77CC /* libOnDiskPt.a */,
);
name = Products;
sourceTree = "<group>";
};
C6859E8C029090F304C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
@ -143,6 +169,7 @@
);
dependencies = (
03306D780C0B244800CA1311 /* PBXTargetDependency */,
1CE6472E1167A11600EC77CC /* PBXTargetDependency */,
);
name = "moses-cmd";
productInstallPath = "$(HOME)/bin";
@ -165,6 +192,10 @@
ProductGroup = 03306D600C0B240B00CA1311 /* Products */;
ProjectRef = 03306D5F0C0B240B00CA1311 /* moses.xcodeproj */;
},
{
ProductGroup = 1CE646DC11679F5F00EC77CC /* Products */;
ProjectRef = 1CE646DB11679F5F00EC77CC /* OnDiskPt.xcodeproj */;
},
);
projectRoot = "";
targets = (
@ -181,6 +212,13 @@
remoteRef = 03306D660C0B240B00CA1311 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1CE646E311679F5F00EC77CC /* libOnDiskPt.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libOnDiskPt.a;
remoteRef = 1CE646E211679F5F00EC77CC /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXSourcesBuildPhase section */
@ -204,6 +242,11 @@
name = moses;
targetProxy = 03306D770C0B244800CA1311 /* PBXContainerItemProxy */;
};
1CE6472E1167A11600EC77CC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = OnDiskPt;
targetProxy = 1CE6472D1167A11600EC77CC /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */

View File

@ -1,4 +1,4 @@
// $Id: $
// $Id: LatticeMBRGrid.cpp 3045 2010-04-05 13:07:29Z hieuhoang1972 $
/***********************************************************************
Moses - factored phrase-based language decoder

View File

@ -1,4 +1,4 @@
// $Id: $
// $Id: MainMT.cpp 3045 2010-04-05 13:07:29Z hieuhoang1972 $
/***********************************************************************
Moses - factored phrase-based language decoder

View File

@ -7,10 +7,10 @@ endif
AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUSE_HYPO_POOL -I$(top_srcdir)/moses/src $(BOOST_CPPFLAGS)
moses_SOURCES = Main.cpp mbr.cpp IOWrapper.cpp TranslationAnalysis.cpp LatticeMBR.cpp
moses_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
moses_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt
mosesmt_SOURCES = MainMT.cpp mbr.cpp IOWrapper.cpp TranslationAnalysis.cpp ThreadPool.cpp LatticeMBR.cpp
mosesmt_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
mosesmt_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt
lmbrgrid_SOURCES = LatticeMBRGrid.cpp LatticeMBR.cpp IOWrapper.cpp
lmbrgrid_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
lmbrgrid_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt

View File

@ -1,4 +1,4 @@
// $Id: $
// $Id: ThreadPool.cpp 3045 2010-04-05 13:07:29Z hieuhoang1972 $
/***********************************************************************
Moses - factored phrase-based language decoder

View File

@ -1,4 +1,4 @@
// $Id: $
// $Id: ThreadPool.h 3045 2010-04-05 13:07:29Z hieuhoang1972 $
/***********************************************************************
Moses - factored phrase-based language decoder

129
moses.sln
View File

@ -1,63 +1,146 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses", "moses\moses.vcproj", "{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-cmd", "moses-cmd\moses-cmd.vcproj", "{5BBAC701-84F5-438E-8F54-B3391F451F2A}"
ProjectSection(ProjectDependencies) = postProject
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF} = {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "processLexicalTable", "misc\processLexicalTable.vcproj", "{9834EABB-2033-4607-9DAC-36D16E0725B5}"
ProjectSection(ProjectDependencies) = postProject
{8B07671B-CBAF-4514-AFFD-CE238CD427E9} = {8B07671B-CBAF-4514-AFFD-CE238CD427E9}
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF} = {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "processPhraseTable", "misc\processPhraseTable.vcproj", "{AA230564-6DF1-4662-9BF9-7AD73DE53B76}"
ProjectSection(ProjectDependencies) = postProject
{8B07671B-CBAF-4514-AFFD-CE238CD427E9} = {8B07671B-CBAF-4514-AFFD-CE238CD427E9}
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF} = {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses", "moses\moses.vcproj", "{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-chart", "moses-chart\moses-chart.vcproj", "{C877DCA8-B4C0-4357-B6AE-34575B3D3328}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-chart-cmd", "moses-chart-cmd\moses-chart-cmd.vcproj", "{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}"
ProjectSection(ProjectDependencies) = postProject
{8B07671B-CBAF-4514-AFFD-CE238CD427E9} = {8B07671B-CBAF-4514-AFFD-CE238CD427E9}
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF} = {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}
{C877DCA8-B4C0-4357-B6AE-34575B3D3328} = {C877DCA8-B4C0-4357-B6AE-34575B3D3328}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-cmd", "moses-cmd\moses-cmd.vcproj", "{E2233DB1-5592-46FE-9420-E529420612FA}"
ProjectSection(ProjectDependencies) = postProject
{8B07671B-CBAF-4514-AFFD-CE238CD427E9} = {8B07671B-CBAF-4514-AFFD-CE238CD427E9}
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF} = {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OnDiskPt", "OnDiskPt\OnDiskPt.vcproj", "{8B07671B-CBAF-4514-AFFD-CE238CD427E9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CreateOnDisk", "CreateOnDisk\CreateOnDisk.vcproj", "{88AE90C9-72D2-42ED-8389-770ACDCD4308}"
ProjectSection(ProjectDependencies) = postProject
{8B07671B-CBAF-4514-AFFD-CE238CD427E9} = {8B07671B-CBAF-4514-AFFD-CE238CD427E9}
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF} = {8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}
{C877DCA8-B4C0-4357-B6AE-34575B3D3328} = {C877DCA8-B4C0-4357-B6AE-34575B3D3328}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
DebugNoObjPool|Win32 = DebugNoObjPool|Win32
Debug-withSRILM|Win32 = Debug-withSRILM|Win32
Release|Win32 = Release|Win32
ReleaseNoObjPool|Win32 = ReleaseNoObjPool|Win32
Release-withSRILM|Win32 = Release-withSRILM|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug|Win32.ActiveCfg = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug|Win32.Build.0 = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug-withSRILM|Win32.ActiveCfg = Debug-withSRILM|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug-withSRILM|Win32.Build.0 = Debug-withSRILM|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release|Win32.ActiveCfg = Release|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release|Win32.Build.0 = Release|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release-withSRILM|Win32.ActiveCfg = Release-withSRILM|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release-withSRILM|Win32.Build.0 = Release-withSRILM|Win32
{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}.Debug-withSRILM|Win32.ActiveCfg = Debug-withSRILM|Win32
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Debug-withSRILM|Win32.Build.0 = Debug-withSRILM|Win32
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release|Win32.ActiveCfg = Release|Win32
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release|Win32.Build.0 = Release|Win32
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release-withSRILM|Win32.ActiveCfg = Release-withSRILM|Win32
{5BBAC701-84F5-438E-8F54-B3391F451F2A}.Release-withSRILM|Win32.Build.0 = Release-withSRILM|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Debug|Win32.ActiveCfg = Debug|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Debug|Win32.Build.0 = Debug|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.DebugNoObjPool|Win32.ActiveCfg = Debug-withSRILM|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Debug-withSRILM|Win32.ActiveCfg = Debug-withSRILM|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Debug-withSRILM|Win32.Build.0 = Debug-withSRILM|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Release|Win32.ActiveCfg = Release|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Release|Win32.Build.0 = Release|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.ReleaseNoObjPool|Win32.ActiveCfg = Release-withSRILM|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Release-withSRILM|Win32.ActiveCfg = Release-withSRILM|Win32
{9834EABB-2033-4607-9DAC-36D16E0725B5}.Release-withSRILM|Win32.Build.0 = Release-withSRILM|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Debug|Win32.ActiveCfg = Debug|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Debug|Win32.Build.0 = Debug|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.DebugNoObjPool|Win32.ActiveCfg = Debug-withSRILM|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Debug-withSRILM|Win32.ActiveCfg = Debug-withSRILM|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Debug-withSRILM|Win32.Build.0 = Debug-withSRILM|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Release|Win32.ActiveCfg = Release|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Release|Win32.Build.0 = Release|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.ReleaseNoObjPool|Win32.ActiveCfg = Release-withSRILM|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Release-withSRILM|Win32.ActiveCfg = Release-withSRILM|Win32
{AA230564-6DF1-4662-9BF9-7AD73DE53B76}.Release-withSRILM|Win32.Build.0 = Release-withSRILM|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug|Win32.ActiveCfg = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug|Win32.Build.0 = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.DebugNoObjPool|Win32.ActiveCfg = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.DebugNoObjPool|Win32.Build.0 = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug-withSRILM|Win32.ActiveCfg = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Debug-withSRILM|Win32.Build.0 = Debug|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release|Win32.ActiveCfg = Release|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release|Win32.Build.0 = Release|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.ReleaseNoObjPool|Win32.ActiveCfg = Release|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.ReleaseNoObjPool|Win32.Build.0 = Release|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release-withSRILM|Win32.ActiveCfg = Release|Win32
{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}.Release-withSRILM|Win32.Build.0 = Release|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Debug|Win32.ActiveCfg = Debug|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Debug|Win32.Build.0 = Debug|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.DebugNoObjPool|Win32.ActiveCfg = Debug|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.DebugNoObjPool|Win32.Build.0 = Debug|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Debug-withSRILM|Win32.ActiveCfg = Debug|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Debug-withSRILM|Win32.Build.0 = Debug|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Release|Win32.ActiveCfg = Release|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Release|Win32.Build.0 = Release|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.ReleaseNoObjPool|Win32.ActiveCfg = Release|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.ReleaseNoObjPool|Win32.Build.0 = Release|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Release-withSRILM|Win32.ActiveCfg = Release|Win32
{C877DCA8-B4C0-4357-B6AE-34575B3D3328}.Release-withSRILM|Win32.Build.0 = Release|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Debug|Win32.ActiveCfg = Debug|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Debug|Win32.Build.0 = Debug|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.DebugNoObjPool|Win32.ActiveCfg = Debug|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.DebugNoObjPool|Win32.Build.0 = Debug|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Debug-withSRILM|Win32.ActiveCfg = Debug|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Debug-withSRILM|Win32.Build.0 = Debug|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Release|Win32.ActiveCfg = Release|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Release|Win32.Build.0 = Release|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.ReleaseNoObjPool|Win32.ActiveCfg = Release|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.ReleaseNoObjPool|Win32.Build.0 = Release|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Release-withSRILM|Win32.ActiveCfg = Release|Win32
{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}.Release-withSRILM|Win32.Build.0 = Release|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Debug|Win32.ActiveCfg = Debug|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Debug|Win32.Build.0 = Debug|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.DebugNoObjPool|Win32.ActiveCfg = Debug|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.DebugNoObjPool|Win32.Build.0 = Debug|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Debug-withSRILM|Win32.ActiveCfg = Debug|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Debug-withSRILM|Win32.Build.0 = Debug|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Release|Win32.ActiveCfg = Release|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Release|Win32.Build.0 = Release|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.ReleaseNoObjPool|Win32.ActiveCfg = Release|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.ReleaseNoObjPool|Win32.Build.0 = Release|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Release-withSRILM|Win32.ActiveCfg = Release|Win32
{E2233DB1-5592-46FE-9420-E529420612FA}.Release-withSRILM|Win32.Build.0 = Release|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Debug|Win32.ActiveCfg = Debug|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Debug|Win32.Build.0 = Debug|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.DebugNoObjPool|Win32.ActiveCfg = Debug|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.DebugNoObjPool|Win32.Build.0 = Debug|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Debug-withSRILM|Win32.ActiveCfg = Debug|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Debug-withSRILM|Win32.Build.0 = Debug|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Release|Win32.ActiveCfg = Release|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Release|Win32.Build.0 = Release|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.ReleaseNoObjPool|Win32.ActiveCfg = Release|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.ReleaseNoObjPool|Win32.Build.0 = Release|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Release-withSRILM|Win32.ActiveCfg = Release|Win32
{8B07671B-CBAF-4514-AFFD-CE238CD427E9}.Release-withSRILM|Win32.Build.0 = Release|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Debug|Win32.ActiveCfg = Debug|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Debug|Win32.Build.0 = Debug|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.DebugNoObjPool|Win32.ActiveCfg = Debug|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.DebugNoObjPool|Win32.Build.0 = Debug|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Debug-withSRILM|Win32.ActiveCfg = Debug|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Debug-withSRILM|Win32.Build.0 = Debug|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Release|Win32.ActiveCfg = Release|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Release|Win32.Build.0 = Release|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.ReleaseNoObjPool|Win32.ActiveCfg = Release|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.ReleaseNoObjPool|Win32.Build.0 = Release|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Release-withSRILM|Win32.ActiveCfg = Release|Win32
{88AE90C9-72D2-42ED-8389-770ACDCD4308}.Release-withSRILM|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -283,10 +283,22 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\AlignmentInfo.cpp"
>
</File>
<File
RelativePath=".\src\BitmapContainer.cpp"
>
</File>
<File
RelativePath=".\src\ChartRule.cpp"
>
</File>
<File
RelativePath=".\src\ChartRuleCollection.cpp"
>
</File>
<File
RelativePath=".\src\ConfusionNet.cpp"
>
@ -311,6 +323,14 @@
RelativePath=".\src\Dictionary.cpp"
>
</File>
<File
RelativePath=".\src\DotChart.cpp"
>
</File>
<File
RelativePath=".\src\DotChartOnDisk.cpp"
>
</File>
<File
RelativePath=".\src\DummyScoreProducers.cpp"
>
@ -515,6 +535,14 @@
RelativePath=".\src\PhraseDictionaryMemory.cpp"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryNewFormat.cpp"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryNewFormatChart.cpp"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryNode.cpp"
>
@ -555,6 +583,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\PhraseDictionaryNodeNewFormat.cpp"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryOnDisk.cpp"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryOnDiskChart.cpp"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryTree.cpp"
>
@ -647,6 +687,10 @@
RelativePath=".\src\TranslationOptionList.cpp"
>
</File>
<File
RelativePath=".\src\TreeInput.cpp"
>
</File>
<File
RelativePath=".\src\TrellisPath.cpp"
>
@ -667,6 +711,10 @@
RelativePath=".\src\Word.cpp"
>
</File>
<File
RelativePath=".\src\WordConsumed.cpp"
>
</File>
<File
RelativePath=".\src\WordLattice.cpp"
>
@ -689,10 +737,26 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\AlignmentInfo.h"
>
</File>
<File
RelativePath=".\src\BitmapContainer.h"
>
</File>
<File
RelativePath=".\src\CellCollection.h"
>
</File>
<File
RelativePath=".\src\ChartRule.h"
>
</File>
<File
RelativePath=".\src\ChartRuleCollection.h"
>
</File>
<File
RelativePath=".\src\ConfusionNet.h"
>
@ -717,6 +781,14 @@
RelativePath=".\src\Dictionary.h"
>
</File>
<File
RelativePath=".\src\DotChart.h"
>
</File>
<File
RelativePath=".\src\DotChartOnDisk.h"
>
</File>
<File
RelativePath=".\src\DummyScoreProducers.h"
>
@ -885,10 +957,22 @@
RelativePath=".\src\PhraseDictionaryMemory.h"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryNewFormat.h"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryNode.h"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryNodeNewFormat.h"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryOnDisk.h"
>
</File>
<File
RelativePath=".\src\PhraseDictionaryTree.h"
>
@ -985,6 +1069,10 @@
RelativePath=".\src\TranslationOptionList.h"
>
</File>
<File
RelativePath=".\src\TreeInput.h"
>
</File>
<File
RelativePath=".\src\TrellisPath.h"
>
@ -1013,6 +1101,10 @@
RelativePath=".\src\Word.h"
>
</File>
<File
RelativePath=".\src\WordConsumed.h"
>
</File>
<File
RelativePath=".\src\WordLattice.h"
>

View File

@ -30,6 +30,7 @@
1C5009C00FB9E09700DFD24F /* FeatureFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C5009BC0FB9E09700DFD24F /* FeatureFunction.h */; };
1C5009C10FB9E09700DFD24F /* FFState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C5009BD0FB9E09700DFD24F /* FFState.cpp */; };
1C5009C20FB9E09700DFD24F /* FFState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C5009BE0FB9E09700DFD24F /* FFState.h */; };
1C66276E116A05BF0063ACB8 /* PhraseDictionaryNewFormatChart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C66276D116A05BF0063ACB8 /* PhraseDictionaryNewFormatChart.cpp */; };
1C679DC81162099C00DC3892 /* LexicalReorderingState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C679DC21162099C00DC3892 /* LexicalReorderingState.cpp */; };
1C679DC91162099C00DC3892 /* LexicalReorderingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C679DC31162099C00DC3892 /* LexicalReorderingState.h */; };
1C679DCC1162099C00DC3892 /* ReorderingStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C679DC61162099C00DC3892 /* ReorderingStack.cpp */; };
@ -139,8 +140,31 @@
1C8CFF090AD67A9700FA22E2 /* WordsBitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8CFE8C0AD67A9700FA22E2 /* WordsBitmap.h */; };
1C8CFF0A0AD67A9700FA22E2 /* WordsRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8CFE8D0AD67A9700FA22E2 /* WordsRange.cpp */; };
1C8CFF0B0AD67A9700FA22E2 /* WordsRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8CFE8E0AD67A9700FA22E2 /* WordsRange.h */; };
1CB22CD911676E3D0083E5A6 /* PhraseDictionaryNewFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CB22CD611676E3D0083E5A6 /* PhraseDictionaryNewFormat.cpp */; };
1CB22CDA11676E3D0083E5A6 /* PhraseDictionaryNewFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CB22CD711676E3D0083E5A6 /* PhraseDictionaryNewFormat.h */; };
1CB459EA0FD2DFEC000030BE /* GlobalLexicalModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CB459E80FD2DFEC000030BE /* GlobalLexicalModel.cpp */; };
1CB459EB0FD2DFEC000030BE /* GlobalLexicalModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CB459E90FD2DFEC000030BE /* GlobalLexicalModel.h */; };
1CD82FB3116B336200AF05C2 /* TreeInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD82FB2116B336100AF05C2 /* TreeInput.cpp */; };
1CD83169116B66FB00AF05C2 /* LanguageModelRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD83167116B66FB00AF05C2 /* LanguageModelRemote.cpp */; };
1CD8316A116B66FB00AF05C2 /* LanguageModelRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD83168116B66FB00AF05C2 /* LanguageModelRemote.h */; };
1CD9808B11678B5D002BE765 /* AlignmentInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD9808911678B5D002BE765 /* AlignmentInfo.cpp */; };
1CD9808C11678B5D002BE765 /* AlignmentInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD9808A11678B5D002BE765 /* AlignmentInfo.h */; };
1CD9809811678B7C002BE765 /* CellCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD9809211678B7C002BE765 /* CellCollection.h */; };
1CD9809A11678B7C002BE765 /* ChartRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD9809411678B7C002BE765 /* ChartRule.cpp */; };
1CD9809B11678B7C002BE765 /* ChartRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD9809511678B7C002BE765 /* ChartRule.h */; };
1CD9809C11678B7C002BE765 /* ChartRuleCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD9809611678B7C002BE765 /* ChartRuleCollection.cpp */; };
1CD9809D11678B7C002BE765 /* ChartRuleCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD9809711678B7C002BE765 /* ChartRuleCollection.h */; };
1CD9815811679309002BE765 /* PhraseDictionaryNodeNewFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD9815611679309002BE765 /* PhraseDictionaryNodeNewFormat.cpp */; };
1CD9815911679309002BE765 /* PhraseDictionaryNodeNewFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD9815711679309002BE765 /* PhraseDictionaryNodeNewFormat.h */; };
1CD981B2116793AB002BE765 /* DotChart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD981B0116793AB002BE765 /* DotChart.cpp */; };
1CD981B3116793AB002BE765 /* DotChart.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD981B1116793AB002BE765 /* DotChart.h */; };
1CD981DE116795D6002BE765 /* WordConsumed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CD981DC116795D6002BE765 /* WordConsumed.cpp */; };
1CD981DF116795D6002BE765 /* WordConsumed.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD981DD116795D6002BE765 /* WordConsumed.h */; };
1CE646AE11679D8D00EC77CC /* PhraseDictionaryOnDisk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CE646AC11679D8D00EC77CC /* PhraseDictionaryOnDisk.cpp */; };
1CE646AF11679D8D00EC77CC /* PhraseDictionaryOnDisk.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CE646AD11679D8D00EC77CC /* PhraseDictionaryOnDisk.h */; };
1CE646E811679F9200EC77CC /* DotChartOnDisk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CE646E611679F9200EC77CC /* DotChartOnDisk.cpp */; };
1CE646E911679F9200EC77CC /* DotChartOnDisk.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CE646E711679F9200EC77CC /* DotChartOnDisk.h */; };
1CE646EF11679FC700EC77CC /* PhraseDictionaryOnDiskChart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CE646EE11679FC700EC77CC /* PhraseDictionaryOnDiskChart.cpp */; };
B219B8690E93836100EAB407 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B219B8680E93836100EAB407 /* Timer.cpp */; };
B23821380EB73DCB007303C3 /* LanguageModelIRST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B23821360EB73DCB007303C3 /* LanguageModelIRST.cpp */; };
B23821390EB73DCB007303C3 /* LanguageModelIRST.h in Headers */ = {isa = PBXBuildFile; fileRef = B23821370EB73DCB007303C3 /* LanguageModelIRST.h */; };
@ -201,6 +225,7 @@
1C5009BC0FB9E09700DFD24F /* FeatureFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FeatureFunction.h; path = src/FeatureFunction.h; sourceTree = "<group>"; };
1C5009BD0FB9E09700DFD24F /* FFState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FFState.cpp; path = src/FFState.cpp; sourceTree = "<group>"; };
1C5009BE0FB9E09700DFD24F /* FFState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FFState.h; path = src/FFState.h; sourceTree = "<group>"; };
1C66276D116A05BF0063ACB8 /* PhraseDictionaryNewFormatChart.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionaryNewFormatChart.cpp; path = src/PhraseDictionaryNewFormatChart.cpp; sourceTree = "<group>"; };
1C679DC21162099C00DC3892 /* LexicalReorderingState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexicalReorderingState.cpp; path = src/LexicalReorderingState.cpp; sourceTree = "<group>"; };
1C679DC31162099C00DC3892 /* LexicalReorderingState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexicalReorderingState.h; path = src/LexicalReorderingState.h; sourceTree = "<group>"; };
1C679DC61162099C00DC3892 /* ReorderingStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ReorderingStack.cpp; path = src/ReorderingStack.cpp; sourceTree = "<group>"; };
@ -310,8 +335,31 @@
1C8CFE8C0AD67A9700FA22E2 /* WordsBitmap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = WordsBitmap.h; path = src/WordsBitmap.h; sourceTree = "<group>"; };
1C8CFE8D0AD67A9700FA22E2 /* WordsRange.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = WordsRange.cpp; path = src/WordsRange.cpp; sourceTree = "<group>"; };
1C8CFE8E0AD67A9700FA22E2 /* WordsRange.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = WordsRange.h; path = src/WordsRange.h; sourceTree = "<group>"; };
1CB22CD611676E3D0083E5A6 /* PhraseDictionaryNewFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionaryNewFormat.cpp; path = src/PhraseDictionaryNewFormat.cpp; sourceTree = "<group>"; };
1CB22CD711676E3D0083E5A6 /* PhraseDictionaryNewFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhraseDictionaryNewFormat.h; path = src/PhraseDictionaryNewFormat.h; sourceTree = "<group>"; };
1CB459E80FD2DFEC000030BE /* GlobalLexicalModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GlobalLexicalModel.cpp; path = src/GlobalLexicalModel.cpp; sourceTree = "<group>"; };
1CB459E90FD2DFEC000030BE /* GlobalLexicalModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GlobalLexicalModel.h; path = src/GlobalLexicalModel.h; sourceTree = "<group>"; };
1CD82FB2116B336100AF05C2 /* TreeInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TreeInput.cpp; path = src/TreeInput.cpp; sourceTree = "<group>"; };
1CD83167116B66FB00AF05C2 /* LanguageModelRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LanguageModelRemote.cpp; path = src/LanguageModelRemote.cpp; sourceTree = "<group>"; };
1CD83168116B66FB00AF05C2 /* LanguageModelRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LanguageModelRemote.h; path = src/LanguageModelRemote.h; sourceTree = "<group>"; };
1CD9808911678B5D002BE765 /* AlignmentInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AlignmentInfo.cpp; path = src/AlignmentInfo.cpp; sourceTree = "<group>"; };
1CD9808A11678B5D002BE765 /* AlignmentInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AlignmentInfo.h; path = src/AlignmentInfo.h; sourceTree = "<group>"; };
1CD9809211678B7C002BE765 /* CellCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CellCollection.h; path = src/CellCollection.h; sourceTree = "<group>"; };
1CD9809411678B7C002BE765 /* ChartRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartRule.cpp; path = src/ChartRule.cpp; sourceTree = "<group>"; };
1CD9809511678B7C002BE765 /* ChartRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartRule.h; path = src/ChartRule.h; sourceTree = "<group>"; };
1CD9809611678B7C002BE765 /* ChartRuleCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartRuleCollection.cpp; path = src/ChartRuleCollection.cpp; sourceTree = "<group>"; };
1CD9809711678B7C002BE765 /* ChartRuleCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartRuleCollection.h; path = src/ChartRuleCollection.h; sourceTree = "<group>"; };
1CD9815611679309002BE765 /* PhraseDictionaryNodeNewFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionaryNodeNewFormat.cpp; path = src/PhraseDictionaryNodeNewFormat.cpp; sourceTree = "<group>"; };
1CD9815711679309002BE765 /* PhraseDictionaryNodeNewFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhraseDictionaryNodeNewFormat.h; path = src/PhraseDictionaryNodeNewFormat.h; sourceTree = "<group>"; };
1CD981B0116793AB002BE765 /* DotChart.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DotChart.cpp; path = src/DotChart.cpp; sourceTree = "<group>"; };
1CD981B1116793AB002BE765 /* DotChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DotChart.h; path = src/DotChart.h; sourceTree = "<group>"; };
1CD981DC116795D6002BE765 /* WordConsumed.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WordConsumed.cpp; path = src/WordConsumed.cpp; sourceTree = "<group>"; };
1CD981DD116795D6002BE765 /* WordConsumed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordConsumed.h; path = src/WordConsumed.h; sourceTree = "<group>"; };
1CE646AC11679D8D00EC77CC /* PhraseDictionaryOnDisk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionaryOnDisk.cpp; path = src/PhraseDictionaryOnDisk.cpp; sourceTree = "<group>"; };
1CE646AD11679D8D00EC77CC /* PhraseDictionaryOnDisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhraseDictionaryOnDisk.h; path = src/PhraseDictionaryOnDisk.h; sourceTree = "<group>"; };
1CE646E611679F9200EC77CC /* DotChartOnDisk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DotChartOnDisk.cpp; path = src/DotChartOnDisk.cpp; sourceTree = "<group>"; };
1CE646E711679F9200EC77CC /* DotChartOnDisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DotChartOnDisk.h; path = src/DotChartOnDisk.h; sourceTree = "<group>"; };
1CE646EE11679FC700EC77CC /* PhraseDictionaryOnDiskChart.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PhraseDictionaryOnDiskChart.cpp; path = src/PhraseDictionaryOnDiskChart.cpp; sourceTree = "<group>"; };
B219B8680E93836100EAB407 /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Timer.cpp; path = src/Timer.cpp; sourceTree = "<group>"; };
B23821360EB73DCB007303C3 /* LanguageModelIRST.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LanguageModelIRST.cpp; path = src/LanguageModelIRST.cpp; sourceTree = "<group>"; };
B23821370EB73DCB007303C3 /* LanguageModelIRST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LanguageModelIRST.h; path = src/LanguageModelIRST.h; sourceTree = "<group>"; };
@ -374,12 +422,15 @@
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
1C679DC21162099C00DC3892 /* LexicalReorderingState.cpp */,
1C679DC31162099C00DC3892 /* LexicalReorderingState.h */,
1C679DC61162099C00DC3892 /* ReorderingStack.cpp */,
1C679DC71162099C00DC3892 /* ReorderingStack.h */,
1CD9808911678B5D002BE765 /* AlignmentInfo.cpp */,
1CD9808A11678B5D002BE765 /* AlignmentInfo.h */,
E2B7C9580DDB1AEF0089EFE0 /* BitmapContainer.cpp */,
E2B7C8F00DDA19190089EFE0 /* BitmapContainer.h */,
1CD9809211678B7C002BE765 /* CellCollection.h */,
1CD9809411678B7C002BE765 /* ChartRule.cpp */,
1CD9809511678B7C002BE765 /* ChartRule.h */,
1CD9809611678B7C002BE765 /* ChartRuleCollection.cpp */,
1CD9809711678B7C002BE765 /* ChartRuleCollection.h */,
1C8CFE120AD67A9600FA22E2 /* ConfusionNet.cpp */,
1C8CFE130AD67A9600FA22E2 /* ConfusionNet.h */,
037C63980C8EBFB400584F2E /* DecodeGraph.cpp */,
@ -392,6 +443,10 @@
1C8CFE190AD67A9700FA22E2 /* DecodeStepTranslation.h */,
1C8CFE1A0AD67A9700FA22E2 /* Dictionary.cpp */,
1C8CFE1B0AD67A9700FA22E2 /* Dictionary.h */,
1CD981B0116793AB002BE765 /* DotChart.cpp */,
1CD981B1116793AB002BE765 /* DotChart.h */,
1CE646E611679F9200EC77CC /* DotChartOnDisk.cpp */,
1CE646E711679F9200EC77CC /* DotChartOnDisk.h */,
1C8CFE1C0AD67A9700FA22E2 /* DummyScoreProducers.cpp */,
1C8CFE1D0AD67A9700FA22E2 /* DummyScoreProducers.h */,
1C8CFE1E0AD67A9700FA22E2 /* Factor.cpp */,
@ -440,6 +495,8 @@
1C8CFE3E0AD67A9700FA22E2 /* LanguageModelJoint.h */,
1C8CFE3F0AD67A9700FA22E2 /* LanguageModelMultiFactor.cpp */,
1C8CFE400AD67A9700FA22E2 /* LanguageModelMultiFactor.h */,
1CD83167116B66FB00AF05C2 /* LanguageModelRemote.cpp */,
1CD83168116B66FB00AF05C2 /* LanguageModelRemote.h */,
1C8CFE410AD67A9700FA22E2 /* LanguageModelSingleFactor.cpp */,
1C8CFE420AD67A9700FA22E2 /* LanguageModelSingleFactor.h */,
D39BA8270AFBB7090089AE6A /* LanguageModelSkip.cpp */,
@ -448,6 +505,8 @@
1C8CFE440AD67A9700FA22E2 /* LanguageModelSRI.h */,
1C8CFE490AD67A9700FA22E2 /* LexicalReordering.cpp */,
1C8CFE4A0AD67A9700FA22E2 /* LexicalReordering.h */,
1C679DC21162099C00DC3892 /* LexicalReorderingState.cpp */,
1C679DC31162099C00DC3892 /* LexicalReorderingState.h */,
0396E1980C0B189200D95CFF /* LexicalReorderingTable.cpp */,
0396E1990C0B189200D95CFF /* LexicalReorderingTable.h */,
1C8CFE4B0AD67A9700FA22E2 /* LMList.cpp */,
@ -475,8 +534,16 @@
1C8CFE5C0AD67A9700FA22E2 /* PhraseDictionary.h */,
D39BA8290AFBB7090089AE6A /* PhraseDictionaryMemory.cpp */,
D39BA82A0AFBB7090089AE6A /* PhraseDictionaryMemory.h */,
1CB22CD611676E3D0083E5A6 /* PhraseDictionaryNewFormat.cpp */,
1CB22CD711676E3D0083E5A6 /* PhraseDictionaryNewFormat.h */,
1C66276D116A05BF0063ACB8 /* PhraseDictionaryNewFormatChart.cpp */,
1C8CFE5F0AD67A9700FA22E2 /* PhraseDictionaryNode.cpp */,
1C8CFE600AD67A9700FA22E2 /* PhraseDictionaryNode.h */,
1CD9815611679309002BE765 /* PhraseDictionaryNodeNewFormat.cpp */,
1CD9815711679309002BE765 /* PhraseDictionaryNodeNewFormat.h */,
1CE646AC11679D8D00EC77CC /* PhraseDictionaryOnDisk.cpp */,
1CE646AD11679D8D00EC77CC /* PhraseDictionaryOnDisk.h */,
1CE646EE11679FC700EC77CC /* PhraseDictionaryOnDiskChart.cpp */,
1C8CFE610AD67A9700FA22E2 /* PhraseDictionaryTree.cpp */,
1C8CFE620AD67A9700FA22E2 /* PhraseDictionaryTree.h */,
1C8CFE630AD67A9700FA22E2 /* PhraseDictionaryTreeAdaptor.cpp */,
@ -486,6 +553,8 @@
0396E19F0C0B189200D95CFF /* PrefixTreeMap.h */,
B2639DE60EF199D400A67519 /* ReorderingConstraint.cpp */,
B2639DE70EF199D400A67519 /* ReorderingConstraint.h */,
1C679DC61162099C00DC3892 /* ReorderingStack.cpp */,
1C679DC71162099C00DC3892 /* ReorderingStack.h */,
1C8CFE680AD67A9700FA22E2 /* ScoreComponentCollection.cpp */,
1C8CFE690AD67A9700FA22E2 /* ScoreComponentCollection.h */,
1C8CFE6A0AD67A9700FA22E2 /* ScoreIndexManager.cpp */,
@ -522,6 +591,7 @@
1C8CFE820AD67A9700FA22E2 /* TranslationOptionCollectionText.h */,
B2639DE80EF199D400A67519 /* TranslationOptionList.cpp */,
B2639DE90EF199D400A67519 /* TranslationOptionList.h */,
1CD82FB2116B336100AF05C2 /* TreeInput.cpp */,
0396E1A00C0B189200D95CFF /* TrellisPath.cpp */,
0396E1A10C0B189200D95CFF /* TrellisPath.h */,
0396E1A20C0B189200D95CFF /* TrellisPathCollection.cpp */,
@ -535,6 +605,8 @@
1C8CFE880AD67A9700FA22E2 /* Util.h */,
1C8CFE890AD67A9700FA22E2 /* Word.cpp */,
1C8CFE8A0AD67A9700FA22E2 /* Word.h */,
1CD981DC116795D6002BE765 /* WordConsumed.cpp */,
1CD981DD116795D6002BE765 /* WordConsumed.h */,
0396E1A50C0B189200D95CFF /* WordLattice.cpp */,
0396E1A60C0B189200D95CFF /* WordLattice.h */,
1C8CFE8B0AD67A9700FA22E2 /* WordsBitmap.cpp */,
@ -657,6 +729,17 @@
1CB459EB0FD2DFEC000030BE /* GlobalLexicalModel.h in Headers */,
1C679DC91162099C00DC3892 /* LexicalReorderingState.h in Headers */,
1C679DCD1162099C00DC3892 /* ReorderingStack.h in Headers */,
1CB22CDA11676E3D0083E5A6 /* PhraseDictionaryNewFormat.h in Headers */,
1CD9808C11678B5D002BE765 /* AlignmentInfo.h in Headers */,
1CD9809811678B7C002BE765 /* CellCollection.h in Headers */,
1CD9809B11678B7C002BE765 /* ChartRule.h in Headers */,
1CD9809D11678B7C002BE765 /* ChartRuleCollection.h in Headers */,
1CD9815911679309002BE765 /* PhraseDictionaryNodeNewFormat.h in Headers */,
1CD981B3116793AB002BE765 /* DotChart.h in Headers */,
1CD981DF116795D6002BE765 /* WordConsumed.h in Headers */,
1CE646AF11679D8D00EC77CC /* PhraseDictionaryOnDisk.h in Headers */,
1CE646E911679F9200EC77CC /* DotChartOnDisk.h in Headers */,
1CD8316A116B66FB00AF05C2 /* LanguageModelRemote.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -782,6 +865,19 @@
1CB459EA0FD2DFEC000030BE /* GlobalLexicalModel.cpp in Sources */,
1C679DC81162099C00DC3892 /* LexicalReorderingState.cpp in Sources */,
1C679DCC1162099C00DC3892 /* ReorderingStack.cpp in Sources */,
1CB22CD911676E3D0083E5A6 /* PhraseDictionaryNewFormat.cpp in Sources */,
1CD9808B11678B5D002BE765 /* AlignmentInfo.cpp in Sources */,
1CD9809A11678B7C002BE765 /* ChartRule.cpp in Sources */,
1CD9809C11678B7C002BE765 /* ChartRuleCollection.cpp in Sources */,
1CD9815811679309002BE765 /* PhraseDictionaryNodeNewFormat.cpp in Sources */,
1CD981B2116793AB002BE765 /* DotChart.cpp in Sources */,
1CD981DE116795D6002BE765 /* WordConsumed.cpp in Sources */,
1CE646AE11679D8D00EC77CC /* PhraseDictionaryOnDisk.cpp in Sources */,
1CE646E811679F9200EC77CC /* DotChartOnDisk.cpp in Sources */,
1CE646EF11679FC700EC77CC /* PhraseDictionaryOnDiskChart.cpp in Sources */,
1C66276E116A05BF0063ACB8 /* PhraseDictionaryNewFormatChart.cpp in Sources */,
1CD82FB3116B336200AF05C2 /* TreeInput.cpp in Sources */,
1CD83169116B66FB00AF05C2 /* LanguageModelRemote.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -0,0 +1,24 @@
// $Id: AlignmentInfo.cpp 3048 2010-04-05 17:25:26Z hieuhoang1972 $
#include "AlignmentInfo.h"
namespace Moses
{
std::ostream& operator<<(std::ostream &out, const AlignmentInfo &alignmentInfo)
{
AlignmentInfo::const_iterator iter;
for (iter = alignmentInfo.begin(); iter != alignmentInfo.end(); ++iter)
{
out << "(" << iter->first << "," << iter->second << ") ";
}
return out;
}
void AlignmentInfo::AddAlignment(const std::list<std::pair<size_t,size_t> > &alignmentPairs)
{
m_collection = alignmentPairs;
m_collection.sort();
}
}

29
moses/src/AlignmentInfo.h Normal file
View File

@ -0,0 +1,29 @@
// $Id: AlignmentInfo.h 3048 2010-04-05 17:25:26Z hieuhoang1972 $
#pragma once
#include <list>
#include <ostream>
namespace Moses
{
// Collection of alignment pairs, ordered by source index
class AlignmentInfo
{
friend std::ostream& operator<<(std::ostream&, const AlignmentInfo&);
protected:
typedef std::list<std::pair<size_t,size_t> > CollType;
CollType m_collection;
public:
typedef CollType::iterator iterator;
typedef CollType::const_iterator const_iterator;
const_iterator begin() const { return m_collection.begin(); }
const_iterator end() const { return m_collection.end(); }
void AddAlignment(const std::list<std::pair<size_t,size_t> > &alignmentList);
};
};

View File

@ -0,0 +1,20 @@
// $Id: CellCollection.h 3048 2010-04-05 17:25:26Z hieuhoang1972 $
#pragma once
#include <vector>
namespace Moses
{
class Word;
class CellCollection
{
public:
virtual ~CellCollection()
{}
virtual const std::vector<Word> &GetHeadwords(const Moses::WordsRange &coverage) const = 0;
};
}

44
moses/src/ChartRule.cpp Normal file
View File

@ -0,0 +1,44 @@
// $Id: ChartRule.cpp 3048 2010-04-05 17:25:26Z hieuhoang1972 $
#include "ChartRule.h"
#include "TargetPhrase.h"
#include "AlignmentInfo.h"
#include "WordConsumed.h"
using namespace std;
namespace Moses
{
void ChartRule::CreateNonTermIndex()
{
m_wordsConsumedTargetOrder.resize(m_targetPhrase.GetSize(), NOT_FOUND);
const AlignmentInfo &alignInfo = m_targetPhrase.GetAlignmentInfo();
size_t nonTermInd = 0;
size_t prevSourcePos = 0;
AlignmentInfo::const_iterator iter;
for (iter = alignInfo.begin(); iter != alignInfo.end(); ++iter)
{
// alignment pairs must be ordered by source index
size_t sourcePos = iter->first;
if (nonTermInd > 0)
{
assert(sourcePos > prevSourcePos);
}
prevSourcePos = sourcePos;
size_t targetPos = iter->second;
m_wordsConsumedTargetOrder[targetPos] = nonTermInd;
nonTermInd++;
}
}
std::ostream& operator<<(std::ostream &out, const ChartRule &rule)
{
out << rule.m_targetPhrase << " " << rule.m_lastWordConsumed;
return out;
}
} // namespace

56
moses/src/ChartRule.h Normal file
View File

@ -0,0 +1,56 @@
// $Id: ChartRule.h 3048 2010-04-05 17:25:26Z hieuhoang1972 $
#pragma once
#include <cassert>
#include <vector>
#include "Word.h"
#include "WordsRange.h"
#include "TargetPhrase.h"
namespace Moses
{
class WordConsumed;
// basically a phrase translation and the vector of words consumed to map each word
class ChartRule
{
friend std::ostream& operator<<(std::ostream&, const ChartRule&);
protected:
const Moses::TargetPhrase &m_targetPhrase;
const WordConsumed &m_lastWordConsumed;
/* map each source word in the phrase table to:
1. a word in the input sentence, if the pt word is a terminal
2. a 1+ phrase in the input sentence, if the pt word is a non-terminal
*/
std::vector<size_t> m_wordsConsumedTargetOrder;
/* size is the size of the target phrase.
Usually filled with NOT_KNOWN, unless the pos is a non-term, in which case its filled
with its index
*/
ChartRule(const ChartRule &copy); // not implmenented
public:
ChartRule(const TargetPhrase &targetPhrase, const WordConsumed &lastWordConsumed)
:m_targetPhrase(targetPhrase)
,m_lastWordConsumed(lastWordConsumed)
{}
~ChartRule()
{}
const TargetPhrase &GetTargetPhrase() const
{ return m_targetPhrase; }
const WordConsumed &GetLastWordConsumed() const
{
return m_lastWordConsumed;
}
const std::vector<size_t> &GetWordsConsumedTargetOrder() const
{ return m_wordsConsumedTargetOrder; }
void CreateNonTermIndex();
};
}

Some files were not shown because too many files have changed in this diff Show More