summaryrefslogtreecommitdiff
path: root/python/cdec/sa/_sa.pyx
diff options
context:
space:
mode:
authorVictor Chahuneau <vchahune@cs.cmu.edu>2013-08-26 20:12:32 -0400
committerVictor Chahuneau <vchahune@cs.cmu.edu>2013-08-26 20:12:32 -0400
commitca9b58716214148eeaeaa3076e1a1dc8f8bb5892 (patch)
treebfa2fd84c86e0fdd499110e86fd464b391379df1 /python/cdec/sa/_sa.pyx
parent9d5071692ceab8d09c2bfdba24f6b927ec84b7f9 (diff)
Improve the package structure of pycdec
This change should not break anything, but now you can run: python setup.py build_ext --inplace and use the cleaner: PYTHONPATH=/path/to/cdec/python python -m ...
Diffstat (limited to 'python/cdec/sa/_sa.pyx')
-rw-r--r--python/cdec/sa/_sa.pyx30
1 files changed, 30 insertions, 0 deletions
diff --git a/python/cdec/sa/_sa.pyx b/python/cdec/sa/_sa.pyx
new file mode 100644
index 00000000..4716d174
--- /dev/null
+++ b/python/cdec/sa/_sa.pyx
@@ -0,0 +1,30 @@
+import logging
+import resource
+import gzip
+
+def monitor_cpu():
+ return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+
+ resource.getrusage(resource.RUSAGE_SELF).ru_stime)
+
+def gzip_or_text(char* filename):
+ if filename.endswith('.gz'):
+ return gzip.GzipFile(filename)
+ else:
+ return open(filename)
+
+logger = logging.getLogger('cdec.sa')
+
+include "float_list.pxi"
+include "int_list.pxi"
+include "str_map.pxi"
+include "data_array.pxi"
+include "alignment.pxi"
+include "bilex.pxi"
+include "veb.pxi"
+include "lcp.pxi"
+include "sym.pxi"
+include "rule.pxi"
+include "precomputation.pxi"
+include "suffix_array.pxi"
+include "rulefactory.pxi"
+include "features.pxi"