Search code examples
pythonnltkspacyhuggingface-transformershuggingface-tokenizers

How to convert word to numerics using huggingface or spacy or any python based workflow


I have lot of text which has the counting in words as well in different languages (different datasets but one data has one language so no mixing of language).

like

I have one apple 
I have two kids

and I want it to convert as

I have 1 apple
I have 2 kids

Is it possible to change that to the numbers / integers using huggingface or any ? or any suggestion for such problem would help! English Dutch French German supporting.


Solution

  • I have worked with different versions of different libraries. With my tests fo far, I found out this as working perfectly for most of the cases.

    words to numerics

    This is the better solution and covers English French German Spanish.