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

[* Currency] Handle mentions in the forms "negative <currency>" or "-$<number>" #3062

Open
zmerpez opened this issue Dec 26, 2022 · 1 comment

Comments

@zmerpez
Copy link

zmerpez commented Dec 26, 2022

Platform: Python [1.0.2a2]
recognize_currency does not work for text like "negative $10". When tried recognize_number with some text that has both negative and $ sign, that divides the number wrong and fails to get all.

To Reproduce

from recognizers_suite import Culture, ModelResult
import recognizers_suite as Recognizers
culture = Culture.English

result_2 = Recognizers.recognize_number('negative $71.5 million or -$23.', culture)
print(
    'Returns:\n',
    json.dumps(
        result_2,
        default=lambda o: o.__dict__,
        indent='\t',
        ensure_ascii=False)
)

Returns:

[
   {
   	"start": 0,
   	"end": 20,
   	"resolution": {
   		"value": "-71.5"
   	},
   	"text": "negative $71.5 millio",
   	"type_name": "number"
   },
   {
   	"start": 0,
   	"end": 10,
   	"resolution": {
   		"value": "-7"
   	},
   	"text": "negative $7",
   	"type_name": "number"
   }
]

Expected behavior
values should be: -71500000, -23

@zmerpez
Copy link
Author

zmerpez commented Jan 3, 2023

Best guess, that the functions does not work fine with word 'negative': i.e. I could get desired results from
"a negative impact on the strengthening of the $32" only if I place some brakets around word.
"a [negative] impact on the strengthening of the $32"

@tellarin tellarin changed the title recognize_number with negative currency [* Currency] Handle mentions in the form "negative <currency>" Mar 18, 2023
@tellarin tellarin changed the title [* Currency] Handle mentions in the form "negative <currency>" [* Currency] Handle mentions in the forms "negative <currency>" or "-$<number>" Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants