Create a subdirectory in moses/src for the main CYK+ source files.

This commit is contained in:
Phil Williams 2012-01-25 23:14:36 +00:00
parent d0af7167f8
commit 039bd5bd4c
22 changed files with 72 additions and 67 deletions

View File

@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "ChartTrellisPath.h"
#include "ChartTranslationOption.h"
#include "ChartHypothesis.h"
#include "DotChart.h"
using namespace std;

View File

@ -53,7 +53,6 @@ void ChartRuleLookupManagerCYKPlus::AddCompletedRule(
node = &dottedRule;
while (rank > 0) {
if (node->IsNonTerminal()) {
// add the score of the best underlying hypothesis
const ChartCellLabel &cellLabel = node->GetChartCellLabel();
const HypoList *stack = cellLabel.GetStack();
assert(stack);

View File

@ -0,0 +1 @@
lib CYKPlusParser : [ glob *.cpp ] ..//headers ;

View File

@ -1,18 +0,0 @@
//
// ChartRuleLookupManager.cpp
// moses
//
// Created by Hieu Hoang on 30/06/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include "ChartRuleLookupManager.h"
#include "StaticData.h"
#include "DotChart.h"
namespace Moses
{
}

View File

@ -25,7 +25,6 @@
#include "StaticData.h"
#include "DecodeStep.h"
#include "DummyScoreProducers.h"
#include "DotChart.h"
#include "Util.h"
using namespace std;

View File

@ -1,4 +1,3 @@
// $Id$
// vim:tabstop=2
/***********************************************************************
Moses - factored phrase-based language decoder
@ -25,7 +24,6 @@
#include "ChartTrellisDetour.h"
#include "ChartTrellisPath.h"
#include "StaticData.h"
#include "DotChart.h"
namespace Moses
{

View File

@ -14,4 +14,4 @@ if [ option.get "with-synlm" : no : yes ] = yes
lib moses :
#All cpp files except those listed
[ glob *.cpp DynSAInclude/*.cpp : ThreadPool.cpp SyntacticLanguageModel.cpp ]
synlm ThreadPool LM//LM RuleTable//RuleTable headers ../..//z ../../OnDiskPt//OnDiskPt ;
synlm ThreadPool CYKPlusParser//CYKPlusParser LM//LM RuleTable//RuleTable headers ../..//z ../../OnDiskPt//OnDiskPt ;

View File

@ -1,4 +1,3 @@
// $Id$
// vim:tabstop=2
/***********************************************************************
@ -29,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <ostream>
#include "Word.h"
#include "TargetPhraseCollection.h"
#include "Terminal.h"
#include <boost/functional/hash.hpp>
#include <boost/unordered_map.hpp>
@ -39,42 +39,6 @@ namespace Moses
class PhraseDictionarySCFG;
class TerminalHasher
{
public:
// Generate a hash value for a word representing a terminal. It's
// assumed that the same subset of factors will be active for all words
// that are hashed.
size_t operator()(const Word & t) const {
size_t seed = 0;
for (size_t i = 0; i < MAX_NUM_FACTORS; ++i) {
const Factor * f = t[i];
if (f) {
boost::hash_combine(seed, *f);
}
}
return seed;
}
};
class TerminalEqualityPred
{
public:
// Equality predicate for comparing words representing terminals. As
// with the hasher, it's assumed that all words will have the same
// subset of active factors.
bool operator()(const Word & t1, const Word & t2) const {
for (size_t i = 0; i < MAX_NUM_FACTORS; ++i) {
const Factor * f1 = t1[i];
const Factor * f2 = t2[i];
if (f1 && f1->Compare(*f2)) {
return false;
}
}
return true;
}
};
class NonTerminalMapKeyHasher
{
public:

View File

@ -1,4 +1,3 @@
// $Id$
// vim:tabstop=2
/***********************************************************************
Moses - factored phrase-based language decoder
@ -23,8 +22,8 @@
#include "InputFileStream.h"
#include "StaticData.h"
#include "TargetPhraseCollection.h"
#include "DotChartOnDisk.h"
#include "ChartRuleLookupManagerOnDisk.h"
#include "CYKPlusParser/DotChartOnDisk.h"
#include "CYKPlusParser/ChartRuleLookupManagerOnDisk.h"
using namespace std;

View File

@ -1,4 +1,3 @@
// $Id$
// vim:tabstop=2
/***********************************************************************
@ -34,7 +33,7 @@
#include "StaticData.h"
#include "WordsRange.h"
#include "UserMessage.h"
#include "ChartRuleLookupManagerMemory.h"
#include "CYKPlusParser/ChartRuleLookupManagerMemory.h"
using namespace std;

View File

@ -33,7 +33,6 @@
#include "WordsRange.h"
#include "UserMessage.h"
#include "ChartTranslationOptionList.h"
#include "DotChart.h"
#include "FactorCollection.h"
using namespace std;

66
moses/src/Terminal.h Normal file
View File

@ -0,0 +1,66 @@
/***********************************************************************
Moses - statistical machine translation system
Copyright (C) 2006-2012 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
#include "TypeDef.h"
#include "Word.h"
#include <boost/functional/hash.hpp>
namespace Moses
{
class TerminalHasher
{
public:
// Generate a hash value for a word representing a terminal. It's
// assumed that the same subset of factors will be active for all words
// that are hashed.
size_t operator()(const Word &t) const {
size_t seed = 0;
for (size_t i = 0; i < MAX_NUM_FACTORS; ++i) {
const Factor *f = t[i];
if (f) {
boost::hash_combine(seed, *f);
}
}
return seed;
}
};
class TerminalEqualityPred
{
public:
// Equality predicate for comparing words representing terminals. As
// with the hasher, it's assumed that all words will have the same
// subset of active factors.
bool operator()(const Word &t1, const Word &t2) const {
for (size_t i = 0; i < MAX_NUM_FACTORS; ++i) {
const Factor *f1 = t1[i];
const Factor *f2 = t2[i];
if (f1 && f1->Compare(*f2)) {
return false;
}
}
return true;
}
};
} // namespace Moses