Click here to Skip to main content
Click here to Skip to main content

Float and datetime to Vietnamese textual

By , 4 Aug 2002
 

Introduction

There is a high demand for converting float data and datetime to textual presentation. You can find its application in many different actual situations such as declaring bank amount, tax amount, money invoice amount etc, especially in IVR (Interactive Voice Response)applications.

I was involved in a IVR application, specifically a Telephone Banking center in which we produced voice stream to state customers' balance. If you have a TTS (Text to speech) engine, everything would be simple: you select balance amount from the database as a float number and the engine will speak it out. The fact is not so wonderful, when we developed this program, there was no such Vietnamese TTS engine. Hence we have to do everything by hand, i.e. convert customer's balance to a texttual representation, then produce voice stream from a series of pre-recorded voice files.

From that time, my application runs fine. If you want, you can dial 84-4-8313895 and ask for Telephone Banking ext. The pseudo TTS engine I created is wrapped in a DLL because the script we used in our IVR system can only call a DLL with a predetermine function type, i.e. :

char* extern C yourfunction(char* inputstring)

Details

Hence my DLL has the following functions:

extern "C" NUMANALYSE_API char *VS_MainNum(char *numstr)
//Example VS_MainNum("-12345.89")

extern "C" NUMANALYSE_API char *VS_NonCount(char *numstr)
//Example VS_NonCount("12A76B009CD87")

extern "C" NUMANALYSE_API char *VS_DateTimeV(
  char *numstr="0000 00 00 00:00:00")
//Example VS_DateTimeV("2002 12 20 16:30:20")

extern "C" NUMANALYSE_API char *VS_DateTimeE(
  char *numstr="0000 00 00 00:00:00")
//Example VS_DateTimeE("2002 12 20 16:30:20")

extern "C" NUMANALYSE_API char *VS_CardinalE(char *numstr)
//Example VS_CardinalE("-12345.67")

extern "C" NUMANALYSE_API char *VS_OrdinalE(char *numstr)
//Example VS_OrdinalE("12345")

And in the core are the classes:

class CSonNumV 
{ 
public: 
    static char * NoncountV(char * numstr, char * g_num); 
    static char * CardinalV(char *numstr, char *g_num); 
    CSonNumV(); 
    virtual ~CSonNumV(); 
private: 
    static CString FirstTwo(int tw); 
    static CString FirstThree(int th); 
    static CString Fractal(CString cstw); 
    static CString NumComb(double x, char *s); 
}; 

class CSonTime : public CTime 
{ 
public: 
    CString FormatE(LPCTSTR fmtString); 
    CSonTime(LPCTSTR mstr); 
    typedef char * (*funcptr)(char *); 
    void put_pfnV(funcptr x); 
    CString FormatV(LPCTSTR fmtString); 
    CSonTime(int nYear, int nMonth, int nDay, int nHour, int nMin, 
        int nSec, int nDST = -1 ); 
    CSonTime(); 
    CSonTime(const CSonTime& timeSrc); 
    CSonTime& CSonTime::operator =(const CSonTime &timeSrc); 
    CSonTime& CSonTime::operator =(LPCTSTR mstr); 
    virtual ~CSonTime(); 
    
private: 
    CString get_partE(char b); 
    CString get_partV(char a); 
    funcptr m_pfnV; 
}; 

class CSonJFancolNumE 
{ 
public: 
    static char * OrdinalE(char * numstr, char * g_num); 
    static char * CardinalE(char *numstr, char *g_num); 
    CSonJFancolNumE(); virtual ~CSonJFancolNumE(); 
}; 

Conclusion

I also want to give credit to Eduardo Velasquez for his Tokenizer class and Jeremy Lee Falcon for his NumWord English textual representation as I use his work to produce English representation in my DLL. Thank you and have fun

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Nguyen Luong Son
Other NguyenLuongSon Groups Associates
Anonymous Proxy Anonymous Proxy
Member

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralYour comments [modified]memberNguyen Luong Son12 Nov '05 - 15:44 
Hi all,
 
Smile | :) In the first place, for those who have emailed me comments in private recently, for example from "jai_mnti" he wrote:
 
HI nguyen,

