summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/argument_reorder_model.cc38
-rw-r--r--utils/constituent_reorder_model.cc50
-rw-r--r--utils/srl_sentence.h5
-rw-r--r--utils/tree.h8
4 files changed, 50 insertions, 51 deletions
diff --git a/utils/argument_reorder_model.cc b/utils/argument_reorder_model.cc
index 58886251..537dfb20 100644
--- a/utils/argument_reorder_model.cc
+++ b/utils/argument_reorder_model.cc
@@ -64,13 +64,13 @@ inline void fnPreparingTrainingdata(const char* pszFName, int iCutoff,
struct SArgumentReorderTrainer {
SArgumentReorderTrainer(
- const char* pszSRLFname, // source-side srl tree file name
- const char* pszAlignFname, // alignment filename
- const char* pszSourceFname, // source file name
- const char* pszTargetFname, // target file name
+ const char* pszSRLFname, // source-side srl tree file name
+ const char* pszAlignFname, // alignment filename
+ const char* pszSourceFname, // source file name
+ const char* pszTargetFname, // target file name
const char* pszTopPredicateFname, // target file name
- const char* pszInstanceFname, // training instance file name
- const char* pszModelFname, // classifier model file name
+ const char* pszInstanceFname, // training instance file name
+ const char* pszModelFname, // classifier model file name
int iCutoff) {
fnGenerateInstanceFiles(pszSRLFname, pszAlignFname, pszSourceFname,
pszTargetFname, pszTopPredicateFname,
@@ -110,14 +110,14 @@ struct SArgumentReorderTrainer {
}
void fnGenerateInstanceFiles(
- const char* pszSRLFname, // source-side flattened parse tree file name
- const char* pszAlignFname, // alignment filename
+ const char* pszSRLFname, // source-side flattened parse tree file name
+ const char* pszAlignFname, // alignment filename
const char* pszSourceFname, // source file name
const char* pszTargetFname, // target file name
const char* pszTopPredicateFname, // top predicate file name (we only
// consider predicates with 100+
// occurrences
- const char* pszInstanceFname // training instance file name
+ const char* pszInstanceFname // training instance file name
) {
SAlignmentReader* pAlignReader = new SAlignmentReader(pszAlignFname);
SSrlSentenceReader* pSRLReader = new SSrlSentenceReader(pszSRLFname);
@@ -264,17 +264,17 @@ inline string str(char const* name, po::variables_map const& conf) {
}
//--srl_file /scratch0/mt_exp/gale-align/gale-align.nw.srl.cn --align_file
-///scratch0/mt_exp/gale-align/gale-align.nw.al --source_file
-///scratch0/mt_exp/gale-align/gale-align.nw.cn --target_file
-///scratch0/mt_exp/gale-align/gale-align.nw.en --instance_file
-///scratch0/mt_exp/gale-align/gale-align.nw.argreorder.instance --model_prefix
-///scratch0/mt_exp/gale-align/gale-align.nw.argreorder.model --feature_cutoff 2
+/// scratch0/mt_exp/gale-align/gale-align.nw.al --source_file
+/// scratch0/mt_exp/gale-align/gale-align.nw.cn --target_file
+/// scratch0/mt_exp/gale-align/gale-align.nw.en --instance_file
+/// scratch0/mt_exp/gale-align/gale-align.nw.argreorder.instance --model_prefix
+/// scratch0/mt_exp/gale-align/gale-align.nw.argreorder.model --feature_cutoff 2
//--srl_file /scratch0/mt_exp/gale-ctb/gale-ctb.srl.cn --align_file
-///scratch0/mt_exp/gale-ctb/gale-ctb.align --source_file
-///scratch0/mt_exp/gale-ctb/gale-ctb.cn --target_file
-///scratch0/mt_exp/gale-ctb/gale-ctb.en0 --instance_file
-///scratch0/mt_exp/gale-ctb/gale-ctb.argreorder.instance --model_prefix
-///scratch0/mt_exp/gale-ctb/gale-ctb.argreorder.model --feature_cutoff 2
+/// scratch0/mt_exp/gale-ctb/gale-ctb.align --source_file
+/// scratch0/mt_exp/gale-ctb/gale-ctb.cn --target_file
+/// scratch0/mt_exp/gale-ctb/gale-ctb.en0 --instance_file
+/// scratch0/mt_exp/gale-ctb/gale-ctb.argreorder.instance --model_prefix
+/// scratch0/mt_exp/gale-ctb/gale-ctb.argreorder.model --feature_cutoff 2
int main(int argc, char** argv) {
po::options_description opts("Configuration options");
diff --git a/utils/constituent_reorder_model.cc b/utils/constituent_reorder_model.cc
index 042c751b..d5c1cf5b 100644
--- a/utils/constituent_reorder_model.cc
+++ b/utils/constituent_reorder_model.cc
@@ -73,14 +73,14 @@ inline void fnPreparingTrainingdata(const char* pszFName, int iCutoff,
struct SConstReorderTrainer {
SConstReorderTrainer(
- const char* pszSynFname, // source-side flattened parse tree file name
- const char* pszAlignFname, // alignment filename
+ const char* pszSynFname, // source-side flattened parse tree file name
+ const char* pszAlignFname, // alignment filename
const char* pszSourceFname, // source file name
const char* pszTargetFname, // target file name
const char* pszInstanceFname, // training instance file name
- const char* pszModelPrefix, // classifier model file name prefix
- int iClassifierType, // classifier type
- int iCutoff, // feature count threshold
+ const char* pszModelPrefix, // classifier model file name prefix
+ int iClassifierType, // classifier type
+ int iCutoff, // feature count threshold
const char* pszOption // other classifier parameters (for svmlight)
) {
fnGenerateInstanceFile(pszSynFname, pszAlignFname, pszSourceFname,
@@ -401,8 +401,8 @@ delete pZhangleMaxent;*/
}
void fnGenerateInstanceFile(
- const char* pszSynFname, // source-side flattened parse tree file name
- const char* pszAlignFname, // alignment filename
+ const char* pszSynFname, // source-side flattened parse tree file name
+ const char* pszAlignFname, // alignment filename
const char* pszSourceFname, // source file name
const char* pszTargetFname, // target file name
const char* pszInstanceFname // training instance file name
@@ -507,8 +507,8 @@ delete pZhangleMaxent;*/
}
void fnGenerateInstanceFile2(
- const char* pszSynFname, // source-side flattened parse tree file name
- const char* pszAlignFname, // alignment filename
+ const char* pszSynFname, // source-side flattened parse tree file name
+ const char* pszAlignFname, // alignment filename
const char* pszSourceFname, // source file name
const char* pszTargetFname, // target file name
const char* pszInstanceFname // training instance file name
@@ -582,13 +582,13 @@ struct SConstContTrainer {
SConstContTrainer(
const char* pszFlattenedSynFname, // source-side flattened parse tree
// file name
- const char* pszAlignFname, // alignment filename
- const char* pszSourceFname, // source file name
- const char* pszTargetFname, // target file name
- const char* pszInstanceFname, // training instance file name
- const char* pszModelPrefix, // classifier model file name prefix
- int iClassifierType, // classifier type
- int iCutoff, // feature count threshold
+ const char* pszAlignFname, // alignment filename
+ const char* pszSourceFname, // source file name
+ const char* pszTargetFname, // target file name
+ const char* pszInstanceFname, // training instance file name
+ const char* pszModelPrefix, // classifier model file name prefix
+ int iClassifierType, // classifier type
+ int iCutoff, // feature count threshold
const char* pszOption // other classifier parameters (for svmlight)
) {
fnGenerateInstanceFile(pszFlattenedSynFname, pszAlignFname, pszSourceFname,
@@ -699,10 +699,10 @@ struct SConstContTrainer {
void fnGenerateInstanceFile(
const char* pszFlattenedSynFname, // source-side flattened parse tree
// file name
- const char* pszAlignFname, // alignment filename
- const char* pszSourceFname, // source file name
- const char* pszTargetFname, // target file name
- const char* pszInstanceFname // training instance file name
+ const char* pszAlignFname, // alignment filename
+ const char* pszSourceFname, // source file name
+ const char* pszTargetFname, // target file name
+ const char* pszInstanceFname // training instance file name
) {
SAlignmentReader* pAlignReader = new SAlignmentReader(pszAlignFname);
SParseReader* pParseReader = new SParseReader(pszFlattenedSynFname, true);
@@ -781,11 +781,11 @@ inline string str(char const* name, po::variables_map const& conf) {
}
//--parse_file /scratch0/mt_exp/gq-ctb/data/train.srl.cn --align_file
-///scratch0/mt_exp/gq-ctb/data/aligned.grow-diag-final-and --source_file
-///scratch0/mt_exp/gq-ctb/data/train.cn --target_file
-///scratch0/mt_exp/gq-ctb/data/train.en --instance_file
-///scratch0/mt_exp/gq-ctb/data/srl-instance --model_prefix
-///scratch0/mt_exp/gq-ctb/data/srl-instance --feature_cutoff 10
+/// scratch0/mt_exp/gq-ctb/data/aligned.grow-diag-final-and --source_file
+/// scratch0/mt_exp/gq-ctb/data/train.cn --target_file
+/// scratch0/mt_exp/gq-ctb/data/train.en --instance_file
+/// scratch0/mt_exp/gq-ctb/data/srl-instance --model_prefix
+/// scratch0/mt_exp/gq-ctb/data/srl-instance --feature_cutoff 10
//--classifier_type 1
int main(int argc, char** argv) {
diff --git a/utils/srl_sentence.h b/utils/srl_sentence.h
index 10f0414b..9d509600 100644
--- a/utils/srl_sentence.h
+++ b/utils/srl_sentence.h
@@ -8,7 +8,6 @@
#ifndef SRL_SENTENCE_H_
#define SRL_SENTENCE_H_
-
#include <sstream>
#include <vector>
@@ -36,7 +35,7 @@ struct SArgument {
char* m_pszRole; // argument rule, e.g., ARG0, ARGM-TMP
int m_iBegin;
- int m_iEnd; // the span of the argument, [m_iBegin, m_iEnd]
+ int m_iEnd; // the span of the argument, [m_iBegin, m_iEnd]
float m_fProb; // the probability of this role,
STreeItem* m_pTreeItem;
};
@@ -66,7 +65,7 @@ struct SPredicate {
char* m_pszLemma; // lemma of the predicate, for Chinese, it's always as same
// as the predicate itself
- int m_iPosition; // the position in sentence
+ int m_iPosition; // the position in sentence
std::vector<SArgument*> m_vecArgt; // arguments associated to the predicate
};
diff --git a/utils/tree.h b/utils/tree.h
index ac80f6c7..6c3406d6 100644
--- a/utils/tree.h
+++ b/utils/tree.h
@@ -52,12 +52,12 @@ struct STreeItem {
char *m_pszTerm;
std::vector<STreeItem *> m_vecChildren; // children items
- STreeItem *m_ptParent; // the parent item
+ STreeItem *m_ptParent; // the parent item
int m_iBegin;
- int m_iEnd; // the node span words[m_iBegin, m_iEnd]
- int m_iHeadChild; // the index of its head child
- int m_iHeadWord; // the index of its head word
+ int m_iEnd; // the node span words[m_iBegin, m_iEnd]
+ int m_iHeadChild; // the index of its head child
+ int m_iHeadWord; // the index of its head word
int m_iBrotherIndex; // the index in his brothers
};