Skip to content

Commit

Permalink
merged in from wipoNew
Browse files Browse the repository at this point in the history
  • Loading branch information
emjotde committed Oct 24, 2014
1 parent ba1883b commit 3d8526d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions contrib/sigtest-filter/filter-pt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ void usage()
<< "\nUsage:\n"
<< "\n filter-pt -e english.suf-arr -f french.suf-arr\n"
<< " [-c] [-p] [-l threshold] [-n num] [-t num] < PHRASE-TABLE > FILTERED-PHRASE-TABLE\n\n"
<< " Writes output parts to phrase-table.000.filtered.gz phrase-table.001.filtered.gz ...\n\n"
<< " [-l threshold] >0.0, a+e, or a-e: keep values that have a -log significance > this\n"
<< " [-n num ] 0, 1...: 0=no filtering, >0 sort by P(e|f) and keep the top num elements\n"
<< " [-c ] add the cooccurence counts to the phrase table\n"
Expand Down Expand Up @@ -285,7 +284,7 @@ void lookup_phrase(SentIdSet& ids, const std::string& phrase,
}

std::sort(ids->begin(), ids->end());
typename SentIdSet::element_type::iterator it =
SentIdSet::element_type::iterator it =
std::unique(ids->begin(), ids->end());
ids->resize(it - ids->begin());

Expand Down Expand Up @@ -364,7 +363,7 @@ void find_occurrences(SentIdSet& ids, const std::string& rule,
void compute_cooc_stats_and_filter(std::vector<PTEntry*>& options,
Cache& f_cache, Cache& e_cache)
{
if (pfe_filter_limit>0 && options.size() > pfe_filter_limit) {
if (pfe_filter_limit > 0 && options.size() > pfe_filter_limit) {
nremoved_pfefilter += (options.size() - pfe_filter_limit);
std::nth_element(options.begin(), options.begin() + pfe_filter_limit,
options.end(), PfeComparer());
Expand All @@ -377,6 +376,9 @@ void compute_cooc_stats_and_filter(std::vector<PTEntry*>& options,
if (pef_filter_only)
return;

if (options.empty())
return;

SentIdSet fset( new SentIdSet::element_type() );
find_occurrences(fset, options.front()->f_phrase, f_sa, f_cache);
size_t cf = fset->size();
Expand Down

0 comments on commit 3d8526d

Please sign in to comment.