Skip to content

Commit 7a11972

Browse files
AndreasArvidssonpre-commit-ci[bot]nriley
authored
Added spelling prose capture (#2045)
Allows commands like `"say should we meet at spell air bat cap later"` and `spell air bat cap` will be replaced by `abc`. Should we add this to the text capture as well? Otherwise it won't work with code formatters. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nicholas Riley <[email protected]>
1 parent 74bbe58 commit 7a11972

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/text/text_and_dictation.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ def prose_time(m) -> str:
114114
return str(m)
115115

116116

117+
@mod.capture(rule="spell <user.letters>")
118+
def prose_spell(m) -> str:
119+
"""Spell word phonetically"""
120+
return m.letters
121+
122+
117123
@mod.capture(rule="clip clip")
118124
def prose_clipboard(m) -> str:
119125
"""Clipboard content"""
@@ -134,7 +140,7 @@ def word(m) -> str:
134140

135141

136142
@mod.capture(
137-
rule="({user.vocabulary} | <user.prose_contact> | <user.prose_clipboard> | <phrase>)+"
143+
rule="({user.vocabulary} | <user.prose_contact> | <user.prose_spell> | <user.prose_clipboard> | <phrase>)+"
138144
)
139145
def text(m) -> str:
140146
"""A sequence of words, including user-defined vocabulary."""
@@ -154,6 +160,7 @@ def text(m) -> str:
154160
"| <user.prose_modifier>"
155161
"| <user.abbreviation>"
156162
"| <user.prose_contact>"
163+
"| <user.prose_spell>"
157164
"| <user.prose_clipboard>"
158165
"| <phrase>"
159166
")+"
@@ -177,6 +184,7 @@ def prose(m) -> str:
177184
"| <user.prose_percent>"
178185
"| <user.abbreviation>"
179186
"| <user.prose_contact>"
187+
"| <user.prose_spell>"
180188
"| <user.prose_clipboard>"
181189
"| <phrase>"
182190
")+"

0 commit comments

Comments
 (0)