Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent customisable way to use decimals #1245

Open
auscompgeek opened this issue Aug 6, 2023 · 3 comments
Open

Consistent customisable way to use decimals #1245

auscompgeek opened this issue Aug 6, 2023 · 3 comments

Comments

@auscompgeek
Copy link
Collaborator

auscompgeek commented Aug 6, 2023

In the CSS support there's a couple of commands that recognise decimals:

value <user.number_string> [{user.css_unit}]: "{number_string}{css_unit or ''}"
value <user.number_string> point <digit_string> [{user.css_unit}]:
"{number_string}.{digit_string}{css_unit or ''}"

This only recognises how decimals are typically taught to be read in English-speaking classrooms (e.g. three point one four for 3.14). Some people might like to be able to dictate the fractional part of decimals like whole numbers though, e.g. twelve point thirty four for 12.34. Others might prefer to say dot instead of point.

We should add a decimal_string capture to allow this to be reused in other commands and customised globally.

@auscompgeek
Copy link
Collaborator Author

Something else just came to mind: not all locales use . for decimals, instead using ,. For programming though we'll still want a way to dictate decimals using . – not sure what the best way to do this is.

@auscompgeek
Copy link
Collaborator Author

Oh, interesting, just took a look at how we do it in dictation mode and we have a similar construction to what we have in CSS:

@mod.capture(rule="(numb | numeral) <user.number_string> (dot | point) <digit_string>")
def prose_number_with_dot(m) -> str:
return m.number_string + "." + m.digit_string

@AndreasArvidsson
Copy link
Collaborator

I would just extend the normal number command with this ability. We can either do two separate commands in the Talon file or make a capture that enables both?
eg
https://github.com/AndreasArvidsson/andreas-talon/blob/bd3e75779295d9f139d8bc614ecb54e50899d704/core/numbers/numbers.py#L207-L213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants