[QUERY] AsFloat() Should there be an option for locale?
See original GitHub issueQuery/Question For Europe and Latin America, numbers use commas for decimal points so for the input 180,00 (that’s a comma). In US/UK terms that would be 180.00 (one hundred and eighty), but there doesn’t appear to be a way to get ToFloat to accept that.
In the RecognizedForm json it is:
{
"type": "number",
"text": "180,00",
"page": 1,
"boundingBox": [3.23, 9.19, 3.56, 9.19, 3.56, 9.285, 3.23, 9.285],
"confidence": 0.995,
"elements": ["#/readResults/0/lines/96/words/4"]
},
And if you do AsFloat() on that you get 18000. How can you tell AsFloat what the locale is?
As a workaround I am doing:
if (decimal.TryParse(field.ValueData.Text, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, new CultureInfo("de-DE"), out d))
{
Environment:
- Azure.AI.FormRecognizer 3.1.0-beta.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How to format a float with a comma as decimal separator in ...
If you want to format floats with a comma within the f-string, you can either use replace after casting the float to a...
Read more >SQL Convert Function
In this example, we will convert a float data type to integer. In the following query, we will declare a variable that data...
Read more >Solved: Having issues with Converting String to float or i...
I have a problem as I am reeding excel cell it says for ex 10.57 power automate gives me 1,057 as float how...
Read more >What's New In Python 3.11 — Python 3.11.4 documentation
This article explains the new features in Python 3.11, compared to 3.10. ... For example, a SQL query function could be annotated as...
Read more >class-wpdb - WordPress Developer Resources
Since this method uses the $wpdb->query() method, all the class variables are properly set. The results count for a 'SELECT' query will be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After following up, currently
StartRecognizeCustomForms
doesn’t support locale on the service side. Other functions, like for example,StartRecognizeBusinessCards
orStartRecognizeInvoices
do.The service is working on adding it though but there isn’t a specific date yet for it. For now, your workaround is the best option.
Note in this case service is not returning
valueNumber
, and the code is following a workaround done for receipt https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/formrecognizer/Azure.AI.FormRecognizer/src/FieldValue.cs#L244 FYI @kinelskiThis belongs to the deeper conversation of what to do when service doesn’t return
value<type>
. Should text be used?Related to #17712