mosesdecoder/phrase-extract/PhraseExtractionOptions.h

170 lines
4.6 KiB
C
Raw Normal View History

2013-07-26 17:12:27 +04:00
#pragma once
/***********************************************************************
Moses - factored phrase-based language decoder
Copyright (C) 2010 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
***********************************************************************/
2013-07-26 17:12:27 +04:00
#include <string>
#include <vector>
namespace MosesTraining
{
enum REO_MODEL_TYPE {REO_MSD, REO_MSLR, REO_MONO};
enum REO_POS {LEFT, RIGHT, DLEFT, DRIGHT, UNKNOWN};
2013-05-29 21:16:15 +04:00
class PhraseExtractionOptions
{
public:
int maxPhraseLength;
int minPhraseLength;
2014-01-06 22:03:38 +04:00
std::string separator;
2013-05-29 21:16:15 +04:00
private:
bool allModelsOutputFlag;
bool wordModel;
REO_MODEL_TYPE wordType;
bool phraseModel;
REO_MODEL_TYPE phraseType;
bool hierModel;
REO_MODEL_TYPE hierType;
bool orientationFlag;
bool translationFlag;
2012-09-03 10:24:07 +04:00
bool includeSentenceIdFlag; //include sentence id in extract file
bool onlyOutputSpanInfo;
bool gzOutput;
std::string instanceWeightsFile; //weights for each sentence
2013-09-08 01:04:01 +04:00
bool flexScoreFlag;
2013-05-29 21:16:15 +04:00
public:
2013-07-26 17:12:27 +04:00
std::vector<std::string> placeholders;
2013-10-05 13:48:01 +04:00
bool debug;
2013-07-26 17:12:27 +04:00
PhraseExtractionOptions(const int initmaxPhraseLength):
2013-05-29 21:16:15 +04:00
maxPhraseLength(initmaxPhraseLength),
minPhraseLength(3),
2014-01-06 22:03:38 +04:00
separator("|||"),
2013-05-29 21:16:15 +04:00
allModelsOutputFlag(false),
wordModel(false),
wordType(REO_MSD),
phraseModel(false),
phraseType(REO_MSD),
hierModel(false),
hierType(REO_MSD),
orientationFlag(false),
translationFlag(true),
includeSentenceIdFlag(false),
onlyOutputSpanInfo(false),
2013-09-08 01:04:01 +04:00
gzOutput(false),
2013-10-05 13:48:01 +04:00
flexScoreFlag(false),
debug(false)
{}
2013-05-29 21:16:15 +04:00
//functions for initialization of options
void initAllModelsOutputFlag(const bool initallModelsOutputFlag) {
allModelsOutputFlag=initallModelsOutputFlag;
}
void initWordModel(const bool initwordModel) {
wordModel=initwordModel;
}
void initWordType(REO_MODEL_TYPE initwordType ) {
wordType=initwordType;
}
void initPhraseModel(const bool initphraseModel ) {
phraseModel=initphraseModel;
}
void initPhraseType(REO_MODEL_TYPE initphraseType) {
phraseType=initphraseType;
}
void initHierModel(const bool inithierModel) {
hierModel=inithierModel;
}
void initHierType(REO_MODEL_TYPE inithierType) {
hierType=inithierType;
}
void initOrientationFlag(const bool initorientationFlag) {
orientationFlag=initorientationFlag;
}
void initTranslationFlag(const bool inittranslationFlag) {
translationFlag=inittranslationFlag;
}
void initIncludeSentenceIdFlag(const bool initincludeSentenceIdFlag) {
includeSentenceIdFlag=initincludeSentenceIdFlag;
}
void initOnlyOutputSpanInfo(const bool initonlyOutputSpanInfo) {
onlyOutputSpanInfo= initonlyOutputSpanInfo;
}
void initGzOutput (const bool initgzOutput) {
gzOutput= initgzOutput;
}
void initInstanceWeightsFile(const char* initInstanceWeightsFile) {
instanceWeightsFile = std::string(initInstanceWeightsFile);
}
2013-09-27 12:35:24 +04:00
void initFlexScoreFlag(const bool initflexScoreFlag) {
2013-09-08 01:04:01 +04:00
flexScoreFlag=initflexScoreFlag;
}
2013-05-29 21:16:15 +04:00
// functions for getting values
bool isAllModelsOutputFlag() const {
return allModelsOutputFlag;
}
bool isWordModel() const {
return wordModel;
}
REO_MODEL_TYPE isWordType() const {
return wordType;
}
bool isPhraseModel() const {
return phraseModel;
}
REO_MODEL_TYPE isPhraseType() const {
return phraseType;
}
bool isHierModel() const {
return hierModel;
}
REO_MODEL_TYPE isHierType() const {
return hierType;
}
bool isOrientationFlag() const {
return orientationFlag;
}
bool isTranslationFlag() const {
return translationFlag;
}
bool isIncludeSentenceIdFlag() const {
return includeSentenceIdFlag;
}
bool isOnlyOutputSpanInfo() const {
return onlyOutputSpanInfo;
}
bool isGzOutput () const {
return gzOutput;
}
std::string getInstanceWeightsFile() const {
return instanceWeightsFile;
}
2013-09-08 01:04:01 +04:00
bool isFlexScoreFlag() const {
return flexScoreFlag;
}
};
}