summaryrefslogtreecommitdiff
path: root/python/src/sa/alignment.pxi
diff options
context:
space:
mode:
authorEva Schlinger <eschling@andrew.cmu.edu>2013-06-07 13:28:07 -0400
committerEva Schlinger <eschling@andrew.cmu.edu>2013-06-07 13:28:07 -0400
commitad2d6df5a5be1f6e0ea4e1e7387f996300744f53 (patch)
tree320c2f6dfa884aa06bae6f0a6abc92472fadaa49 /python/src/sa/alignment.pxi
parent7facc1f34bcf2fdd328d0ce39d21c5cf7f1896da (diff)
parent7ca523c492776485b1d5d030b4c1869a188a2e9b (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'python/src/sa/alignment.pxi')
-rw-r--r--python/src/sa/alignment.pxi10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/src/sa/alignment.pxi b/python/src/sa/alignment.pxi
index 842899ad..f66f0fbf 100644
--- a/python/src/sa/alignment.pxi
+++ b/python/src/sa/alignment.pxi
@@ -5,21 +5,23 @@ from libc.stdlib cimport malloc, realloc, free
# We have the space for our corpus, so this is not a problem;
# May need to revisit if things get really tight, though.
+cdef int ALIGNMENT_CODE = 1 << 16
+
cdef class Alignment:
cdef IntList links
cdef IntList sent_index
cdef int link(self, int i, int j):
"""Integerizes an alignment link pair"""
- return i*65536 + j
+ return i * ALIGNMENT_CODE + j
def unlink(self, link):
"""De-integerizes an alignment link pair"""
- return (link/65536, link%65536)
+ return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE)
cdef _unlink(self, int link, int* f, int* e):
- f[0] = link/65536
- e[0] = link%65536
+ f[0] = link / ALIGNMENT_CODE
+ e[0] = link % ALIGNMENT_CODE
def get_sent_links(self, int sent_id):
cdef IntList sent_links