Add Python API (#31)

This commit is contained in:
Fangjun Kuang
2023-02-19 19:36:03 +08:00
committed by GitHub
parent 8acc059b3f
commit ea09d5fbc5
51 changed files with 967 additions and 57 deletions

View File

@@ -0,0 +1,27 @@
function(sherpa_onnx_add_py_test source)
get_filename_component(name ${source} NAME_WE)
set(name "${name}_py")
add_test(NAME ${name}
COMMAND
"${PYTHON_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/${source}"
)
get_filename_component(sherpa_onnx_path ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
set_property(TEST ${name}
PROPERTY ENVIRONMENT "PYTHONPATH=${sherpa_path}:$<TARGET_FILE_DIR:_sherpa_onnx>:$ENV{PYTHONPATH}"
)
endfunction()
# please sort the files in alphabetic order
set(py_test_files
test_feature_extractor_config.py
test_online_transducer_model_config.py
)
foreach(source IN LISTS py_test_files)
sherpa_onnx_add_py_test(${source})
endforeach()