Python Forum
Python Speech recognition, word by word
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Speech recognition, word by word
#1
Hello, I have been using the python Speech Recognition module for a few days now and i cant seem to make it do what i need.

Basically i want  to transcribe the audio input word by word rather than a full sentence.
Example: if i say "hello python how are you", currently it will listen to the full sentence, then output the result.
I want it so it will only take one word at a time as an input so if i say the same sentence it will out put "hello" "python" "how" "are" "you"

To clarify i don't want to split the string up but rather take each word and transcribe it on the fly.
The end result would be to read an entire essay word by word and have it transcribed in real time back to a text document, regardless of length.
Currently, if i start reading it will wait for a long pause and then start transcribing, in which i would have to wait for it to finish before continuing speaking.

sorry its a little tricky to explain.
Reply
#2
link the github repo or wherever you got this speech recognition module
Reply
#3
I guess you'll get the output as string of the speech_recognition function/callback. You can split the str with the method split into words, when you're not passing any argument.
https://docs.python.org/3.6/library/stdt...#str.split
For further natural language processing, you should take a look here.
My code examples are always for Python >=3.6.0
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
im not looking to split the string as my OP describes.
Im looking to record a single word, add that to a string or list, then record another word and etc until a sentence has been complete. Rather than record a spoken sentence into a string.
Right now if i say "Hello World" it will output the string "Hello World", that's 1 loop of the code.
I want it so if i say "Hello World" it will output "Hello" "World", that's 2 loops, the first processed Hello, the second processed World.

Im using the standard Speech Recognition module, https://github.com/Uberi/speech_recognition
Reply
#5
Update:
I have been looking at the source and found ares which match what im looking for
self.pause_threshold = 0.8  # seconds of non-speaking audio before a phrase is considered complete
self.phrase_threshold = 0.3  # minimum seconds of speaking audio before we consider the speaking audio a phrase - values below this are ignored (for filtering out clicks and pops)
self.non_speaking_duration = 0.5  # seconds of non-speaking audio to keep on both sides of the recording
so means you have to talk for at least 0.3 seconds and the length of the audio has to be at least 1.3 seconds (0.5 + 0.3 + 0.5)
( file __init__.py, class Recognizer, line 444)

is there a way to lower these values without editing the source values. i dont mind having 2-3 words per process i just dont want to process an entire paragraph per loop as it takes too long.
Reply
#6
https://github.com/Uberi/speech_recognit...__.py#L444
Somewhere in your program you're creating an instance of Recognizer().
Like this example: https://github.com/Uberi/speech_recognit...stening.py

r = sr.Recognizer()
r.pause_threshold = 1.0
r.phrase_threshold = 1.0
r.non_speaking_duration = 1.0
This should work...
My code examples are always for Python >=3.6.0
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#7
(Aug-19-2017, 09:59 PM)AceScottie Wrote: Hello, I have been using the python Speech Recognition module for a few days now and i cant seem to make it do what i need.

Basically i want to transcribe the audio input word by word rather than a full sentence.
Example: if i say "hello python how are you", currently it will listen to the full sentence, then output the result.
I want it so it will only take one word at a time as an input so if i say the same sentence it will out put "hello" "python" "how" "are" "you"

To clarify i don't want to split the string up but rather take each word and transcribe it on the fly.
The end result would be to read an entire essay word by word and have it transcribed in real time back to a text document, regardless of length.
Currently, if i start reading it will wait for a long pause and then start transcribing, in which i would have to wait for it to finish before continuing speaking.

sorry its a little tricky to explain.


are you able to do that
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Speech Recognition with timestamps DeanAseraf1 3 2,705 Jun-27-2021, 06:58 PM
Last Post: gh_ad
  Docx Convert Word Header to Body CaptainCsaba 3 352 Jun-02-2021, 01:25 PM
Last Post: Larz60+
  Сombine (Merge) word documents using python-docx Lancellot 1 2,317 May-12-2021, 11:07 AM
Last Post: toothedsword
  remove vowels in word with conditional ambrozote 12 662 May-02-2021, 06:57 PM
Last Post: perfringo
  How to read check boxes from word document srikanthpython 0 362 Mar-30-2021, 01:58 PM
Last Post: srikanthpython
  looping wordlist keeps repeating when word not found OTH 1 427 Feb-24-2021, 05:36 PM
Last Post: nilamo
Thumbs Down extracting data/strings from Word doc mikkelibsen 1 435 Feb-10-2021, 11:06 AM
Last Post: Larz60+
Question Word, adding a hyperlink from a bookmark using Python mart79 1 448 Jan-14-2021, 08:41 PM
Last Post: Larz60+
  Trying to get the first letter of every word in a list DanielCook 2 512 Jan-05-2021, 05:06 PM
Last Post: deanhystad
  [GoogleTrans] How can i print my translation word ?... JamieVanCadsand 6 7,916 Dec-23-2020, 04:38 PM
Last Post: shyamkumardr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020