summaryrefslogtreecommitdiff
path: root/gi/pyp-topics
diff options
context:
space:
mode:
authorphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-02 15:19:25 +0000
committerphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-02 15:19:25 +0000
commitb9da57b72eae5cb01c1b109476278df1e4f74fe7 (patch)
treef76560163494cefafcd10a8e8d6eb1eaf4c30048 /gi/pyp-topics
parentd8fbd50153111e93d2a9870b86034e667067978c (diff)
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@112 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/pyp-topics')
-rw-r--r--gi/pyp-topics/src/train-contexts.cc9
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;
}