Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Word Level Granularity For Python API #292

Open
ErrorBot1122 opened this issue Oct 10, 2022 · 1 comment
Open

Word Level Granularity For Python API #292

ErrorBot1122 opened this issue Oct 10, 2022 · 1 comment

Comments

@ErrorBot1122
Copy link

In the CLI Interface, you can turn on word level granularity by adding --presets-word, but I can't seem to find any function/property that turns that on in the Python Task Interface

@zxul767
Copy link

zxul767 commented Aug 4, 2023

I achieved it using the following:

config = TaskConfiguration()
config[gc.PPN_TASK_IS_TEXT_FILE_FORMAT] = TextFileFormat.MPLAIN
# other configurations...

rconf = RuntimeConfiguration()
rconf[RuntimeConfiguration.MFCC_MASK_NONSPEECH] = True
# L3 represents word granularity
rconf[RuntimeConfiguration.MFCC_MASK_NONSPEECH_L3] = True
rconf[RuntimeConfiguration.TTS_CACHE] = True
rconf.set_granularity(3)  # word-level granularity

task = Task()
task.configuration = config

ExecuteTask(task, rconf=rconf).execute()
task.output_sync_map_file() 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants