How to streamline for story dictation? Trying to make a rule for quotation marks
I am trying to make a rule for quotation marks like so (where I say "QQ"):
Pattern: [\s\,\?\!\.]*QQ[\s\,\?\!\.]*(\w)?
Replacement: " \U\1
I works. But the quotations are in the wrong area. What's the best way to achieve this for dialog?
Thanks for your question. I'm guessing that a simple replacing is not what you need.
Can you give me some examples of input and output text? I want to better understand how this should work.
No. A simple replace doesn't seem to work. Because when I dictate, this is what I get generated:
" are you sure " he asked?
Despite it shows up correctly in this:
Here's an example of what I am expecting with quotation marks while dictating:
What I am looking for is to have the output be like this:
"Hi there," he said casually.
And when it comes to a person's name (instead of a comma, use a period):
"Hi there." Jack said casually.
But also, I am looking for a solution to question marks and exclamation points:
Should be:
"Are you the developer?" He asked.
Should be:
"Amazing!" He said with enthusiasm.
If I could discover the proper pattern I should use and how to replace the trigger QQ with quotation marks when I say it, that would be great.
I haven't spent much time, but I have some ideas :)
It is better to divide the task into several rules. The rules are applied sequentially, and the output of the first rule (transformed text) becomes the input for the next rule. By combining rules, you can build a very complex transformation, but it is not a trivial task.
I came up with the following:
- Rule 1: Transform
QQ<text>QQto"<text>"and make the first letter capital.
(\s*)QQ\,?\.?\s*([^\s\,\.])(.*[^\s])\s*QQ\,?\.?(\s*) → \1"\U\2\3"\4
All the following are transformed to "Are you sure." he asked?
QQ, are you sure. QQ, he asked?QQ. are you sure. QQ. he asked?QQ are you sure. QQ he asked?
- Rule 2: If sentence ends with
!or?, move punctuation mark into text inside""
([\.\?\!])("\s[^\.\?\!]*)([\?\!]) → \3\2\1
Example: "Are you sure." he asked? → "Are you sure?" he asked.
- Rule 3: Replace
,to.if next after"isJackorEmma
\,("\s)(Jack|Emma) → .\1\2
Example: "Hi there," Jack said casually. → "Hi there." Jack said casually.
Hopefully, this will be helpful. Of course, these are just examples and not all your cases are covered.
I see you put time into this:
But the name Jack was just an example as to what I am trying to get across to you.
Basically, for he said/she said, I am looking for this:
"Hi there," he said.
And when I was using the name 'Jack,' I was referring to have the output be like this:
"Hi there." [NAME] said.
Really, I am just look for rules that I could set for writing. I've been monkeying around with rules myself. So far, I don't have anything concrete either.
I would do a simple replace of QQ for " (a quotation mark) if there was no spaces or periods at the end. Like this:
Pattern: QQ
Replacement text: "
Example output while dictating:
".
". Are you sure? ". He asked.
And when I was using the name 'Jack,' I was referring to have the output be like this: "Hi there." [NAME] said.
If you don't want to explicitly list NAMES in a rule (like Jack|Emma|...), you need to find something that distinguishes this particular case. For example, I was thinking of adding . only if [NAME] starts with a capital letter, but unfortunately, currently the patterns are case-insensitive, so you can't create such a rule :/
I would do a simple replace of QQ for " (a quotation mark) if there was no spaces or periods at the end. Like this: Pattern: QQ Replacement text: " Example output while dictating: ". ". Are you sure? ". He asked.
The spaces and . or , are because decoded text from the STT engine is:
QQ. Are you sere? QQ. He asked
after simple replacement QQ → " it becomes
". Are you sere? ". He asked.
To solve this problem, you can create regular expression rule as I suggested earlier (rule 1), or add an additional rule to "clean up" those unnecessary dots and spaces.
Example: "\.\s*([^\s].*[^\s])\s*\"\. → "\1". This captures (()) text inside " that starts and ends with non-white-space character (\s - white-space, [^\s] - negation of white-space). Captured text is available as \1 and it is transformed to "\1".
It is quite powerful, but also quite complicated.
I am already lost on this.
And this:
Rule 1: Transform QQ<text>QQ to "<text>" and make the first letter capital.
(\s*)QQ\,?\.?\s*([^\s\,\.])(.*[^\s])\s*QQ\,?\.?(\s*) → \1"\U\2\3"\4
Just gives me this when I dictate:
Kew, hi there, Kew Kew. Kew.
Also, I took this from the "new line" pattern and made this:
[\s*\,]?quotation[\s\-]*mark[\s\,\?\!\.]* → "
Which will give me this:
"Are you sure? Are you sure"
Don't know why I am getting double "Are you sure." But it's progress, maybe. Think I just need a dedicated USB microphone for better dictation. Maybe a Blue Yeti?