Commit Graph

161 Commits

Author SHA1 Message Date
Ulrich Germann
dcb8e5d3e0 Preparation for allowing context-aware decoding. 2015-05-19 02:35:39 +01:00
Ulrich Germann
e4f5c69109 One step closer to eliminating the requirement to provide num-features=... in the config file.
Some FF (Mmsapt, LexicalReordering, Many single-value FF) provide this number during "registration";
when missing, a default weight vector of uniform 1.0 is automatically generated. This eliminates the
need for the user to figure out what the exact number of features is for each FF, which can get complicated,
e.g. in the case of Mmsapt/PhraseDictionaryBitextSampling.
2015-04-29 20:16:52 +01:00
Jeroen Vermeulen
8ac91c8d97 Fix unqualified call to rand_excl().
The call needed to be made explicitly to util::rand_excl().  Sorry.
2015-04-24 00:22:25 +07:00
Jeroen Vermeulen
38d790cac0 Add cross-platform randomizer module.
The code uses two mechanisms for generating random numbers: srand()/rand(),
which is not thread-safe, and srandom()/random(), which is POSIX-specific.

Here I add a util/random.cc module that centralizes these calls, and unifies
some common usage patterns.  If the implementation is not good enough, we can
now change it in a single place.

To keep things simple, this uses the portable srand()/rand() but protects them
with a lock to avoid concurrency problems.

The hard part was to keep the regression tests passing: they rely on fixed
sequences of random numbers, so a small code change could break them very
thoroughly.  Util::rand(), for wide types like size_t, calls std::rand() not
once but twice.  This behaviour was generalized into utils::wide_rand() and
friends.
2015-04-23 23:46:04 +07:00
Jeroen Vermeulen
464615a0c3 Fix some clang++ warnings.
Compiling with clang++ at the default warning/error levels produces
some interesting warnings.  Here's a pair of fixes for the simplest
instances:

