diff options
author | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-28 17:12:40 -0400 |
---|---|---|
committer | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-28 17:12:40 -0400 |
commit | 0b0616c6f7400ce52d07350f7a7054a2513d9813 (patch) | |
tree | 9681e9c5b6e14ee2c697b2e659b0cc2296ff24e5 /python/src/sa/suffix_array.pxi | |
parent | b81b2e85bdfd5e9dda98a6e448e6354ca0c6d26b (diff) |
[python] Suffix array compiler can read bitext (-b)
Diffstat (limited to 'python/src/sa/suffix_array.pxi')
-rw-r--r-- | python/src/sa/suffix_array.pxi | 8 |
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) |