From b9da57b72eae5cb01c1b109476278df1e4f74fe7 Mon Sep 17 00:00:00 2001 From: "philblunsom@gmail.com" Date: Fri, 2 Jul 2010 15:19:25 +0000 Subject: git-svn-id: https://ws10smt.googlecode.com/svn/trunk@112 ec762483-ff6d-05da-a07a-a48fb63a330f --- gi/pyp-topics/src/train-contexts.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'gi/pyp-topics') 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::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::const_iterator termIt=unique_terms.begin(); @@ -114,11 +118,6 @@ int main(int argc, char **argv) copy(strings.begin(), strings.end(),ostream_iterator(documents_out, " ")); documents_out << "||| C=" << model.max(document_id, *termIt); - // increment this terms frequency - pair::iterator,bool> insert_result = all_terms.insert(make_pair(*termIt,1)); - if (!insert_result.second) - //insert_result.first++; - all_terms[*termIt] += 1; } documents_out <