Skip to content

Commit

Permalink
Bug fix related to commit 220d820,
Browse files Browse the repository at this point in the history
which replaced boost::intrusive_ptr<bitext>  with shared_ptr<bitext>.
  • Loading branch information
ugermann committed Nov 25, 2015
1 parent ee5edc4 commit c11c4cb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion moses/TranslationModel/UG/check-coverage3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main(int argc, char* argv[])
if (size_t(m.ca()) == num_occurrences) continue;
num_occurrences = m.ca();
SPTR<SamplingBias const> zilch;
BitextSampler<Token> s(B.get(), m, zilch, 1000, 1000,
BitextSampler<Token> s(B, m, zilch, 1000, 1000,
sapt::random_sampling);
s();
if (s.stats()->trg.size() == 0) continue;
Expand Down
6 changes: 3 additions & 3 deletions moses/TranslationModel/UG/mm/ug_bitext.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace sapt
template<typename Token> class BitextSampler;

template<typename TKN>
class Bitext : public Moses::reference_counter
class Bitext // : public Moses::reference_counter
{
public:
template<typename Token> friend class BitextSampler;
Expand Down Expand Up @@ -167,7 +167,7 @@ namespace sapt
prep2(ttasksptr const& ttask, iter const& phrase, int max_sample = -1) const;
#endif

public:
protected:
Bitext(size_t const max_sample = 1000, size_t const xnum_workers = 16);

Bitext(Ttrack<Token>* const t1, Ttrack<Token>* const t2,
Expand All @@ -176,7 +176,7 @@ namespace sapt
TSA<Token>* const i1, TSA<Token>* const i2,
size_t const max_sample=1000,
size_t const xnum_workers=16);

public:
virtual void
open(std::string const base, std::string const L1, std::string const L2) = 0;

Expand Down
4 changes: 2 additions & 2 deletions moses/TranslationModel/UG/mm/ug_bitext_sampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ BitextSampler : public Moses::reference_counter
public:
BitextSampler(BitextSampler const& other);
BitextSampler const& operator=(BitextSampler const& other);
BitextSampler(bitext const* const bitext,
BitextSampler(SPTR<bitext const> const& bitext,
typename bitext::iter const& phrase,
SPTR<SamplingBias const> const& bias,
size_t const min_samples,
Expand Down Expand Up @@ -182,7 +182,7 @@ flip_coin(id_type & sid, ushort & offset)

template<typename Token>
BitextSampler<Token>::
BitextSampler(Bitext<Token> const* const bitext,
BitextSampler(SPTR<Bitext<Token> const> const& bitext,
typename bitext::iter const& phrase,
SPTR<SamplingBias const> const& bias, size_t const min_samples, size_t const max_samples,
sampling_method const method)
Expand Down
7 changes: 4 additions & 3 deletions moses/TranslationModel/UG/mmsapt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ namespace Moses
if (foo) { sfix = *foo; sfix->wait(); }
else
{
BitextSampler<Token> s(btfix.get(), mfix, context->bias,
BitextSampler<Token> s(btfix, mfix, context->bias,
m_min_sample_size,
m_default_sample_size,
m_sampling_method);
Expand Down Expand Up @@ -910,8 +910,9 @@ namespace Moses
uint64_t pid = mfix.getPid();
if (!context->cache1->get(pid))
{
BitextSampler<Token> s(btfix.get(), mfix, context->bias,
m_min_sample_size, m_default_sample_size, m_sampling_method);
BitextSampler<Token> s(btfix, mfix, context->bias,
m_min_sample_size, m_default_sample_size,
m_sampling_method);
if (*context->cache1->get(pid, s.stats()) == s.stats())
m_thread_pool->add(s);
}
Expand Down
4 changes: 2 additions & 2 deletions moses/TranslationModel/UG/test-domspec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ show(Bitext<Token> const& B, iter const& m, pstats& stats)


void
process(Bitext<Token> const* bitext, TSA<Token>::tree_iterator& m)
process(SPTR<Bitext<Token> const> const& bitext, TSA<Token>::tree_iterator& m)
{
static boost::shared_ptr<SamplingBias> nil(new SamplingBiasAlways(bitext->sid2did()));
static Moses::bitext::sampling_method random = Moses::bitext::random_sampling;
Expand All @@ -126,7 +126,7 @@ process(Bitext<Token> const* bitext, TSA<Token>::tree_iterator& m)
int main(int argc, char* argv[])
{
interpret_args(argc, argv);
iptr<mmbitext> B(new mmbitext);
SPTR<mmbitext> B(new mmbitext);
B->open(bname, L1, L2);
TSA<Token>::tree_iterator m(B->I1.get());
// m.extend((*B.V1)["job"]);
Expand Down

0 comments on commit c11c4cb

Please sign in to comment.