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

Add support for numeric strings without spaces #19

Open
gunthercox opened this issue Dec 20, 2017 · 2 comments
Open

Add support for numeric strings without spaces #19

gunthercox opened this issue Dec 20, 2017 · 2 comments

Comments

@gunthercox
Copy link
Owner

gunthercox commented Dec 20, 2017

The tokenizer currently splits math tokens based on whitespace.

In Mandarin 二加二 means "'two plus two" but no spaces are used between the characters.

The tokenizer needs to be modified so that it will split these values correctly.


I believe the optimal solution might be to have the tokenizer ignore whitespace and traverse the values in the string based on the type they get recognized as. So, in this case, the first value would be read and added to the stack of numbers, then the next value would be read and added to the binary operator stack, and so on. No need to split on whitespace.


Previously reported as gunthercox/ChatterBot#1115

@gunthercox
Copy link
Owner Author

@xiaolitang I have a few questions to try to make sure that my proposed solution will work.

Can you give me an example of the following math statements in Mandarin? I'd like to see what they look like with unary operators.

Negative two plus two:

-2 + 2

Two raised to an exponent of two
22

@xiaolitang
Copy link

xiaolitang commented Dec 20, 2017 via email

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