summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-11-23 17:33:47 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-11-23 17:33:47 +0000
commit072c4bb1edde483b87b93bc6f4eec36fc8a21008 (patch)
tree6ceaa6ae1e08df9e523282740b14f4857236297c /python
parent7e90b8ea10904f9b83f4e77e14c7396a3e6f7d5d (diff)
parent9e80389b9763aa4f7f626ec71b561ccf6948d3ad (diff)
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'python')
-rw-r--r--python/cdec/sa/_sa.cpp (renamed from python/cdec/sa/_sa.c)0
-rw-r--r--python/cdec/sa/compile.py13
-rw-r--r--python/cdec/sa/strmap.cc11
-rw-r--r--python/setup.py.in5
4 files changed, 18 insertions, 11 deletions
diff --git a/python/cdec/sa/_sa.c b/python/cdec/sa/_sa.cpp
index a9f7855e..a9f7855e 100644
--- a/python/cdec/sa/_sa.c
+++ b/python/cdec/sa/_sa.cpp
diff --git a/python/cdec/sa/compile.py b/python/cdec/sa/compile.py
index d4cd8387..caa93f8b 100644
--- a/python/cdec/sa/compile.py
+++ b/python/cdec/sa/compile.py
@@ -75,6 +75,13 @@ def main():
a_bin = os.path.join(args.output, 'a.bin')
lex_bin = os.path.join(args.output, 'lex.bin')
+ config = cdec.configobj.ConfigObj(args.config, unrepr=True)
+ config['f_sa_file'] = os.path.abspath(f_sa_bin)
+ config['e_file'] = os.path.abspath(e_bin)
+ config['a_file'] = os.path.abspath(a_bin)
+ config['lex_file'] = os.path.abspath(lex_bin)
+ config['precompute_file'] = os.path.abspath(precomp_bin)
+
start_time = monitor_cpu()
logger.info('Compiling source suffix array')
if args.bitext:
@@ -116,12 +123,6 @@ def main():
logger.info('Compiling bilexical dictionary took %f seconds', stop_time - start_time)
# Write configuration
- config = cdec.configobj.ConfigObj(args.config, unrepr=True)
- config['f_sa_file'] = os.path.abspath(f_sa_bin)
- config['e_file'] = os.path.abspath(e_bin)
- config['a_file'] = os.path.abspath(a_bin)
- config['lex_file'] = os.path.abspath(lex_bin)
- config['precompute_file'] = os.path.abspath(precomp_bin)
for name, value in zip(param_names, params):
config[name] = value
config.write()
diff --git a/python/cdec/sa/strmap.cc b/python/cdec/sa/strmap.cc
index 5040477e..b6debfb0 100644
--- a/python/cdec/sa/strmap.cc
+++ b/python/cdec/sa/strmap.cc
@@ -2,11 +2,16 @@
#include <vector>
#include <string>
-#include <tr1/unordered_map>
-#include <stdint.h>
+#include <cstdint>
+
+#ifndef HAVE_OLD_CPP
+# include <unordered_map>
+#else
+# include <tr1/unordered_map>
+namespace std { using std::tr1::unordered_map; }
+#endif
using namespace std;
-using namespace std::tr1;
#undef HAVE_64_BITS
diff --git a/python/setup.py.in b/python/setup.py.in
index ce1eb2ed..a2aa28f6 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -7,7 +7,7 @@ LIB = ['../decoder', '../utils', '../mteval', '../training/utils', '../klm/lm',
# Set automatically by configure
LIBS = re.findall('-l([^\s]+)', '@LIBS@')
-CPPFLAGS = re.findall('-[^\s]+', '@CPPFLAGS@')
+CPPFLAGS = re.findall('-[^\s]+', '@CPPFLAGS@ @CXXFLAGS@')
LDFLAGS = re.findall('-[^\s]+', '@LDFLAGS@')
# Make sure linker flags go only to the linker
LDFLAGS = [opt.replace('-R', '-Wl,-rpath,') for opt in LDFLAGS]
@@ -21,7 +21,8 @@ ext_modules = [
extra_compile_args=CPPFLAGS,
extra_link_args=LDFLAGS),
Extension(name='cdec.sa._sa',
- sources=['cdec/sa/_sa.c', 'cdec/sa/strmap.cc'])
+ sources=['cdec/sa/_sa.cpp', 'cdec/sa/strmap.cc'],
+ extra_compile_args=CPPFLAGS)
]
setup(