Skip to content

Commit

Permalink
Allow passing docid as string instead of bytes #26
Browse files Browse the repository at this point in the history
For backward-compatibility, passing bytes is still allowed as well
  • Loading branch information
proycon committed Nov 20, 2023
1 parent 1babaa4 commit e169d84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frog_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ cdef class FrogOptions:
elif key.lower() in ('debug','debugflag'):
if value: self.capi.insert(<char>b"d", <string>b"1", False)
elif key.lower() in ('docid','id'):
self.capi.insert(<string>b"id", <string>value)
if isinstance(value, bytes):
self.capi.insert(<string>b"id", <string>value)
else:
self.capi.insert(<string>b"id", <string>value.encode('utf-8'))
elif key.lower() in ('numthreads','threads'):
self.capi.insert(<string>b"threads",<string>value)
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

setup(
name = 'python-frog',
version = '0.6.8', #also ensure UCTODATAVERSION and FROGDATAVERSION are good in frog_wrapper.pyx
version = '0.6.9', #also ensure UCTODATAVERSION and FROGDATAVERSION are good in frog_wrapper.pyx
author = "Maarten van Gompel",
author_email = "[email protected]",
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."),
Expand Down

0 comments on commit e169d84

Please sign in to comment.