2012-07-18 15:46:59 +04:00
|
|
|
/***********************************************************************
|
|
|
|
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
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
/* Created by Rohit Gupta, CDAC, Mumbai, India on 18 July, 2012*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#ifndef PHRASEEXTRACTIONOPTIONS_H_INCLUDED_
|
|
|
|
#define PHRASEEXTRACTIONOPTIONS_H_INCLUDED_
|
|
|
|
|
|
|
|
namespace MosesTraining
|
|
|
|
{
|
|
|
|
enum REO_MODEL_TYPE {REO_MSD, REO_MSLR, REO_MONO};
|
|
|
|
enum REO_POS {LEFT, RIGHT, DLEFT, DRIGHT, UNKNOWN};
|
|
|
|
|
|
|
|
|
|
|
|
class PhraseExtractionOptions {
|
|
|
|
|
|
|
|
public:
|
|
|
|
const int maxPhraseLength;
|
|
|
|
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
|
2012-07-18 15:46:59 +04:00
|
|
|
bool onlyOutputSpanInfo;
|
|
|
|
bool gzOutput;
|
2012-12-21 19:39:25 +04:00
|
|
|
std::string instanceWeightsFile; //weights for each sentence
|
2012-07-18 15:46:59 +04:00
|
|
|
|
|
|
|
public:
|
|
|
|
PhraseExtractionOptions(const int initmaxPhraseLength):
|
|
|
|
maxPhraseLength(initmaxPhraseLength),
|
|
|
|
allModelsOutputFlag(false),
|
|
|
|
wordModel(false),
|
|
|
|
wordType(REO_MSD),
|
|
|
|
phraseModel(false),
|
|
|
|
phraseType(REO_MSD),
|
|
|
|
hierModel(false),
|
|
|
|
hierType(REO_MSD),
|
|
|
|
orientationFlag(false),
|
|
|
|
translationFlag(true),
|
2012-09-03 10:24:07 +04:00
|
|
|
includeSentenceIdFlag(false),
|
2012-07-18 15:46:59 +04:00
|
|
|
onlyOutputSpanInfo(false),
|
|
|
|
gzOutput(false){}
|
|
|
|
|
|
|
|
//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;
|
|
|
|
}
|
2012-09-03 10:24:07 +04:00
|
|
|
void initIncludeSentenceIdFlag(const bool initincludeSentenceIdFlag){
|
2012-09-12 23:02:57 +04:00
|
|
|
includeSentenceIdFlag=initincludeSentenceIdFlag;
|
2012-09-03 10:24:07 +04:00
|
|
|
}
|
2012-07-18 15:46:59 +04:00
|
|
|
void initOnlyOutputSpanInfo(const bool initonlyOutputSpanInfo){
|
|
|
|
onlyOutputSpanInfo= initonlyOutputSpanInfo;
|
|
|
|
}
|
|
|
|
void initGzOutput (const bool initgzOutput){
|
|
|
|
gzOutput= initgzOutput;
|
2012-12-21 19:39:25 +04:00
|
|
|
}
|
|
|
|
void initInstanceWeightsFile(const char* initInstanceWeightsFile) {
|
|
|
|
instanceWeightsFile = std::string(initInstanceWeightsFile);
|
|
|
|
}
|
|
|
|
|
2012-07-18 15:46:59 +04:00
|
|
|
// functions for getting values
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isAllModelsOutputFlag() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return allModelsOutputFlag;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isWordModel() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return wordModel;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
REO_MODEL_TYPE isWordType() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return wordType;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isPhraseModel() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return phraseModel;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
REO_MODEL_TYPE isPhraseType() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return phraseType;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isHierModel() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return hierModel;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
REO_MODEL_TYPE isHierType() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return hierType;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isOrientationFlag() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return orientationFlag;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isTranslationFlag() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return translationFlag;
|
|
|
|
}
|
2012-09-03 10:24:07 +04:00
|
|
|
bool isIncludeSentenceIdFlag() const {
|
|
|
|
return includeSentenceIdFlag;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isOnlyOutputSpanInfo() const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return onlyOutputSpanInfo;
|
|
|
|
}
|
2012-08-01 02:34:53 +04:00
|
|
|
bool isGzOutput () const {
|
2012-07-18 15:46:59 +04:00
|
|
|
return gzOutput;
|
2012-12-21 19:39:25 +04:00
|
|
|
}
|
|
|
|
std::string getInstanceWeightsFile() const {
|
|
|
|
return instanceWeightsFile;
|
|
|
|
}
|
2012-07-18 15:46:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|