Skip to content

Commit 7f5e343

Browse files
committed
Fix indentation and trailing whitespace
1 parent c00b718 commit 7f5e343

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

parser/lstm-parse.cc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -856,19 +856,19 @@ unsigned compute_correct(const map<int,int>& ref, const map<int,int>& hyp, unsig
856856
}
857857

858858
void output_conll(const vector<unsigned>& sentence, const vector<unsigned>& pos,
859-
const vector<string>& sentenceUnkStrings,
860-
const map<unsigned, string>& intToWords,
861-
const map<unsigned, string>& intToPos,
859+
const vector<string>& sentenceUnkStrings,
860+
const map<unsigned, string>& intToWords,
861+
const map<unsigned, string>& intToPos,
862862
const map<int,int>& hyp, const map<int,string>& rel_hyp) {
863863
for (unsigned i = 0; i < (sentence.size()-1); ++i) {
864864
auto index = i + 1;
865-
assert(i < sentenceUnkStrings.size() &&
865+
assert(i < sentenceUnkStrings.size() &&
866866
((sentence[i] == corpus.get_or_add_word(cpyp::Corpus::UNK) &&
867867
sentenceUnkStrings[i].size() > 0) ||
868868
(sentence[i] != corpus.get_or_add_word(cpyp::Corpus::UNK) &&
869869
sentenceUnkStrings[i].size() == 0 &&
870870
intToWords.find(sentence[i]) != intToWords.end())));
871-
string wit = (sentenceUnkStrings[i].size() > 0)?
871+
string wit = (sentenceUnkStrings[i].size() > 0)?
872872
sentenceUnkStrings[i] : intToWords.find(sentence[i])->second;
873873
auto pit = intToPos.find(pos[i]);
874874
assert(hyp.find(i) != hyp.end());
@@ -880,10 +880,10 @@ void output_conll(const vector<unsigned>& sentence, const vector<unsigned>& pos,
880880
size_t first_char_in_rel = hyp_rel.find('(') + 1;
881881
size_t last_char_in_rel = hyp_rel.rfind(')') - 1;
882882
hyp_rel = hyp_rel.substr(first_char_in_rel, last_char_in_rel - first_char_in_rel + 1);
883-
cout << index << '\t' // 1. ID
883+
cout << index << '\t' // 1. ID
884884
<< wit << '\t' // 2. FORM
885-
<< "_" << '\t' // 3. LEMMA
886-
<< "_" << '\t' // 4. CPOSTAG
885+
<< "_" << '\t' // 3. LEMMA
886+
<< "_" << '\t' // 4. CPOSTAG
887887
<< pit->second << '\t' // 5. POSTAG
888888
<< "_" << '\t' // 6. FEATS
889889
<< hyp_head << '\t' // 7. HEAD
@@ -913,7 +913,7 @@ void init_pretrained(istream &in) {
913913
int main(int argc, char** argv) {
914914
cnn::Initialize(argc, argv);
915915

916-
cerr << "COMMAND:";
916+
cerr << "COMMAND:";
917917
for (unsigned i = 0; i < static_cast<unsigned>(argc); ++i) cerr << ' ' << argv[i];
918918
cerr << endl;
919919
unsigned status_every_i_iterations = 100;
@@ -1048,8 +1048,8 @@ int main(int argc, char** argv) {
10481048
for (auto& w : tsentence)
10491049
if (singletons.count(w) && cnn::rand01() < unk_prob) w = kUNK;
10501050
}
1051-
const vector<unsigned>& sentencePos=corpus.sentencesPos[order[si]];
1052-
const vector<unsigned>& actions=corpus.correct_act_sent[order[si]];
1051+
const vector<unsigned>& sentencePos=corpus.sentencesPos[order[si]];
1052+
const vector<unsigned>& actions=corpus.correct_act_sent[order[si]];
10531053
ComputationGraph hg;
10541054
parser.log_prob_parser(&hg,sentence,tsentence,sentencePos,actions,corpus.actions,corpus.intToWords,&right);
10551055
double lp = as_scalar(hg.incremental_forward());
@@ -1080,17 +1080,17 @@ int main(int argc, char** argv) {
10801080
auto t_start = std::chrono::high_resolution_clock::now();
10811081
for (unsigned sii = 0; sii < dev_size; ++sii) {
10821082
const vector<unsigned>& sentence=corpus.sentencesDev[sii];
1083-
const vector<unsigned>& sentencePos=corpus.sentencesPosDev[sii];
1084-
const vector<unsigned>& actions=corpus.correct_act_sentDev[sii];
1083+
const vector<unsigned>& sentencePos=corpus.sentencesPosDev[sii];
1084+
const vector<unsigned>& actions=corpus.correct_act_sentDev[sii];
10851085
vector<unsigned> tsentence=sentence;
10861086
if (!USE_SPELLING) {
10871087
for (auto& w : tsentence)
10881088
if (training_vocab.count(w) == 0) w = kUNK;
10891089
}
10901090

10911091
ComputationGraph hg;
1092-
vector<unsigned> pred = parser.log_prob_parser(&hg,sentence,tsentence,sentencePos,vector<unsigned>(),corpus.actions,corpus.intToWords,&right);
1093-
double lp = 0;
1092+
vector<unsigned> pred = parser.log_prob_parser(&hg,sentence,tsentence,sentencePos,vector<unsigned>(),corpus.actions,corpus.intToWords,&right);
1093+
double lp = 0;
10941094
//vector<unsigned> pred = parser.log_prob_parser_beam(&hg,sentence,sentencePos,corpus.actions,beam_size,&lp);
10951095
llh -= lp;
10961096
trs += actions.size();
@@ -1111,9 +1111,9 @@ int main(int argc, char** argv) {
11111111
// easier to refer to it in a shell script.
11121112
if (!softlinkCreated) {
11131113
string softlink = " latest_model";
1114-
if (system((string("rm -f ") + softlink).c_str()) == 0 &&
1114+
if (system((string("rm -f ") + softlink).c_str()) == 0 &&
11151115
system((string("ln -s ") + fname + softlink).c_str()) == 0) {
1116-
cerr << "Created " << softlink << " as a soft link to " << fname
1116+
cerr << "Created " << softlink << " as a soft link to " << fname
11171117
<< " for convenience." << endl;
11181118
}
11191119
softlinkCreated = true;
@@ -1132,8 +1132,8 @@ int main(int argc, char** argv) {
11321132
unsigned corpus_size = corpus.nsentencesDev;
11331133
for (unsigned sii = 0; sii < corpus_size; ++sii) {
11341134
const vector<unsigned>& sentence=corpus.sentencesDev[sii];
1135-
const vector<unsigned>& sentencePos=corpus.sentencesPosDev[sii];
1136-
const vector<string>& sentenceUnkStr=corpus.sentencesStrDev[sii];
1135+
const vector<unsigned>& sentencePos=corpus.sentencesPosDev[sii];
1136+
const vector<string>& sentenceUnkStr=corpus.sentencesStrDev[sii];
11371137
const vector<unsigned>& actions=corpus.correct_act_sentDev[sii];
11381138
vector<unsigned> tsentence=sentence;
11391139
if (!USE_SPELLING) {

0 commit comments

Comments
 (0)