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

[Query] number parser #62

Open
StarTrooper08 opened this issue Mar 21, 2021 · 5 comments
Open

[Query] number parser #62

StarTrooper08 opened this issue Mar 21, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@StarTrooper08
Copy link

StarTrooper08 commented Mar 21, 2021

Number parser example

number parser

can we make that 1 as 1st .
Something like this 🤔
np2

@Gallaecio Gallaecio added the enhancement New feature or request label Mar 22, 2021
@Gallaecio
Copy link
Member

I guess we could have a parameter that allows to determine whether ordinals are turned into ordinals or cardinals. Maybe ordinal syntax would be a better default.

I also wonder if there are languages out there without an shorthand symbol to append to cardinal numbers to mark them as ordinals. If so, it may also be useful to provide a way to format these numbers with additional flexibility, e.g. allowing to define a custom string to use as suffix, or providing a callback parameter to do custom, complex formatting of these.

@StarTrooper08
Copy link
Author

There is one easy way to do it.
I mean there is one python function which can do that changes in easy way.

@StarTrooper08
Copy link
Author

from num2words import num2words 
print(num2words(4, to = 'ordinal_num'))

Can we use this code to make the following changes 🤔 .

@Gallaecio
Copy link
Member

Gallaecio commented Mar 22, 2021

https://github.com/savoirfairelinux/num2words looks good for that use case, yes. They seem well maintained, and support multiple locales. If we need any functionality they already have, like in here, I think we should just add them as a dependency rather than reimplement the functionality ourselves.

@arnavkapoor
Copy link
Collaborator

From my experience by working on this project last year there are a number of tools that do allow you to go from Number -> Words like the num2words library, however the other way around Words -> Number is trickier with less support.

Hence the primary challenge becomes to identify that the word 'First' (and other ordinal numbers in different languages) are actually referring to an ordinal number.
You can see see more detailed discussions on this issue at #6

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

No branches or pull requests

3 participants