Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
knausj85 committed Nov 12, 2024
1 parent c4ea457 commit e5cc3f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
4 changes: 1 addition & 3 deletions core/numbers/numbers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterator, Union
from typing import Iterator, Union, math

from talon import Context, Module

Expand Down Expand Up @@ -32,8 +32,6 @@ def get_spoken_form_under_one_hundred(
):
"""Helper function to get dictionary of spoken forms for non-negative numbers in the range [start, end] under 100"""

import math

result = {}

for value in range(start, end + 1):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
list: user.currency_denomination
list: user.currency
-
dollar: $
dollars: $
euro: €
euros: €
pound: £
pounds: £
pounds: £
16 changes: 7 additions & 9 deletions core/text/text_and_dictation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
mod.list("hours_twelve", desc="Names for hours up to 12")
mod.list("hours", desc="Names for hours up to 24")
mod.list("minutes", desc="Names for minutes, 01 up to 59")
mod.list(
"currency_denomination", desc="Currency denominations that can be used within prose"
)
mod.list("currency", desc="Currency types (e.g., dollars, euros) that can be used within prose")

ctx = Context()
# Maps spoken forms to DictationFormat method names (see DictationFormat below).
Expand All @@ -45,9 +43,9 @@
"frowny": ":-(",
}

ctx.lists["user.hours_twelve"] = get_spoken_form_under_one_hundred(1, 12, True, True)
ctx.lists["user.hours"] = get_spoken_form_under_one_hundred(1, 23, True, True)
ctx.lists["user.minutes"] = get_spoken_form_under_one_hundred(1, 59, True, False)
ctx.lists["user.hours_twelve"] = get_spoken_form_under_one_hundred(1, 12, include_oh_variant_for_single_digits = True, include_default_variant_for_single_digits = True)
ctx.lists["user.hours"] = get_spoken_form_under_one_hundred(1, 23, include_oh_variant_for_single_digits = True, include_default_variant_for_single_digits = True)
ctx.lists["user.minutes"] = get_spoken_form_under_one_hundred(1, 59, include_oh_variant_for_single_digits = True, include_default_variant_for_single_digits = False)


@mod.capture(rule="{user.prose_modifiers}")
Expand Down Expand Up @@ -88,10 +86,10 @@ def prose_percent(m) -> str:


@mod.capture(
rule="<user.number_string> {user.currency_denomination} [[and] <user.number_string> [cents|pence]]"
rule="<user.number_string> {user.currency} [[and] <user.number_string> [cents|pence]]"
)
def prose_money(m) -> str:
s = m.currency_denomination + m.number_string_1
def prose_currency(m) -> str:
s = m.currency + m.number_string_1
if hasattr(m, "number_string_2"):
s += "." + m.number_string_2
return s
Expand Down

0 comments on commit e5cc3f4

Please sign in to comment.