what's the best practice to write a parser for speech recognition results ?
See original GitHub issuei want to create a smiple parser for speech recognition results ,the grammar going to be complex that’s why i want some advices about how to deal with complex grammar . i have this simple example below using speech recognition api and lark parser :
from lark import Lark,Token, Transformer, v_args
from helpers.file_process import FileProcess
import numpy as np
speech_grammar = """
start : KEY TYPE FNAME PATH?
KEY : "create" | "delete" | "open" | "read" | "make"
TYPE : "file" | "folder"
FNAME : (/[a-z]/)+
PATH : (/[a-zA-Z]/)+":"(/[\\/]/)+DIRNAME
DIRNAME : ((/[a-zA-Z0-9]/)+(/[\\/]/)?)*
%ignore (" ")+
"""
speech_parser = Lark(speech_grammar)
def run(input):
try:
speech = speech_parser.parse(input)
instr=np.array(speech.children)
return FileProcess(instr).request_process()
except Exception as err :
return err
def main(input):
return run(input)
def test():
print(run("make file test d:/test"))
print(run("delete file test"))
i will add more terminals (Vt) in the grammar part , any suggestions or advices would be much appreciated ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
All About Parsing: What it is, and how it relates to Text-to ...
At its basest definition, 'parsing' is “to analyze (a sentence, in this case) in terms of grammatical constituents, identifying the parts of speech, ......
Read more >The Ultimate Guide To Speech Recognition With Python
An in-depth tutorial on speech recognition with Python. Learn which speech recognition library gives the best results and build a full-featured "Guess The ......
Read more >SRGS Best Practices | LumenVox Knowledgebase
Any input to a grammar should only have one valid parse (the Grammar Editor tool, included with the LumenVox Speech Tuner, can show...
Read more >A Guide To Parsing: Algorithms And Terminology
An in-depth coverage of parsing terminology an issues, together with an explanation for each one of the major algorithms and when to use...
Read more >An Analysis of Using Semantic Parsing for Speech Recognition
This thesis explores the use of semantic parsing for improving speech recognition performance. Specifically, it explores how a semantic parser may be used ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It sounds like you’re asking about the lingual interface, rather than parsing.
Maybe if you provide some examples of the output you’re getting (or hoping to get) from the voice API, we can tell you how to parse it.
I would suggest considering a “DSL” for the paths that’s more natural for speaking, like “drive d folder myfolder”
the grammar describe how users interact with speech api , we can’t use “create file test d:/myfolder” like that because the api doesn’t understand the path and it doesn’t have the concatenation between each path item, is there any way to make it easier to understand and use for speech api?