[Other] Avoid to accede C.text.SchemaLanguage (#463)

* avoid to accede C.text.SchemaLanguage

* Update SchemaLanguage python impl

* Add cast
This commit is contained in:
Jack Zhou
2022-10-31 19:35:12 +08:00
committed by GitHub
parent f2747133d6
commit 441b82de29

View File

@@ -19,8 +19,9 @@ from ... import RuntimeOption, FastDeployModel, ModelFormat
from ... import c_lib_wrap as C from ... import c_lib_wrap as C
class SchemaLanguage(C.text.SchemaLanguage): class SchemaLanguage(object):
pass ZH = 0
EN = 1
class SchemaNode(object): class SchemaNode(object):
@@ -61,6 +62,7 @@ class UIEModel(FastDeployModel):
schema = schema_tmp schema = schema_tmp
else: else:
assert "The type of schema should be list or dict." assert "The type of schema should be list or dict."
schema_language = C.text.SchemaLanguage(schema_language)
self._model = C.text.UIEModel( self._model = C.text.UIEModel(
model_file, params_file, vocab_file, position_prob, max_length, model_file, params_file, vocab_file, position_prob, max_length,
schema, runtime_option._option, model_format, schema_language) schema, runtime_option._option, model_format, schema_language)