'Parsing quantulum3 with just one word

I want to use quantulum3 to extract just the units but the string value doesn't have any numbers in it and only have 1 word.

a=parser.parse("meter")

i tried that but it seems that it still need the number infront of the word 'meter' for it to function.

is there any other possible way to implement this with quantulum3?



Solution 1:[1]

I am working through the same problem, and unfortunately do not have a perfect answer. The dirty fix that I came up with was to parse "1 " + unit:

    from quantulum3 import parser
    unit = "meter"
    result = parser.parse("1 " + unit)
    print(result[0].unit)

Let me know if you have anything better.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 schajan