Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/dawg.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ cdef class DAWG:
cpdef bint b_has_key(self, bytes key) except -1:
return self.dct.Contains(key, len(key))

cpdef bytes tobytes(self):
cpdef bytes tobytes(self) except +:
"""
Return raw DAWG content as bytes.
"""
Expand Down Expand Up @@ -176,6 +176,17 @@ cdef class DAWG:

def _file_size(self):
return self.dct.file_size()

cpdef BaseType root(self):
return self.dct.root()

cpdef (bint, BaseType) follow(self, unicode label, BaseType index):
cdef bytes _label = <bytes>label.encode('utf8')
rs = self.dct.Follow(_label, &index)
return rs, index

def has_value(self, index: BaseType) -> bool:
return self._has_value(index)

cdef bint _has_value(self, BaseType index):
return self.dct.has_value(index)
Expand Down