Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

JSGF/FSG model build/load log weight incompatibility #79

Open
lv-gh opened this issue Apr 6, 2020 · 4 comments
Open

JSGF/FSG model build/load log weight incompatibility #79

lv-gh opened this issue Apr 6, 2020 · 4 comments

Comments

@lv-gh
Copy link

lv-gh commented Apr 6, 2020

test.gram:

#JSGF V1.0 UTF-8;
grammar test;
public <test> = hello /10/ world;

jsgf weights > 1.0 are OK (and i suppose are pretty valid) to jsgf_build_fsg_internal() and that grammar can be used for decoding (-jsgf) and/or exported to fsg:

sphinx_jsgf2fsg -jsgf test.gram -fsg test.fsg

FSG_BEGIN <test.test>
NUM_STATES 3
START_STATE 0
FINAL_STATE 2
TRANSITION 0 1 1.000000 hello
TRANSITION 1 2 9.999998 world
FSG_END

But resulting fsg can't be loaded:

ERROR: "fsg_model.c", line 667: Line[6]: transition spec malformed; Expecting float as transition probability

because fsg_model_read() requires all log weights/probabilities to be <= 1.0:

@nshmyrev
Copy link
Contributor

nshmyrev commented Apr 8, 2020

Thanks for reporting. I would consider it a minor issue.

@lv-gh
Copy link
Author

lv-gh commented Apr 8, 2020

Well, it is a minor issue, but without modifying source code i can't use sphinx in this scenario: jsgf -> fsm -> OpenFst minimization (log arcs/weights) -> fsm2fsg.

@nshmyrev
Copy link
Contributor

nshmyrev commented Apr 8, 2020

Don't use jsgf, just build the language models. See also for details:

alphacep/vosk-api#55

@lv-gh
Copy link
Author

lv-gh commented Apr 8, 2020

Thanks. Experiments shows that FSG works better. Besides it's a specific domain (valid/known address dictation; not much of a freedom to spell address differently that statistical language models would benefit)

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

No branches or pull requests

2 participants