Add spanish folder
Hello again. This PR is for adding a spanish-format numbers. I have added several parameters to test with dates and numbers. I hope it is useful, as I have tried to adapt as much as I could. If it is possible to test its operation, I thank you in advance.
Thank you! I pushed a commit that copy-pasted the files from Italian into Spanish, since Spanish is quite similar to Italian, though there is some stuff that needs to be adapted and some hardcoded values that need to be changed in the kotlin files. Here is a build of Dicio based on that commit, you will see that now the timer and calculator skills are available in Spanish, too. And it also kind of works already, see the screenshot below, however it didn't understand "one million" for some reason. https://github.com/Stypox/testing-apks/releases/download/15/app-debug.apk
To make this complete you would need to:
- write some tests under
src/test/java/org/dicio/numbers/lang/es/e.g. by copy-pasting and translating those from English or Italian (adapting to the differences in Spanish obviously) - work through the kotlin code to fix the failing tests and add more functions (or remove some) if you need
I would help you out but I don't know Spanish, though let me know if you have any question about the code :grimacing:
Thank you. I made a few tweaks in the tokenizer. And I added the test folder to perform tests with Spanish. It will take a few days to complete the translation or adaptation. Hopefully I will finish it when I have some time.
I asked Gemini 2.5 Pro to take on the challenge of adapting the code to follow the logic of the Spanish language and found it interesting that it made modifications in a matter of minutes, including absurd situations that I have not imagined to do (like "tres cientos" when the right word is "trescientos"). I hope this commit is useful for you to review and make other modifications ("lang" folder).
Thanks! This is one of the first times I see LLMs actually being useful at writing code xD. I still had to fix a few compiler errors though.
I built again an APK, https://github.com/Stypox/testing-apks/releases/download/20/app-debug.apk, that will allow you to test:
- number parsing/formatting through the calculator skill
- duration parsing/formatting through the timer skill
- I added a new debug skill called "Calendar" to debug the datetime parsing/formatting (code here), it currently only accepts inputs of the form "evento 17 de junio" and only prints out debug information
However it didn't understand "one million" for some reason. https://github.com/Stypox/testing-apks/releases/download/15/app-debug.apk
I'm thinking that the app does not recognize words like “million” or “billion” in the singular but does recognize words like ‘millions’ and “biollons” in the plural.
Examples of spanish phrases to numbers:
- "dos mil": 2000
- "dos miles": 2
- "dos miles más tres": 2000 + 3
- "un millón": 1
- "un millones": 1000000
- "dos millones": "2000000"
- "diez millones": 10000000
- "mil millones": 1000 + 1000000
- "mil millón": 1000
- "miles millones más dos": 1000000 + 2
- "miles millones más mil": 1001000 + 1000
Perhaps the solution is to edit the multiplier block in tokenizer.json.
I have asked the AI to correct several details. Now I have fixed tokenizer to identify composite numbers taking references from the Italian one which brought better results. I am doing also with date_time.json.
About testing, I haven't managed to compile with APK because I haven't got it yet. Also, I'm using a lighter text editor. I'm sorry.
Thanks for your continued effort and sorry if some time has passed.
Here is another APK you can try, again with the fake calendar skill: https://github.com/Stypox/testing-apks/releases/download/26/app-debug.apk
I think this is misbehaving:
A lot of tests are also failing, here is the output from Android Studio:
Test Results - Tests_in_'org_dicio_numbers_lang_es'.html
About testing, I haven't managed to compile with APK because I haven't got it yet. Also, I'm using a lighter text editor. I'm sorry.
You should be able to use gradle directly, without needing a heavy text editor. Let me know if you need any help with commands :-)
Thanks for the news. I've been very busy lately, but I'll see if I can find some time to work on the date issue. For now, I'm still noticing the problem with the hundreds and the time format, as I just saw. I think Gemini is offering me options to manage multiple files and copy and paste them into the editor so I can polish them in real time. Unfortunately, I'm busy with personal matters that don't give me the time to get the mechanism working properly. I'll let you know if there are any developments regarding the Spanish translations.
