diff options
Diffstat (limited to 'word-aligner')
| -rw-r--r-- | word-aligner/fast_align.cc | 8 | ||||
| -rwxr-xr-x | word-aligner/force_align.py | 8 | ||||
| -rw-r--r-- | word-aligner/ttables.cc | 1 | ||||
| -rw-r--r-- | word-aligner/ttables.h | 11 | 
4 files changed, 19 insertions, 9 deletions
| diff --git a/word-aligner/fast_align.cc b/word-aligner/fast_align.cc index fddcba9c..f54233eb 100644 --- a/word-aligner/fast_align.cc +++ b/word-aligner/fast_align.cc @@ -1,7 +1,12 @@  #include <iostream>  #include <cmath>  #include <utility> -#include <tr1/unordered_map> +#ifndef HAVE_OLD_CPP +# include <unordered_map> +#else +# include <tr1/unordered_map> +namespace std { using std::tr1::unordered_map; } +#endif  #include <boost/functional/hash.hpp>  #include <boost/program_options.hpp> @@ -17,7 +22,6 @@  namespace po = boost::program_options;  using namespace std; -using namespace std::tr1;  bool InitCommandLine(int argc, char** argv, po::variables_map* conf) {    po::options_description opts("Configuration options"); diff --git a/word-aligner/force_align.py b/word-aligner/force_align.py index 6721dacb..b03d446e 100755 --- a/word-aligner/force_align.py +++ b/word-aligner/force_align.py @@ -5,18 +5,20 @@ import sys  def main(): -    if len(sys.argv[1:]) != 4: +    if len(sys.argv[1:]) < 4:          sys.stderr.write('run:\n')          sys.stderr.write('  fast_align -i corpus.f-e -d -v -o -p fwd_params >fwd_align 2>fwd_err\n')          sys.stderr.write('  fast_align -i corpus.f-e -r -d -v -o -p rev_params >rev_align 2>rev_err\n')          sys.stderr.write('\n')          sys.stderr.write('then run:\n') -        sys.stderr.write('  {} fwd_params fwd_err rev_params rev_err <in.f-e >out.f-e.gdfa\n'.format(sys.argv[0])) +        sys.stderr.write('  {} fwd_params fwd_err rev_params rev_err [heuristic] <in.f-e >out.f-e.gdfa\n'.format(sys.argv[0])) +        sys.stderr.write('\n') +        sys.stderr.write('where heuristic is one of: (intersect union grow-diag grow-diag-final grow-diag-final-and) default=grow-diag-final-and\n')          sys.exit(2)      # Hook into realtime      sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'realtime')) -    from rt import ForceAligner +    from rt.aligner import ForceAligner      aligner = ForceAligner(*sys.argv[1:]) diff --git a/word-aligner/ttables.cc b/word-aligner/ttables.cc index c177aa30..a56bbcef 100644 --- a/word-aligner/ttables.cc +++ b/word-aligner/ttables.cc @@ -5,7 +5,6 @@  #include "dict.h"  using namespace std; -using namespace std::tr1;  void TTable::DeserializeProbsFromText(std::istream* in) {    int c = 0; diff --git a/word-aligner/ttables.h b/word-aligner/ttables.h index 507f591a..d82aff72 100644 --- a/word-aligner/ttables.h +++ b/word-aligner/ttables.h @@ -2,7 +2,12 @@  #define _TTABLES_H_  #include <iostream> -#include <tr1/unordered_map> +#ifndef HAVE_OLD_CPP +# include <unordered_map> +#else +# include <tr1/unordered_map> +namespace std { using std::tr1::unordered_map; } +#endif  #include "sparse_vector.h"  #include "m.h" @@ -12,8 +17,8 @@  class TTable {   public:    TTable() {} -  typedef std::tr1::unordered_map<WordID, double> Word2Double; -  typedef std::tr1::unordered_map<WordID, Word2Double> Word2Word2Double; +  typedef std::unordered_map<WordID, double> Word2Double; +  typedef std::unordered_map<WordID, Word2Double> Word2Word2Double;    inline double prob(const int& e, const int& f) const {      const Word2Word2Double::const_iterator cit = ttable.find(e);      if (cit != ttable.end()) { | 
