Skip to content

Commit

Permalink
decreasing vecHead index in Xml4nlp
Browse files Browse the repository at this point in the history
  • Loading branch information
carfly committed Jul 25, 2013
1 parent 6cef1cc commit bcd3d0c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/__xml4nlp/Xml4nlp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,14 @@ int XML4NLP::SetParsesToSentence(const vector<int> &vecHead, const vector<string

int XML4NLP::SetParsesToSentence(const vector<int> &vecHead, const vector<string> &vecRel, int sentenceIdx)
{
if (0 != SetInfoToSentence(vecHead, sentenceIdx, TAG_PSR_PARENT)) return -1;
// decreasing vecHead index
vector<int> d_vecHead;
for (int i = 0; i < vecHead.size(); i++)
{
d_vecHead.push_back(vecHead[i] - 1);
}

if (0 != SetInfoToSentence(d_vecHead, sentenceIdx, TAG_PSR_PARENT)) return -1;
if (0 != SetInfoToSentence(vecRel, sentenceIdx, TAG_PSR_RELATE)) return -1;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser/parser_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ParserWrapper : public ltp::parser::Parser {
heads.resize(len - 1);
deprels.resize(len - 1);
for (int i = 1; i < len; ++ i) {
heads[i - 1] = inst->predicted_heads[i] - 1;
heads[i - 1] = inst->predicted_heads[i];
deprels[i - 1] = ltp::parser::Parser::model->deprels.at(
inst->predicted_deprelsidx[i]);
}
Expand Down

0 comments on commit bcd3d0c

Please sign in to comment.