I would like to pickup weight units in order to be able to tell the user how much more can be packed in a parcel.
I found that there is an automatic annotation called %$UNIT.NER which recognizes weight units automatically in the input. I tried to extract the value using a listener with the following condition:
%$UNIT.NER^{amount=_USED_WORDS}
But when I then print the value for amount, I always get it with the unit. Is there a way that I can access the value only, without the unit?
We have created a pre-built solution which you could have a look at. It deals with unit conversions and for that task, one also needs to access the values of the units.
In particular, it makes use of an entity VALUE_UNITS.ENTITY which has been created for this particular solution, and which allows you to access the value of the unit. You could import this solution into your solution and then for example add the following to a flow listener condition (or wherever you want to pickup the unit):
%VALUE_UNITS.ENTITY^{amount=lob.amount}
with amount being the variable that then holds the value of the unit. For 12kg this would be 12.
I hope this helps, feel free to let me know if it does not
There is just one thing that is odd. When I try negative values like -500g, the value I get is still 500 and not -500. Is there a tweak for that as well?