Text2Number Function

I’ve been working on a PHP function that will parse pronounceable representatiion of number into numeric value. It can be useful for validating sensitive user entries such as payment amount, etc, by entering not only the number, but the pronounceable numbers. For example a text if "sepuluh ribu" can be parsed into 10000.

Give it a try, or download the source.

NOTE
Only works with Indonesian language

UPDATE Friday, March 16 2007
Fixing bug while parsing text like "dua puluh tiga ribu"

UPDATE Tuesday, March 20 2007
Fix some sloppy coding :p

UPDATE Wed, March 21 07
Influenced with Lingua::ID::Words2Num package by Om steven.

UPDATE Wed, March 22 07
Om steven emailed me and send a pretty test-suite for text2number function. I’ve put it on the demo page, nice. Thanks om steven …

9 komentar

  1. IndoDX bilang:

    Useful function mas, this really great ;)

    March 16th, 2007 at 17:40
  2. Kombor bilang:

    I don’t understand coding. I am sorry for not downloading it, Bro. :)

    March 18th, 2007 at 11:50
  3. GuM bilang:

    kok gak masuk di ‘playing ground’ fer?

    March 18th, 2007 at 15:13
  4. ferdhie bilang:

    #IndoDX:
    thx bro

    #Kombor:
    hehehe, no probs bang, thx for commenting

    #GuM:
    playing ground, maksud nya?

    March 18th, 2007 at 20:28
  5. Steven Haryanto bilang:

    iseng berkunjung. kayaknya masih ada bugnya ya? beberapa teks saya coba hasilnya masih belon bener, mis: “seratus lima puluh juta dua ratus ribu lima puluh dua”, “seratus lima puluh juta”, “seratus lima juta”.

    btw, duluuuuu banget, pernah bikin beginian tapi versi perlnya. bisa diliat di CPAN, modul Lingua::ID::Words2Nums (dan Nums2Words). mungkin bisa dicontek heuheuheu…

    simplechatnya baru saya instal di indoforums.com/id-php/chat/ , buat conference nanti. kuul!!

    March 20th, 2007 at 10:54
  6. GuM bilang:

    Playing Ground, fer. bareng sama SoccerStat, Aggregator dan SimpleChat

    March 20th, 2007 at 12:09
  7. ferdhie bilang:

    #GuM
    menunggu PB keluar :p

    March 21st, 2007 at 01:27
  8. Steven Haryanto bilang:

    sejuta sebelas ribu

    March 21st, 2007 at 10:35
  9. ferdhie bilang:

    thanks pak steve, akhirnya dg referensi perl modul anda, udah bisa jalan lagi, kayanya bukan referensi deh, duplikat . hehehe

    March 21st, 2007 at 12:01

Tinggalkan Komentar





*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word