summaryrefslogtreecommitdiff
path: root/python/src/sa/sym.pxi
diff options
context:
space:
mode:
authorAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
committerAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
commit3d8d656fa7911524e0e6885647173474524e0784 (patch)
tree81b1ee2fcb67980376d03f0aa48e42e53abff222 /python/src/sa/sym.pxi
parentbe7f57fdd484e063775d7abf083b9fa4c403b610 (diff)
parent96fedabebafe7a38a6d5928be8fff767e411d705 (diff)
fixed conflicts
Diffstat (limited to 'python/src/sa/sym.pxi')
-rw-r--r--python/src/sa/sym.pxi9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/src/sa/sym.pxi b/python/src/sa/sym.pxi
index f47599cf..f253aec0 100644
--- a/python/src/sa/sym.pxi
+++ b/python/src/sa/sym.pxi
@@ -104,6 +104,9 @@ cdef int sym_setindex(int sym, int id):
cdef int sym_fromstring(char* string, bint terminal):
return ALPHABET.fromstring(string, terminal)
+def isvar(sym):
+ return sym_isvar(sym)
+
def make_lattice(words):
word_ids = (sym_fromstring(word, True) for word in words)
return tuple(((word, None, 1), ) for word in word_ids)
@@ -114,3 +117,9 @@ def decode_lattice(lattice):
def decode_sentence(lattice):
return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice)
+
+def encode_words(words):
+ return tuple(sym_fromstring(word, True) for word in words)
+
+def decode_words(syms):
+ return tuple(sym_tostring(sym) for sym in syms) \ No newline at end of file