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?

1 answer

  • answered 2022-04-04 12:19 schajan

    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.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum