summaryrefslogtreecommitdiff
path: root/sa-extract/cstrmap.pyx
blob: d3883ea58071296f719b0ed28c70fce33121766f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

cdef class StringMap:
    def __cinit__(self):
        self.vocab = stringmap_new()

    def __dealloc__(self):
        stringmap_delete(self.vocab)
        
    cdef char *word(self, int i):
        return stringmap_word(self.vocab, i)

    cdef int index(self, char *s):
        return stringmap_index(self.vocab, s)