Easy to use regular expression library for speech control jukebox

J

Jeff

Hi,

I'm finishing up developing a speech control jukebox (see
intelligentjukebox.com)

Can anyone point me to the easiest to use free library that does very
basic regular expression matching and substitution? E.g. I need do
stuff like this: (perl expression follows)

$s =~ s/\&/and/g; # replace ampersands with "and"

I'm a fairly good using the c++ language, but I have little experience
setting up libraries, make files, etc. I'm using Visual C++ 6.0.
Isn't there any library where I can just add a few .cpp and .h files
to my code?

Setting up libraries seems arcane and nonstandard to me. The language
is hard enough by itself. Is there any guide to this knowledge
anywhere?

So far I've tried unsuccessfully to set up these libraries:
http://www.tropicsoft.com/Components/RegularExpression/
http://www.psyon.org/projects/pcre-win32/

Thanks,
Jeff
 
U

u.int.32.t

Jeff said:
Hi,

I'm finishing up developing a speech control jukebox (see
intelligentjukebox.com)

Can anyone point me to the easiest to use free library that does very
basic regular expression matching and substitution? E.g. I need do
stuff like this: (perl expression follows)

$s =~ s/\&/and/g; # replace ampersands with "and"

I don't know how far compatible boost.regex is with perl but thats one
free library that does basic stuff.
I'm a fairly good using the c++ language, but I have little experience
setting up libraries, make files, etc. I'm using Visual C++ 6.0.
Isn't there any library where I can just add a few .cpp and .h files
to my code?

How the hell did you use the speech recognition library? Did you roll
your own?
 
M

Mads Bondo Dydensborg

Jeff said:
I'm a fairly good using the c++ language, but I have little experience
setting up libraries, make files, etc. I'm using Visual C++ 6.0.
Isn't there any library where I can just add a few .cpp and .h files
to my code?

If your runtime environment includes posix c support, you could perhaps use
the standard regex routines?

#include <sys/types.h>
#include <regex.h>

int regcomp(regex_t *preg, const char *regex, int cflags);
int regexec(const regex_t *preg, const char *string, size_t
nmatch,
regmatch_t pmatch[], int eflags);
size_t regerror(int errcode, const regex_t *preg, char *errbuf,
size_t
errbuf_size);
void regfree(regex_t *preg);

Regards

Mads

--
Mads Bondo Dydensborg (e-mail address removed)
http://www.madsdydensborg.dk/

"The government of the United States is not, in any sense, founded on
the Christian religion." -George Washington, November 4, 1796

"No, I don't know that Atheists should be considered as citizens, nor
should they be considered patriots. This is one nation under God."
-George H. W. Bush
 
J

Jeff

If your runtime environment includes posix c support, you could perhaps use
the standard regex routines?

#include <sys/types.h>
#include <regex.h>

int regcomp(regex_t *preg, const char *regex, int cflags);
int regexec(const regex_t *preg, const char *string, size_t
nmatch,
regmatch_t pmatch[], int eflags);
size_t regerror(int errcode, const regex_t *preg, char *errbuf,
size_t
errbuf_size);
void regfree(regex_t *preg);

Thanks, I like this solution best. I added the includes, but I get a
compile error. Do you know how I can fix this?
---------------------------

Deleting intermediate files and output files for project 'IntelliMusic
- Win32 Release'.
--------------------Configuration: IntelliMusic - Win32
Release--------------------
....

J:\program files\Microsoft Visual
Studio6.0\VC98\MFC\INCLUDE\afxtempl.h(1233) : error C2668: 'memset' :
ambiguous call to overloaded function
J:\program files\Microsoft Visual
Studio6.0\VC98\INCLUDE\utility(21) : while compiling class-template
member function 'void __thiscall CMap<class CSAPrefsSubDlg *,class
CSAPrefsSubDlg *,unsigned long,unsigned long
&>::InitHashTable(unsigned
int,int)'

....
Generating Code...
Error executing cl.exe.

IntelliMusic.exe - 1 error(s), 0 warning(s)
 
J

Jeff

I don't know how far compatible boost.regex is with perl but thats one
free library that does basic stuff.


How the hell did you use the speech recognition library? Did you roll
your own?

Uhh, yes I did! I rolled my own SR library into a big fattie and
smoked it. Now its all gone! For now I'm stuck with M$.

Ok, this is what allowed me to use the ms sapi. Without this site I
never would have started my project.

SAPI 5.0 Tutorial I: An Introduction to SAPI
http://www.generation5.org/content/2001/sr00.asp
 
M

Mads Bondo Dydensborg

Thanks, I like this solution best. I added the includes, but I get a
compile error. Do you know how I can fix this?

no, sorry, my knowledge about Windows is really limited.

Good luck

Mads

--
Mads Bondo Dydensborg (e-mail address removed)
http://www.madsdydensborg.dk/

I disapprove of what you say, but I will defend to the death your right to
say it.
- Beatrice Hall [pseudonym: S.G. Tallentyre], 1907 (many times wrongfully
attributed to Voltaire)
 
J

John Ratliff

If your runtime environment includes posix c support, you could perhaps
no, sorry, my knowledge about Windows is really limited.

Windows is not POSIX compliant and has no built-in regular expression
library.

You'll have to go find one. Henry Spencer wrote one for wxWidgets which is
freely available. PCRE (Perl-compatible regular expressions) lib is free and
has C++ wrappers. These things can be found with Google.

--John Ratliff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top