Expose DS error codes in ds_ctcdecoder package
This commit is contained in:
parent
afb8c55b6e
commit
4db20b3cd6
@ -5,6 +5,12 @@ from .swigwrapper import Alphabet
|
||||
|
||||
__version__ = swigwrapper.__version__
|
||||
|
||||
# Hack: import error codes by matching on their names, as SWIG unfortunately
|
||||
# does not support binding enums to Python in a scoped manner yet.
|
||||
for symbol in dir(swigwrapper):
|
||||
if symbol.startswith('DS_ERR_'):
|
||||
globals()[symbol] = getattr(swigwrapper, symbol)
|
||||
|
||||
class Scorer(swigwrapper.Scorer):
|
||||
"""Wrapper for Scorer.
|
||||
|
||||
|
@ -41,3 +41,9 @@ namespace std {
|
||||
%template(IntVector) std::vector<int>;
|
||||
%template(OutputVector) std::vector<Output>;
|
||||
%template(OutputVectorVector) std::vector<std::vector<Output>>;
|
||||
|
||||
// Import only the error code enum definitions from deepspeech.h
|
||||
%ignore "";
|
||||
%rename("%s", regexmatch$name="DS_ERR_") "";
|
||||
%rename("%s", regexmatch$name="DeepSpeech_Error_Codes") "";
|
||||
%include "../deepspeech.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user