Ecolss Logan
9 years ago
Hi Cythoners, reeeeally need your help
I'm writing a text processing tool using Cython, and I encountered a
problem.
Briefly what I want to do is, given a string (might contain CJK
characters), and a dictionary (containing all the vocabulary, also might be
CJK characters), then segment the string into words which exist in the
dictionary.
I intend to store all the string and vocabulary as *Unicode*, since they
might be *CJK*.
In respect of the dictionary, I could use hash table container to store all
the vocabulary, like Python's* dict/set*, but what about C++'s*
unordered_map/unordered_set*, I tried something like below:
from libcpp.unordered_set cimport unordered_set
cdef unordered_set[unicode] vocab
but it wouldn't work at all, error saying:
Python object type 'unicode object' cannot be used as a template argument
so how to do it if I insist using C++'s hash table container to store all
the CJK vocabulary?
Thanks
I'm writing a text processing tool using Cython, and I encountered a
problem.
Briefly what I want to do is, given a string (might contain CJK
characters), and a dictionary (containing all the vocabulary, also might be
CJK characters), then segment the string into words which exist in the
dictionary.
I intend to store all the string and vocabulary as *Unicode*, since they
might be *CJK*.
In respect of the dictionary, I could use hash table container to store all
the vocabulary, like Python's* dict/set*, but what about C++'s*
unordered_map/unordered_set*, I tried something like below:
from libcpp.unordered_set cimport unordered_set
cdef unordered_set[unicode] vocab
but it wouldn't work at all, error saying:
Python object type 'unicode object' cannot be used as a template argument
so how to do it if I insist using C++'s hash table container to store all
the CJK vocabulary?
Thanks
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.