diff options
author | philblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-02 15:19:25 +0000 |
---|---|---|
committer | philblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-02 15:19:25 +0000 |
commit | 1988573b4d995c146abcd1c334f6b734b72a3cc8 (patch) | |
tree | 7e7dbe059418015fca757f624198af0838fc781d /gi/pyp-topics/src | |
parent | 822da237c6ffd137afa9efa03f49fa50de36773f (diff) |
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@112 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/pyp-topics/src')
-rw-r--r-- | gi/pyp-topics/src/train-contexts.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gi/pyp-topics/src/train-contexts.cc b/gi/pyp-topics/src/train-contexts.cc index 618c6dbb..bf56288e 100644 --- a/gi/pyp-topics/src/train-contexts.cc +++ b/gi/pyp-topics/src/train-contexts.cc @@ -104,6 +104,10 @@ int main(int argc, char **argv) docIt != corpusIt->end(); ++docIt) { if (unique_terms.empty() || *docIt != unique_terms.back()) unique_terms.push_back(*docIt); + // increment this terms frequency + pair<map<int,int>::iterator,bool> insert_result = all_terms.insert(make_pair(*docIt,1)); + if (!insert_result.second) + insert_result.first++; } documents_out << contexts_corpus.key(document_id) << '\t'; for (std::vector<int>::const_iterator termIt=unique_terms.begin(); @@ -114,11 +118,6 @@ int main(int argc, char **argv) copy(strings.begin(), strings.end(),ostream_iterator<std::string>(documents_out, " ")); documents_out << "||| C=" << model.max(document_id, *termIt); - // increment this terms frequency - pair<map<int,int>::iterator,bool> insert_result = all_terms.insert(make_pair(*termIt,1)); - if (!insert_result.second) - //insert_result.first++; - all_terms[*termIt] += 1; } documents_out <<endl; } |