summaryrefslogtreecommitdiff
path: root/python/src/sa/suffix_array.pxi
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-07-28 18:35:20 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-07-28 18:35:20 -0400
commit15a653ab0d684fae36602665e82f3ef23ac5a028 (patch)
tree4f5e5f0acd0106f32346e7183342fcb210fd5fd5 /python/src/sa/suffix_array.pxi
parent16d0e2a34df3e32e8992aeda3ad2de7a6e525f14 (diff)
parent0b0616c6f7400ce52d07350f7a7054a2513d9813 (diff)
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'python/src/sa/suffix_array.pxi')
-rw-r--r--python/src/sa/suffix_array.pxi8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/src/sa/suffix_array.pxi b/python/src/sa/suffix_array.pxi
index 20e6261d..d86e8ea6 100644
--- a/python/src/sa/suffix_array.pxi
+++ b/python/src/sa/suffix_array.pxi
@@ -8,14 +8,14 @@ cdef class SuffixArray:
cdef IntList sa
cdef IntList ha
- def __cinit__(self, from_binary=None, from_text=None):
+ def __cinit__(self, from_binary=None, from_text=None, side=None):
self.darray = DataArray()
self.sa = IntList()
self.ha = IntList()
if from_binary:
self.read_binary(from_binary)
elif from_text:
- self.read_text(from_text)
+ self.read_text(from_text, side)
def __getitem__(self, i):
return self.sa.arr[i]
@@ -29,13 +29,13 @@ cdef class SuffixArray:
def getSentPos(self, loc):
return self.darray.getSentPos(loc)
- def read_text(self, char* filename):
+ def read_text(self, filename, side):
'''Constructs suffix array using the algorithm
of Larsson & Sadahkane (1999)'''
cdef int V, N, i, j, h, a_i, n, current_run, skip
cdef IntList isa, word_count
- self.darray = DataArray(from_text=filename, use_sent_id=True)
+ self.darray = DataArray(from_text=filename, side=side, use_sent_id=True)
N = len(self.darray)
V = len(self.darray.id2word)