allo-media/text2num

soixante-dixième not understood

Closed this issue · 2 comments

try:
    print(text2num('soixante-dixième','fr'))
except Exception as e:
    print(e,file=sys.stderr)

returns:

invalid literal for text2num: 'soixante-dixième'

Yet when we run alpha2digit

QQQ:alpha2digit>>>SEGMENTS:		 ["C'est aussi le soixante-dixième anniversaire"] 

QQQ:alpha2digit>>>OUT_SEGMENTS:		 ["C'est aussi le 70ème anniversaire", ''] 

we see that alpha2digit does understand soixante-dixième

jndq commented

RalphMapper and I did figure out:

Instead of running text2num: 'soixante-dixième' 
(which results in "invalid literal")

We can run 

text = "soixante-dixième"
alpha2digit(text, “fr”)

(the "fr" might be not needed since the program is french by default) 

to give us the 70ème we were looking for from
text2num: 'soixante-dixième' 

rtxm commented

Yes, that's it. text2num converts spelled integral numbers (cardinals) to a python int. 'soixante-dixième' is not a number, it's a rank, and so it cannot be converted to an int.