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

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/moses
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@Hieus-MacBook.local>2011-10-30 16:17:15 +0400
committerHieu Hoang <hieuhoang@Hieus-MacBook.local>2011-10-30 16:17:15 +0400
commitb6b697c54505ef905b6e349fb9360af04d4d845c (patch)
tree1f5b837cfec23d1302205834d188f311e0f68862 /moses
parentfdd6c9795d532acb11e552582d3dc2d2ab3d20c3 (diff)
xcode
Diffstat (limited to 'moses')
-rw-r--r--moses/moses.xcodeproj/project.pbxproj16
-rw-r--r--moses/src/Makefile.am4
-rw-r--r--moses/src/PCNTools.cpp6
-rw-r--r--moses/src/PCNTools.h4
-rw-r--r--moses/src/StaticData.cpp34
-rw-r--r--moses/src/TypeDef.h2
-rw-r--r--moses/src/WeightedDirectedGraph.cpp9
-rw-r--r--moses/src/WeightedDirectedGraph.h26
-rw-r--r--moses/src/WordLattice2.cpp60
-rw-r--r--moses/src/WordLattice2.h48
10 files changed, 194 insertions, 15 deletions
diff --git a/moses/moses.xcodeproj/project.pbxproj b/moses/moses.xcodeproj/project.pbxproj
index 8fa2c75a1..700ffde39 100644
--- a/moses/moses.xcodeproj/project.pbxproj
+++ b/moses/moses.xcodeproj/project.pbxproj
@@ -60,6 +60,10 @@
1E2E163D132A892800ED4085 /* RuleCubeQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E2E1636132A892800ED4085 /* RuleCubeQueue.h */; };
1E2E163E132A892800ED4085 /* ThreadPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E2E1637132A892800ED4085 /* ThreadPool.cpp */; };
1E2E163F132A892800ED4085 /* ThreadPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E2E1638132A892800ED4085 /* ThreadPool.h */; };
+ 1E3CBD3A145D755D00AF72FC /* WordLattice2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E3CBD38145D755D00AF72FC /* WordLattice2.cpp */; };
+ 1E3CBD3B145D755D00AF72FC /* WordLattice2.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E3CBD39145D755D00AF72FC /* WordLattice2.h */; };
+ 1E3CBD3F145D75F300AF72FC /* WeightedDirectedGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E3CBD3D145D75F300AF72FC /* WeightedDirectedGraph.cpp */; };
+ 1E3CBD40145D75F300AF72FC /* WeightedDirectedGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E3CBD3E145D75F300AF72FC /* WeightedDirectedGraph.h */; };
1E46B5A613BA5C7F0084F898 /* RuleCubeItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1E46B5A413BA5C7F0084F898 /* RuleCubeItem.cpp */; };
1E46B5A713BA5C7F0084F898 /* RuleCubeItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E46B5A513BA5C7F0084F898 /* RuleCubeItem.h */; };
1E474E12145575CA00178AD5 /* RuleTableLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E474E11145575CA00178AD5 /* RuleTableLoader.h */; };
@@ -322,6 +326,10 @@
1E2E1636132A892800ED4085 /* RuleCubeQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuleCubeQueue.h; path = src/RuleCubeQueue.h; sourceTree = "<group>"; };
1E2E1637132A892800ED4085 /* ThreadPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPool.cpp; path = src/ThreadPool.cpp; sourceTree = "<group>"; };
1E2E1638132A892800ED4085 /* ThreadPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPool.h; path = src/ThreadPool.h; sourceTree = "<group>"; };
+ 1E3CBD38145D755D00AF72FC /* WordLattice2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WordLattice2.cpp; path = src/WordLattice2.cpp; sourceTree = "<group>"; };
+ 1E3CBD39145D755D00AF72FC /* WordLattice2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordLattice2.h; path = src/WordLattice2.h; sourceTree = "<group>"; };
+ 1E3CBD3D145D75F300AF72FC /* WeightedDirectedGraph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WeightedDirectedGraph.cpp; path = src/WeightedDirectedGraph.cpp; sourceTree = "<group>"; };
+ 1E3CBD3E145D75F300AF72FC /* WeightedDirectedGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WeightedDirectedGraph.h; path = src/WeightedDirectedGraph.h; sourceTree = "<group>"; };
1E46B5A413BA5C7F0084F898 /* RuleCubeItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RuleCubeItem.cpp; path = src/RuleCubeItem.cpp; sourceTree = "<group>"; };
1E46B5A513BA5C7F0084F898 /* RuleCubeItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuleCubeItem.h; path = src/RuleCubeItem.h; sourceTree = "<group>"; };
1E474E11145575CA00178AD5 /* RuleTableLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuleTableLoader.h; path = src/RuleTableLoader.h; sourceTree = "<group>"; };
@@ -557,6 +565,10 @@
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
+ 1E3CBD3D145D75F300AF72FC /* WeightedDirectedGraph.cpp */,
+ 1E3CBD3E145D75F300AF72FC /* WeightedDirectedGraph.h */,
+ 1E3CBD38145D755D00AF72FC /* WordLattice2.cpp */,
+ 1E3CBD39145D755D00AF72FC /* WordLattice2.h */,
1E474E11145575CA00178AD5 /* RuleTableLoader.h */,
1E16D086144DAA3F00B60B4F /* LM */,
1ED0FD4C124BB9380029177F /* AlignmentInfo.cpp */,
@@ -1000,6 +1012,8 @@
1E16D0BC144DAA6C00B60B4F /* SingleFactor.h in Headers */,
1E16D0BE144DAA6C00B60B4F /* SRI.h in Headers */,
1E474E12145575CA00178AD5 /* RuleTableLoader.h in Headers */,
+ 1E3CBD3B145D755D00AF72FC /* WordLattice2.h in Headers */,
+ 1E3CBD40145D75F300AF72FC /* WeightedDirectedGraph.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1175,6 +1189,8 @@
1E16D0B5144DAA6C00B60B4F /* ParallelBackoff.cpp in Sources */,
1E16D0BB144DAA6C00B60B4F /* SingleFactor.cpp in Sources */,
1E16D0BD144DAA6C00B60B4F /* SRI.cpp in Sources */,
+ 1E3CBD3A145D755D00AF72FC /* WordLattice2.cpp in Sources */,
+ 1E3CBD3F145D75F300AF72FC /* WeightedDirectedGraph.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/moses/src/Makefile.am b/moses/src/Makefile.am
index 769219e96..8642f92ec 100644
--- a/moses/src/Makefile.am
+++ b/moses/src/Makefile.am
@@ -125,8 +125,10 @@ libmoses_la_HEADERS = \
UniqueObject.h \
UserMessage.h \
Util.h \
+ WeightedDirectedGraph.h \
Word.h \
WordLattice.h \
+ WordLattice2.h \
WordsBitmap.h \
WordsRange.h \
XmlOption.h
@@ -270,8 +272,10 @@ libmoses_la_SOURCES = \
TrellisPathCollection.cpp \
UserMessage.cpp \
Util.cpp \
+ WeightedDirectedGraph.cpp \
Word.cpp \
WordLattice.cpp \
+ WordLattice2.cpp \
WordsBitmap.cpp \
WordsRange.cpp \
XmlOption.cpp
diff --git a/moses/src/PCNTools.cpp b/moses/src/PCNTools.cpp
index b28b0b65b..356ae094f 100644
--- a/moses/src/PCNTools.cpp
+++ b/moses/src/PCNTools.cpp
@@ -165,5 +165,11 @@ CN parsePCN(const std::string& in)
return res;
}
+Moses::WeightedDirectedGraph parseLattice(const std::string& in)
+{
+ return Moses::WeightedDirectedGraph();
+
+}
+
}
diff --git a/moses/src/PCNTools.h b/moses/src/PCNTools.h
index 84f2144bd..13af2b650 100644
--- a/moses/src/PCNTools.h
+++ b/moses/src/PCNTools.h
@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <string>
#include <utility>
#include <cstdlib>
+#include "WeightedDirectedGraph.h"
/** A couple of utilities to read .pcn files. A python-compatible format
* for encoding confusion networks and word lattices.
@@ -36,11 +37,12 @@ namespace PCN
typedef std::pair<std::pair<std::string, std::vector<float> >, size_t> CNAlt;
typedef std::vector<CNAlt> CNCol;
typedef std::vector<CNCol> CN;
-
+
/** Given a string ((('foo',0.1,1),('bar',0.9,2)),...) representation of a
* word lattice in PCN format, return a CN object representing the lattice
*/
CN parsePCN(const std::string& in);
+Moses::WeightedDirectedGraph parseLattice(const std::string& in);
};
diff --git a/moses/src/StaticData.cpp b/moses/src/StaticData.cpp
index cb938c19b..8eefb3798 100644
--- a/moses/src/StaticData.cpp
+++ b/moses/src/StaticData.cpp
@@ -991,25 +991,31 @@ bool StaticData::LoadPhraseTables()
// it only work with binrary file. This is a hack
m_numInputScores=m_parameter->GetParam("weight-i").size();
- for(unsigned k=0; k<m_numInputScores; ++k)
- weight.push_back(Scan<float>(m_parameter->GetParam("weight-i")[k]));
-
+
+ if (implementation == Binary)
+ {
+ for(unsigned k=0; k<m_numInputScores; ++k)
+ weight.push_back(Scan<float>(m_parameter->GetParam("weight-i")[k]));
+ }
+
if(m_parameter->GetParam("link-param-count").size())
m_numLinkParams = Scan<size_t>(m_parameter->GetParam("link-param-count")[0]);
//print some info about this interaction:
- if (m_numLinkParams == m_numInputScores) {
- VERBOSE(1,"specified equal numbers of link parameters and insertion weights, not using non-epsilon 'real' word link count.\n");
- } else if ((m_numLinkParams + 1) == m_numInputScores) {
- VERBOSE(1,"WARN: "<< m_numInputScores << " insertion weights found and only "<< m_numLinkParams << " link parameters specified, applying non-epsilon 'real' word link count for last feature weight.\n");
- } else {
- stringstream strme;
- strme << "You specified " << m_numInputScores
- << " input weights (weight-i), but you specified " << m_numLinkParams << " link parameters (link-param-count)!";
- UserMessage::Add(strme.str());
- return false;
+ if (implementation == Binary) {
+ if (m_numLinkParams == m_numInputScores) {
+ VERBOSE(1,"specified equal numbers of link parameters and insertion weights, not using non-epsilon 'real' word link count.\n");
+ } else if ((m_numLinkParams + 1) == m_numInputScores) {
+ VERBOSE(1,"WARN: "<< m_numInputScores << " insertion weights found and only "<< m_numLinkParams << " link parameters specified, applying non-epsilon 'real' word link count for last feature weight.\n");
+ } else {
+ stringstream strme;
+ strme << "You specified " << m_numInputScores
+ << " input weights (weight-i), but you specified " << m_numLinkParams << " link parameters (link-param-count)!";
+ UserMessage::Add(strme.str());
+ return false;
+ }
}
-
+
}
if (!m_inputType) {
m_numInputScores=0;
diff --git a/moses/src/TypeDef.h b/moses/src/TypeDef.h
index 0b0f24f6f..a40c79baa 100644
--- a/moses/src/TypeDef.h
+++ b/moses/src/TypeDef.h
@@ -181,6 +181,8 @@ enum InputTypeEnum {
,ConfusionNetworkInput = 1
,WordLatticeInput = 2
,TreeInputType = 3
+ ,WordLatticeInput2 = 4
+
};
enum XmlInputType {
diff --git a/moses/src/WeightedDirectedGraph.cpp b/moses/src/WeightedDirectedGraph.cpp
new file mode 100644
index 000000000..b947063d3
--- /dev/null
+++ b/moses/src/WeightedDirectedGraph.cpp
@@ -0,0 +1,9 @@
+//
+// WeightedDirectedGraph.cpp
+// moses
+//
+// Created by Hieu Hoang on 30/10/2011.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#include <iostream>
diff --git a/moses/src/WeightedDirectedGraph.h b/moses/src/WeightedDirectedGraph.h
new file mode 100644
index 000000000..caf52144f
--- /dev/null
+++ b/moses/src/WeightedDirectedGraph.h
@@ -0,0 +1,26 @@
+//
+// WeightedDirectedGraph.h
+// moses
+//
+// Created by Hieu Hoang on 30/10/2011.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#ifndef moses_WeightedDirectedGraph_h
+#define moses_WeightedDirectedGraph_h
+
+namespace Moses {
+
+class WeightedDirectedGraphNode
+{
+
+};
+
+class WeightedDirectedGraph
+{
+
+
+};
+
+}
+#endif
diff --git a/moses/src/WordLattice2.cpp b/moses/src/WordLattice2.cpp
new file mode 100644
index 000000000..cbbfe5a9e
--- /dev/null
+++ b/moses/src/WordLattice2.cpp
@@ -0,0 +1,60 @@
+//
+// WordLattice2.cpp
+// moses
+//
+// Created by Hieu Hoang on 30/10/2011.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#include <iostream>
+#include "WordLattice2.h"
+#include "PCNTools.h"
+
+using namespace std;
+
+namespace Moses
+{
+size_t WordLattice2::GetSize() const
+{
+
+}
+
+int WordLattice2::Read(std::istream& in,const std::vector<FactorType>& factorOrder)
+{
+ std::string line;
+ if(!getline(in,line)) return 0;
+
+ PCN::parseLattice(line);
+
+}
+
+void WordLattice2::Print(std::ostream&) const
+{
+
+}
+
+//! create trans options specific to this InputType
+TranslationOptionCollection* WordLattice2::CreateTranslationOptionCollection(const TranslationSystem* system) const
+{
+
+}
+
+//! return substring. Only valid for Sentence class. TODO - get rid of this fn
+Phrase WordLattice2::GetSubString(const WordsRange&) const
+{
+
+}
+
+//! return substring at a particular position. Only valid for Sentence class. TODO - get rid of this fn
+const Word& WordLattice2::GetWord(size_t pos) const
+{
+
+}
+
+const NonTerminalSet &WordLattice2::GetLabelSet(size_t startPos, size_t endPos) const
+{
+
+}
+
+}
+
diff --git a/moses/src/WordLattice2.h b/moses/src/WordLattice2.h
new file mode 100644
index 000000000..79244585f
--- /dev/null
+++ b/moses/src/WordLattice2.h
@@ -0,0 +1,48 @@
+//
+// WordLattice2.h
+// moses
+//
+// Created by Hieu Hoang on 30/10/2011.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#ifndef moses_WordLattice2_h
+#define moses_WordLattice2_h
+
+#include "InputType.h"
+
+namespace Moses
+{
+
+class WordLattice2 : public InputType
+{
+
+public:
+ InputTypeEnum GetType() const
+ { return WordLatticeInput2; }
+
+ virtual size_t GetSize() const;
+
+ //! populate this InputType with data from in stream
+ virtual int Read(std::istream& in,const std::vector<FactorType>& factorOrder);
+
+ //! Output debugging info to stream out
+ virtual void Print(std::ostream&) const;
+
+ //! create trans options specific to this InputType
+ virtual TranslationOptionCollection* CreateTranslationOptionCollection(const TranslationSystem* system) const;
+
+ //! return substring. Only valid for Sentence class. TODO - get rid of this fn
+ virtual Phrase GetSubString(const WordsRange&) const;
+
+ //! return substring at a particular position. Only valid for Sentence class. TODO - get rid of this fn
+ virtual const Word& GetWord(size_t pos) const;
+
+ virtual const NonTerminalSet &GetLabelSet(size_t startPos, size_t endPos) const;
+
+
+};
+
+}
+
+#endif