moses/TranslationModel/RuleTable/PhraseDictionaryFuzzyMatch.cpp:133:7:
warning: comparison of array 'path' equal to a null pointer is always
false [-Wtautological-pointer-compare]
  if (path == NULL) {
      ^~~~    ~~~~

(The code unnecessarily checks that an automatic variable has a
 non-null address).

moses/TranslationModel/DynSAInclude/onlineRLM.h:305:20:
warning: unsequenced modification and access to 'den_val' [-Wunsequenced]
  if(((den_val = query(&ngram[len - num_fnd], num_fnd - 1)) > 0) &&
               ^

(The code tries to cram too much into an "if" condition.)
2015-04-07 22:58:17 +07:00
Jeroen Vermeulen
789a2e2bc3 Fix some compile warnings (gcc 4.9.2).
Mostly signed/unsigned comparisons and reordered member
initializations; also a few unused variables.

There are more, but if I chip away at them for a while, who knows, it
may catch on and warnings may eventually become socially stigmatizing.
:)
2015-03-29 18:10:51 +07:00
Jeroen Vermeulen
a9c8f44896 Modernize "C" includes in moses.
This is one of those little chores in managing a long-lived C++
project: standard C headers like stdio.h and math.h now have their own
place in the C++ standard as resp. cstdio, cmath, and so on.  In this
branch the #include names are updated for the moses/ subdirectory; more
branches to follow.

C++11 adds cstdint, but to support compilation with the previous
standard, that change is left for later.
2015-03-28 20:09:03 +07:00
Hieu Hoang
70e8eb54ce Using boost for prefix/suffix checks /Jeroen Vermeulen 2015-02-05 16:23:47 +00:00
Hieu Hoang
6d61db28fa use astyle 2.01. It's on Edinburgh server and doesn't screw up enum 2015-01-14 19:21:11 +00:00
Hieu Hoang
05ead45e71 beautify 2015-01-14 11:07:42 +00:00
Phil Williams
e5ebf30664 Fix a few warnings. 2015-01-13 21:13:55 +00:00
Hieu Hoang
3b3f11365d delete UserMessage. Too difficult to police 2015-01-07 10:01:10 +04:00
Nicola Bertoldi
e4eb201c52 merged master into dynamic-models and solved conflicts 2014-12-13 12:52:47 +01:00
Matthias Huck
bfeb7d641f log output 2014-12-05 22:31:54 +00:00
Phil Williams
05ecc914c2 Fix a few more compiler warnings (from Clang mostly). 2014-10-10 15:47:53 +01:00
Phil Williams
ee57e59f2b Fix a few compiler warnings (from Clang mostly). 2014-10-10 14:22:53 +01:00
Hieu Hoang
efa5befb16 method rename 2014-08-08 15:59:34 +01:00
Hieu Hoang
e863592f40 TargetPhrase to have pointer to the phrase table that creates it 2014-08-04 19:28:04 +01:00
Hieu Hoang
abe68be588 initialise m_container 2014-08-04 15:59:32 +01:00
Hieu Hoang
3f3912772d initialise m_container 2014-08-04 15:46:40 +01:00
Hieu Hoang
5f90ccdb13 initialise m_container 2014-08-04 15:20:22 +01:00
Hieu Hoang
b10760f428 delete PhraseTableImplementation. Old enum 2014-07-18 20:36:53 +01:00
Nicola Bertoldi
1fe4eb0528 beautify 2014-06-08 09:44:59 +02:00
Nicola Bertoldi
4d75c889f1 merged master into dynamic-models 2014-06-08 09:39:37 +02:00
Hieu Hoang
ce2a69ba25 Merge ../mosesdecoder into hieu 2014-06-05 17:18:26 +01:00
Hieu Hoang
d29bf716a4 minor change to debugging output. Memory pt used by both pb and chart-based models 2014-06-05 17:15:08 +01:00
Hieu Hoang
8e2c4a89c0 Merge ../mosesdecoder into hieu 2014-06-04 12:53:06 +01:00
Ulrich Germann
9c27dc08e9 Merge branch 'master' of https://github.com/moses-smt/mosesdecoder
Conflicts:
	moses/FF/ConstrainedDecoding.cpp
2014-06-03 18:55:53 +01:00
Ulrich Germann
249c40ec74 Eliminated factor delimiter from the parameters of
Phrase.CreateFromString() and Sentence.CreateFromString(),
as it was never used in those functions anyway ---
Word.CreateFromString() retrieves the factor delimiter
from StaticData directly.
2014-05-31 14:33:31 +01:00
Nicola Bertoldi
10eed17d32 beautify 2014-05-19 15:35:45 +02:00
Hieu Hoang
35c812f5df Merge ../mosesdecoder into hieu 2014-05-13 18:24:17 +01:00
Hieu Hoang
2830ed9968 use Nadir's backoff code 2014-05-12 15:40:18 +01:00
Hieu Hoang
1d401817a5 backoff fix for memory and on-disk phrase-tables 2014-05-12 15:16:11 +01:00
Nicola Bertoldi
20381cbf89 merged master into dynamic-models and solved conflicts 2014-04-28 19:18:38 +02:00
Hieu Hoang
da6ade7d94 get-by-line-number.perl 2014-04-24 17:48:12 +01:00
Hieu Hoang
00505ba048 minor leak 2014-04-23 11:36:25 +01:00
Hieu Hoang
e5a6d63cf2 Merge branch 'master' of github.com:moses-smt/mosesdecoder into hieu 2014-03-21 21:41:04 +00:00
Rico Sennrich
45630a5851 various optimizations to make CYK+ parser several times faster and eat less memory.
speed-up of decoding depends on how much time is spent in parser:
10-50% speed-up for string-to-tree systems observed (more on long sentences and with high max-chart-span).

if you only use hiero or string-to-tree models (but none with source syntax), use compile-option --unlabelled-source for (small) efficiency gains.
2014-03-21 11:12:24 +00:00
Hieu Hoang
bff071fc80 Merge branch 'master' of github.com:moses-smt/mosesdecoder into hieu 2014-03-15 22:22:55 +00:00
Phil Williams
04dbd3c7aa moses_chart: more efficient scope-3 parsing if sentence length < max-chart-span 2014-03-14 08:49:09 +00:00
Hieu Hoang
5155fa26ce Merge branch 'master' into hieu 2014-02-17 22:36:24 +00:00
Hieu Hoang
50cadc754f use boost::unordered_map for CacheColl. Marginally faster 2014-02-11 03:43:58 +00:00
Hieu Hoang
b34b4b978f different max-spans depending on whether source non-term is X or syntactic 2014-01-27 17:53:53 +00:00
Hieu Hoang
39858ce1ff leak 2014-01-21 18:07:12 +00:00
Hieu Hoang
fcadf4511a leak 2014-01-21 17:11:16 +00:00
Nicola Bertoldi
4b072f2097 merge master into this branch 2014-01-17 14:04:15 +01:00
jiejiang
5f1217d793 merged upstream with origin for mingw 2014-01-15 18:16:56 +00:00
Nicola Bertoldi
e452a13062 beautify 2014-01-15 16:49:57 +01:00
Hieu Hoang
fccf2ea43a get rid of all aborts from decoder 2014-01-13 18:32:22 +00:00
Hieu Hoang
b5558c36b8 get rid of all aborts 2014-01-13 14:37:05 +00:00