the issue is that you are adding a Math configuration in a text configuration.
Please add the "configuration5" in your math.conf file, it should then work.
Best regards,
Olivier
P
Pankaj Tyagi
said
about 3 years ago
Dear Mr. Olivier,
I have a query about this, if I use math-grm-standard.res instead of custom_grammar.res with the same .conf file, then it works fine and give results.
So, if it has to be put in a math.conf then why it is working with standard grammar.
Regards,
Pankaj Tyagi
P
Pankaj Tyagi
said
about 3 years ago
Dear Mr. Olivier,
I tried with math.conf file also, but the result is still same. It works well with standard grammar file but giving same error with my custom_grammar.res file.
Can you please check and let me know if there is any problem with my custom_grammar.res file.
Content of the custom grammar file is as :
symbol = 0 1 2 3 4 5 6 7 8 9
expression ::= identity(symbol)
start(expression)
What I try to achieve here is recognize on digits from 0 to 9.
Just adding it as follows in the math.conf, it worked out of the box:
Bundle-Version: 1.0 Bundle-Name: math Configuration-Script: AddResDir ../resources
Name: standard Type: Math Configuration-Script: AddResource math/math-ak.res AddResource math/math-grm-standard.res
Name: configuration5 Type: Math Configuration-Script: AddResource math/math-ak.res AddResource math/custom_grammar.res
Can you please try to proceed this way, and let us know if it works?
Best regards,
Olivier
P
Pankaj Tyagi
said
about 3 years ago
Dear Mr. Olivier,
Thank you for your help.
The resource file provided in the above link worked for me.
However, what I want to achieve is to recognize a 10 digit phone number written in box style space like 1 2 3 4 5 6 7 8 9 0.
With this resource file, it is only recognizing digits one by one and skipping few digits. I also added symbol ' ' in the resource file but result is same.
Can you give some suggestion on what should be done so that the result can be a 10 digit number.
Regards,
Pankaj Tyagi
O
Olivier @MyScript
said
about 3 years ago
Ddear Pankaj,
for such use-case, using a grammar defnition is not the best solution. Instead, we would recommend a "ludef", but it is not available on the developer portal.
Otherwise, you can update the grammar definition as below: This way, it can recognize numbers with an unlimited number of digits:
Thank you for your help, above grammar definition worked for me.
Regards,
Pankaj Tyagi
P
Pankaj Tyagi
said
about 3 years ago
Dear Mr. Olivier,
As mentioned in the previous comment, we achieved what we wanted with your help. Moreover, we would love to know about "ludef" and how can we implement this.
Regards,
Pankaj Tyagi
O
Olivier @MyScript
said
about 3 years ago
Dear Pankaj,
can you please provide with the exact specification of your field (number of digits, type of separator -comma, dot-)...
I will build it for you.
Best regards,
Olivier
P
Pankaj Tyagi
said
about 3 years ago
Dear Mr. Olivier,
We have 5 to 15 boxes placed adjacent to each other like any other number entering field and each box has one digit.
So, in a way we can say that 5 to 15 digits number where each digit is placed in a box.
Let me know if anything else you would like to know.
Regards,
Pankaj Tyagi
O
Olivier @MyScript
said
about 3 years ago
Dear Pankaj,
I just built the digits5to15.res resource that allows to recognize 5 to 15 digits.
Pankaj Tyagi
Hello,
I am trying to add a custom grammar file so that only digits from 0 to 9 get recognized but it is causing following error :
INVALID_OBJECT: error: AddResource custom_grammar.res failed
error: failed to read configuration script
script exits with 2 errors
My configuration file has following code:
Name: configuration5
Type: Math
Configuration-Script:
AddResource math-ak.res
AddResource custom_grammar.res
I have tried with following custom_grammar file contents :
symbol = 0 1 2 3 4 5 6 7 8 9
expression ::= identity(symbol)
start(expression)
and also with :
symbol = 0 1 2 3 4 5 6 7 8 9
Everything works fine if i use math-grm-standard.res instead of custom_grammar.res file.
Please help on how to achieve the required result.
Regards,
Pankaj Tyagi
Dear Kannan,
Currently, I did not mention ludef are not for Math BUT only Text parts.
You should then create a text part, create a configuration in your .conf file (resp. en_US.conf file), and set this configuration.
It should then work.
Best regards,
Olivier
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstOlivier @MyScript
Dear Pankaj,
thank you for contacting us.
Based on the error message, it looks like your .conf file is not properly formatted, or at least cannot be read properly.
Can you please attach it, so that I can check it?
Best regards,
Olivier
Pankaj Tyagi
Dear Mr. Olivier,
Thank you for your reply.
Below is my .conf file, to reiterate, everything works fine if I use standard grammar file.
Bundle-Version: 1.0
Bundle-Name: en_US
Configuration-Script:
AddResDir /data/user/0/com.example.pankaj.sampleapp/app_pankajDir
Name: configuration1
Type: Text
Configuration-Script:
AddResource en_US-ak-cur.res
AddResource en_US-lk-text.res
AddResource en_US-lk-grm.res
EnableAlienCharacters
SetTextListSize 1
SetWordListSize 7
SetCharListSize 1
Name: configuration2
Type: Text
Configuration-Script:
AddResource en_US-ak-cur.res
AddResource en_US-lk-grm.res
AddResource SectionTwo.res
EnableAlienCharacters
SetTextListSize 1
SetWordListSize 7
SetCharListSize 1
Name: configuration3
Type: Text
Configuration-Script:
AddResource en_US-ak-cur.res
AddResource en_US-lk-grm.res
AddResource SectionThree.res
EnableAlienCharacters
SetTextListSize 1
SetWordListSize 7
SetCharListSize 1
Name: configuration4
Type: Text
Configuration-Script:
AddResource en_US-ak-cur.res
AddResource en_US-lk-grm.res
AddResource SectionFour.res
EnableAlienCharacters
SetTextListSize 1
SetWordListSize 7
SetCharListSize 1
Name: configuration5
Type: Math
Configuration-Script:
AddResource math-ak.res
AddResource custom_grammar.res
Regards,
Pankaj Tyagi
Olivier @MyScript
Dear Pankaj,
the issue is that you are adding a Math configuration in a text configuration.
Please add the "configuration5" in your math.conf file, it should then work.
Best regards,
Olivier
Pankaj Tyagi
Dear Mr. Olivier,
I have a query about this, if I use math-grm-standard.res instead of custom_grammar.res with the same .conf file, then it works fine and give results.
So, if it has to be put in a math.conf then why it is working with standard grammar.
Regards,
Pankaj Tyagi
Pankaj Tyagi
Dear Mr. Olivier,
I tried with math.conf file also, but the result is still same.
It works well with standard grammar file but giving same error with my custom_grammar.res file.
Can you please check and let me know if there is any problem with my custom_grammar.res file.
Content of the custom grammar file is as :
symbol = 0 1 2 3 4 5 6 7 8 9
expression ::= identity(symbol)
start(expression)
What I try to achieve here is recognize on digits from 0 to 9.
Regards,
Pankaj tyagi
Olivier @MyScript
Dear Pankaj,
I just tried on my side with the custom_grammar.res resource available for download at the following link: https://myscript.filecamp.com/s/gcfHpod3E26CoFLp/fo
Just adding it as follows in the math.conf, it worked out of the box:
Bundle-Version: 1.0
Bundle-Name: math
Configuration-Script:
AddResDir ../resources
Name: standard
Type: Math
Configuration-Script:
AddResource math/math-ak.res
AddResource math/math-grm-standard.res
Name: configuration5
Type: Math
Configuration-Script:
AddResource math/math-ak.res
AddResource math/custom_grammar.res
Can you please try to proceed this way, and let us know if it works?
Best regards,
Olivier
Pankaj Tyagi
Dear Mr. Olivier,
Thank you for your help.
The resource file provided in the above link worked for me.
However, what I want to achieve is to recognize a 10 digit phone number written in box style space like 1 2 3 4 5 6 7 8 9 0.
With this resource file, it is only recognizing digits one by one and skipping few digits. I also added symbol ' ' in the resource file but result is same.
Can you give some suggestion on what should be done so that the result can be a 10 digit number.
Regards,
Pankaj Tyagi
Olivier @MyScript
Ddear Pankaj,
for such use-case, using a grammar defnition is not the best solution. Instead, we would recommend a "ludef", but it is not available on the developer portal.
Otherwise, you can update the grammar definition as below: This way, it can recognize numbers with an unlimited number of digits:
symbol = 0 1 2 3 4 5 6 7 8 9
expression ::= identity(symbol)
| hpair(expression, expression)
start(expression)
Best regards,
Olivier
Pankaj Tyagi
Dear Mr. Olivier,
Thank you for your help, above grammar definition worked for me.
Regards,
Pankaj Tyagi
Pankaj Tyagi
Dear Mr. Olivier,
As mentioned in the previous comment, we achieved what we wanted with your help.
Moreover, we would love to know about "ludef" and how can we implement this.
Regards,
Pankaj Tyagi
Olivier @MyScript
Dear Pankaj,
can you please provide with the exact specification of your field (number of digits, type of separator -comma, dot-)...
I will build it for you.
Best regards,
Olivier
Pankaj Tyagi
Dear Mr. Olivier,
We have 5 to 15 boxes placed adjacent to each other like any other number entering field and each box has one digit.
So, in a way we can say that 5 to 15 digits number where each digit is placed in a box.
Let me know if anything else you would like to know.
Regards,
Pankaj Tyagi
Olivier @MyScript
Dear Pankaj,
I just built the digits5to15.res resource that allows to recognize 5 to 15 digits.
Please find it at the following link: https://myscript.filecamp.com/s/gcfHpod3E26CoFLp/fo
Best regards,
Olivier
Pankaj Tyagi
Dear Mr. Olivier,
Thanks for your response.
I tried the above file in math.conf in place of my custom_grammar file, but it is giving below error :
INVALID_OBJECT: error: AddResource digits5to15.res failed
error: failed to read configuration script
script exits with 2 errors
Do I need to use it in any other way?
Regards,
Pankaj Tyagi