we are a bunch of software techies assigned a new project called IVR.....in the web search i found your name and ur id for contact....i was wondering how to carry out the whole proces.....we are using a pika board for ivr hardware processor which handles isdn lines....now we have few issues....first we don't have the complete knowledge of the pika board api's ....after going through the sample programs we just found some logic however one issue is we couldnot find the way to wait for a call.......wheneve the call comes it gets connected immediately........ give some idea how to carry out this whole project and give us the tips in carrying out the project.......

thanking you,
jay
 
I would like you to read my answer to an Irania developer as following:
 
Hi Emad Rangchi,
 
I just want to explain to you that: the IVR
system that I work with are layered on a 3rd party's API
not Microsoft,s one. But I've seen developers at
- . Also I found
this article -
http://www.codeproject.com/csharp/DevangPro.asp -
about TAPI3. Wish that this could help you.
Finally, just to let you know that I now no longer
work for that party and now I work for.. I even don't
have a computer. However, with my best resource and
talent available I'll try to help you.
 
Best regards
 
M.EE Nguyen Luong Son
 

--- Emad Rangchi đã viết:

 
> Hi
> I am an Iranian developer, I work on IVR engine on
> TAPI 3 and .Net with half
> duplex modem , I were using multi threading in this
> project but I have some
> problem in this engine . Can you help me?
> Regards
>
> --
> Emad Rangchi
>
 
Smile | :) Secondly I forgot to state his name Mr. Joseph M. Newcomer for his CString class contribution.
 
Smile | :) For other comments such as adding mark on Vietnamese letters. I believe they are open questions for you to develop..
 
Nguyen Luong Son

 
Where should I go tomorow?
 
-- modified at 8:06 Tuesday 10th April, 2007
GeneralRe: Your comments [modified]memberNguyen Luong Son3 Dec '05 - 16:49 
Hi friends,
 
This not only for Vikas Singh but I hope it could be helpful for others.
For you Vikas Singh, you wrote:
 
"Hi,

We are using dlink modem DFM-562E++ for development of Inteactive Voice Response System.
For development of IVR program we came to know that unimodem 5 has to be configured.

What is unimodem 5? how to configure unimodem 5 in windows 2000? Is unimodem 5 exe is default in windows 2000?

We are using windows 2000 as opearting system.We tried to install unimodem V.Windows OS correpted.
Then we come to know about Unimodem 5 is different than Unimodem V. Still confused...!

We are using MS Visual Studio 2003, Windows 2000 Pro Ed with Microsoft Speech Application SDK (SASDK) 5.1. I know C#, VB.Net, VB6 as languages.

Please Give information about unimodem 5 how to configure it with IIS & Windows.

 
IVR Application details:

We want to develop a Telephonic Interaction Application (IVR System), in which a client will call on a Telephone which is attached with our computer, and then, an application running on my PC will give response to that particular client by saying like Press "0" for know your balance, "1" for changing languages, etc. and process his/her pressing buttons on his/her Telephone/Mobile.

We have a good configured PC with D-Link Modem DFM-562E (V.92 56000bps Fax/Data/Voice), we are not using Dialogic Card. Is it ok to get DTMF inputs by our modem for the an IVR application, and how can we get DTMF inputs? We are unable to get DTMF tones setting from our modem by performing AT Test as given in modem's manual.

We have used TAPIEx C# sample, When application runs user get connected to our sample program when user press a button, we are getting

If we use Windows 2000 as Operating System when user press a button the system is restarting.We came to know about the concept our modem drivers has to be interfaced with Unimodem
Now When the telephone caller is pressing any key from his/her telephone/mobile, the PC is either rebooted or just halted with the give error in blue screen.
 
Thanks & Regards

Vikas S.
Nerve Centrex
Bangalore

 
"
 
OK, if you plan for a further development for your IVR, you should establish tight connections with local proprietary board vendors. Such a new developments I have used in the project was F..'s VR ( Voice Recognition ) innovations, not to mention BioAuthentication idea we came up at that time which is now a registed trademark suite of F...
 
Frown | :( Unfortunately, I couldn't give you a contact at F.. right now as I resigned from it without any compensation. My boss even did not paid my pension plan this made me I was so depressed.
 

 
Thanks
 
Nguyen Luong Son
 
Where should I go tomorow?
 
-- modified at 8:08 Tuesday 10th April, 2007

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 5 Aug 2002
Article Copyright 2002 by Nguyen Luong Son
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid