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

Changing default language of the math evaluation logic adapter #1115

Closed
xiaolitang opened this issue Dec 13, 2017 · 8 comments
Closed

Changing default language of the math evaluation logic adapter #1115

xiaolitang opened this issue Dec 13, 2017 · 8 comments
Labels

Comments

@xiaolitang
Copy link

Hello!

I was wondering if it is possible to the change the default language 'ENG' into other languages of the mathematical evaluation logic adapter at this stage?

Thank you very much!

@gunthercox
Copy link
Owner

ChatBot(
    language='ITA'
)

I will note, that not all languages are supported by the mathematical evaluation adapter yet. You can find out the list of supported languages by looking at the MATH_WORDS dictionary in https://github.com/gunthercox/mathparse/blob/master/mathparse/mathwords.py

(MathParse is the library that ChatterBot uses to evaluate math string expressions)

@xiaolitang
Copy link
Author

xiaolitang commented Dec 14, 2017

Thank you gunthercox,

I added Mandarin into the dictionary in math words file and changed the default language. But when I ran the bot, it never went through the mathematical evaluation logic adapter.

The logging shows:
INFO:chatterbot.adapters:Not processing the statement using MathematicalEvaluation

This occurs no matter the order of logic adapters I put when initialising the bot.

@gunthercox
Copy link
Owner

What was the input? Perhaps it was something that the math adapter didn't detect as a mathematical string?

@xiaolitang
Copy link
Author

Thank you gunthercox,

My input was '二加二‘ in Mandarin which means 'two plus two'.
I have made some changes in math word file that indicating '二‘ and '加' represents 2 and + respectively, as other languages.

@gunthercox
Copy link
Owner

Ah, I think I know what the issue is. The tokenizer in the mathparse library splits math tokens based on spaces. I think I'll have to make some adjustments to the code to change how it tokenizes Mandarin.

@xiaolitang
Copy link
Author

Thanks gunthercox,

I see. Thank you in advance for the adjustments to fit Mandarin.

@gunthercox
Copy link
Owner

I'm going to close this ticket off, I've created a new one with a proposed solution in the issue tracker for mathparse (gunthercox/mathparse#19).

@xiaolitang I might have a few more questions about Mandarin that I may need your help with.

@xiaolitang
Copy link
Author

Sure, I would love to help ;)

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

No branches or pull requests

3 participants