Skip to content

Commit e169d84

Browse files
committed
Allow passing docid as string instead of bytes #26
For backward-compatibility, passing bytes is still allowed as well
1 parent 1babaa4 commit e169d84

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

frog_wrapper.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ cdef class FrogOptions:
122122
elif key.lower() in ('debug','debugflag'):
123123
if value: self.capi.insert(<char>b"d", <string>b"1", False)
124124
elif key.lower() in ('docid','id'):
125-
self.capi.insert(<string>b"id", <string>value)
125+
if isinstance(value, bytes):
126+
self.capi.insert(<string>b"id", <string>value)
127+
else:
128+
self.capi.insert(<string>b"id", <string>value.encode('utf-8'))
126129
elif key.lower() in ('numthreads','threads'):
127130
self.capi.insert(<string>b"threads",<string>value)
128131
else:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
setup(
6868
name = 'python-frog',
69-
version = '0.6.8', #also ensure UCTODATAVERSION and FROGDATAVERSION are good in frog_wrapper.pyx
69+
version = '0.6.9', #also ensure UCTODATAVERSION and FROGDATAVERSION are good in frog_wrapper.pyx
7070
author = "Maarten van Gompel",
7171
author_email = "[email protected]",
7272
description = ("Python binding to Frog, an NLP suite for Dutch doing part-of-speech tagging, lemmatisation, morphological analysis, named-entity recognition, shallow parsing, and dependency parsing."),

0 commit comments

Comments
 (0)