How to convert French words to integers?

convert french words to numbers
google translate english to french numbers
how to write euros in french
convert numbers into words
numbers in french 1-1000
1665 in french
french seven
french six

Other questions have been answered regarding converting English words to numbers, particularly using the library w2n or other custom algorithms.

However I don't know how to convert French (or generically speaking, any language's) words to integers, such as:

>>> word_to_number('quarante-quatre')
44

I'm not a fluent speaker of French, but it's certainly not just trying to translate the words in https://github.com/akshaynagpal/w2n/blob/master/word2number/w2n.py right?

French numbers conversion. Number converter to french words , It converts numbers in French. Write down the number that you want to convert in French words. Just enter the digits you want to translate into a French number  Convert numbers into french words. Number to be converted: Number converted into words: Find this App on Windows Store and Windows Phone Store:

You can use textblob. But it is not so safe, since they can be blocked if you make "too many requests".

information: https://textblob.readthedocs.io/en/dev/ You could do something like this:

from textblob import TextBlob

def word_to_number(text):
    blob= TextBlob(text)
    print(blob.translate(from_lang="fr",to="en"))
word_to_number('quarante-quatre')

And now you can make a list of numbers to transform letters to integers

Convert a number in french letters, Numbers to Words Converter - French. To convert from Number to Words (​generate the numeric text of a value), enter the value in the field below and click  Convert a number in french letters Conversion d'un chiffre en toutes lettres (Français) 1 - Write your number below Inscrivez un nombre en chiffres (ex: 2569)

Create a database of french words and the numeric equivalents.


Load it into memory.


Use the 'find in set' command to find the numbers equal to words input.


database to create from http://www.french-linguistics.co.uk/tutorials/numbers/


Numbers 0-19
0   zéro
1   un
2   deux
3   trois
4   quatre
5   cinq
6   six
7   sept
8   huit
9   neuf
10  dix

Use python REG EX code for 'search' example:


import re

txt = "The rain in Spain"
x = re.search("^The.*Spain$", txt)

Use python dictionaries for 'search' example:


thisdict =  {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
if "model" in thisdict:
print("Yes, 'model' is one of the keys in the thisdict dictionary") 

Numbers to Words Converter, parsing numbers expressed as words in French, English and Spanish and convert them to integer values;; detect ordinal, cardinal and decimal numbers in a​  Translate full documents to and from French and instantly download the result with the original layout preserved 3 Translate French documents to English in multiple office formats (Word, Excel, PowerPoint, PDF, OpenOffice, text) by simply uploading them into our free online translator

allo-media/text2num: Parse and convert numbers written in , Try this: Converting numbers to the word equivalent. [^] - it's in English, but it's pretty clear what you actually need to do Convert words into numbers select words for numbers - write integer numbers. Convert numbers into Initial Capitals words. Convert numbers into uppercase words. Convert time (hours : minutes) into words. Check Transaction Register. Return to Metric - U.S. Measurement Conversions Menu. Return to Main Page

[Solved] Number to word in "French", Simply paste or type the number that you would like to convert numbers to words, choose a language and hit generate to calculate what that number is when  Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 2 31 - 1. Example 1: Input: 123 Output: "One Hundred Twenty Three" Example 2: Input: 12345 Output: "Twelve Thousand Three Hundred Forty Five" Example 3: Input: 1234567 Output: "One Million Two Hundred Thirty Four Thousand Five Hundred

Number to Words Converter Online, This class takes care of all the conversion from a number to its words equivalent value in either English or French. Really, the only method that  Python | Converting all strings in list to integers Interconversion between data types is facilitated by python libraries quite easily. But the problem of converting the entire list of string to integers is quite common in development domain.

Comments
  • Actually it's not that easy, in french you say "quatre vingt dix neuf" for 99, which directly translates to "four twenty ten nine" (four times twenty plus ten plus nine).
  • Oh actually w2n supports french pypi.org/project/num2words
  • If there isn't anything out there that does this, you could probably write your own converter, inspired by the w2n. But the rules would have to change to match French ones (and they are very different and not very simple)
  • I didnt have a clue about numbering in french until now (I've googled study.com/academy/lesson/how-to-count-to-100-in-french.html), and I would have to say it is quite a challenging task :) My idea would be to make dictionary of common values, based on which I would check the input first, and if 0 results similar to input are found, I would start with dictionary element combinations according to algorithms described on that page with french counting :)
  • @palvarez Yeah but that's the opposite of what I want (words to numbers).
  • Well that's not a very descriptive library name, but it works. text2num is very strict regarding the expected input, like text2num('dix-neuf') works but text2num('Dix-neuf') and text2num('dix neuf') both don't (even with relaxed=True). But alpha2digits() seems quite flexible.
  • it's not my library, but maybe they'd accept some pull requests! alpha2digit uses regular expressions when looking for words rather than just splitting the string. it also calls lower on each word. maybe you could try this?
  • alpha2digits works perfectly in my context. The comment on text2num is more a flag for those who read this answer in the future than a criticism. Thanks for the suggestion!