nerd-dictation
nerd-dictation copied to clipboard
punctuate-from-previous-timeout not punctuating
The current documentation makes it seem like using this command should result in fully punctuated sentences:
nerd-dictation begin --full-sentence --continuous --punctuate-from-previous-timeout=2 --timeout=4
But instead I'm getting something like this: "Sentence oneSentence two"
Hi,
I think you have an error in the command. ( twice -timeout=x) Try the follow one, it works fine.
nerd-dictation begin --continuous --full-sentence --punctuate-from-previous-timeout 2
this is not my problem,
the timeout option is there so that nerd dictation will auto end after x amount of silence without me having to use 'nerd-dictation end'. It has no effect on the punctuation timeout.
Actually, What I've just realized is that --punctuate-from-last-timeout does nothing at all for me, I get the same result with or without it. I thought --punctuate-from-last-timeout was setting the interval of silence that triggers a new sentence, but that, along with the removal of the space between sentences, seems to be handled by the --continuous option with no apparent way of setting that interval.
What do you mean by "it works fine" ? are you actually getting automatic punctuation?
I noticed that deleting --continuous no longer sticks the dictation when paused. Is this what you were looking for?
What do you mean by "it works fine" ? are you actually getting automatic punctuation?
Unfortunately not ! I'm testing to select the best options ( in french).
Actually... I'm really not too smart. The first time I tried to write a config I failed to get what I needed. Just now I took the default user configuration file and replaced
return " ".join(words)
with
return " ".join(words) + ". "
This basically does everything I need for now when using the --continuous option. I mean, Ideally the correct punctuation would would just appear in the right place as I speak instead of only periods, but I imagine that would involve a second language model on top of vosk just for punctuation, which seems superfluous to me when I'll likely have to proof read and do some editing anyways.
Not sure If I should close this after finding a workaround, Its still unclear to me what --punctuate-from-previous-timeout does if anything at all
I feel like I got good results. Here's how I incorporated your input: If you pause, (# I paused) the program does not capitalize. This is a great improvement. How lucky! It's a great job?
`# -----------------------------------------------------------------------------
Main Processing Function
def nerd_dictation_process(text):
for match, replacement in TEXT_REPLACE_REGEX:
text = match.sub(replacement, text)
for match, replacement in CLOSING_PUNCTUATION.items():
text = text.replace(" " + match, replacement)
for match, replacement in OPENING_PUNCTUATION.items():
text = text.replace(match + " ", replacement)
words = text.split(" ")
for i, w in enumerate(words):
w_init = w
w_test = WORD_REPLACE.get(w)
if w_test is not None:
w = w_test
if w_init == w:
for match, replacement in WORD_REPLACE_REGEX:
w_test = match.sub(replacement, w)
if w_test != w:
w = w_test
break
words[i] = w
# Strip any words that were replaced with empty strings.
words[:] = [w for w in words if w]
# return " ".join(words)
Add sentence case
REGEX_SENTENCE = re.compile(r"[\.?!] [a-z]")
def apply_sentence_case(match):
return match.group(0).upper()
text = REGEX_SENTENCE.sub(apply_sentence_case, text)
#...
return text`
I forget to use '' for code !
Command ( without --continuous )
nerd-dictation begin --full-sentence --punctuate-from-previous-timeout 2
Example :
If you pause, (# I paused) the program does not capitalize. This is a great improvement. How lucky! It's a great job!
I'm sorry, I don't think we're on the same page I'm fine with sentences being capitalized when after a moment of silence. My problem wasn't that first letter of the first word after a moment of silence was being capitalized, my problem was that there was no punctuation or spaces being included before the capitalized letter (which I thought --punctuate-from-last-timeout would produce based on the documentation)
I wouldn't omit --continuous in cases that I wanted to dictate multiple sentences.
But most importantly I do not want to have to say "comma" or "period" while I am speaking to punctuate my sentences. If you did not do that to get the punctuation in your example you will have to explain to me how.
My way of solving sentences getting cut off early while I'm looking for words (when using the continuous option) is just to fill the pauses with filler words (um, uh, eh) and then filter them out with the config. (Edit. I didn't actually try this until now, it doesn't actually prevent the current sentence from ending)
But most importantly I do not want to have to say "comma" or "period" while I am speaking to punctuate my sentences. If you did not do that to get the punctuation in your example you will have to explain to me how.
Unfortunately, I need to say "period" (point, in french), etc. In my example, I said the punctuation and that works well.
sentences getting cut off early while I'm looking for words
I didn't notice it.
The command I use nerd-dictation begin --full-sentence --punctuate-from-previous-timeout 2
doesn't cut off sentences. I didn't stay a long time without speaking, I'm not sure there is a time limit.
The option
--timeout SECONDS
= Time out recording when no speech is processed for the time in seconds. This can be used to avoid having to explicitly exit (zero disables).
If I have read and understood correctly, this command cuts off sentences if no words after x seconds. It's different from this one :
--punctuate-from-previous-timeout SECONDS
= The time-out in seconds for detecting the state of dictation from the previous recording, this can be useful so punctuation it is added before entering the dictation(zero disables).
I don't know if this can help you... I did my best !