[prev in list] [next in list] [prev in thread] [next in thread] 

List:       festival-talk
Subject:    
From:       Alan W Black <awb () cs ! cmu ! edu>
Date:       2001-01-02 23:13:00
[Download RAW message or body]

message from Alan W Black <awb@cs.cmu.edu> to festival-talk
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


 Craig Stanbridge writes on 2 January 2001:
 > message from "Craig Stanbridge" <czs198@ecs.soton.ac.uk> to festival-talk
 > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 > 
 > Hi, I am fairly new to festival and would appreciate any help anyone could
 > give me.

This looks basically right (and it does work for me) but ...

 > I want to implement a pronunciation by analogy function to replace the
 > letter to sound rules used when there is no match for a word.  I tried to do
 > a little test program in C that just returned the lexical entry for unknown
 > whenever it was called, this was placed in the /src/modules/Lexicon
 > directory:
 > 
 > #include "festival.h"
 > #include "pba_test.h"
 > 
 > LISP my_lookup(LISP word,LISP features)
 > {	
 > 	return cons(strcons(strlen("unknown"), "unknown"),
 > 		cons(features, strcons(strlen("(((uh n) 1) ((n ou n)1))"), "(((uh n) 1)
 > ((n ou n) 1))")));
 > }

This function althrough Lisp/CC correct doesn't do what you want,
your are mixing strings and Lisp construction functions.  Don't
worry your not the only one who finds this difficult at first.  TO
do literals in C I find it easier to use the function

LISP read_from_string(const char *);

Thus you could say 
   return read_from_string("(\"unknown\" \"unknown\" (((uh n) 1) ((n ou n) 1)))");

But you just wanted a tes function here so what it returns isn't
very important.

 > I then declared the function above the init section of lex.cc as described
 > in section 27.2.1 of the manual:
 > 
 > LISP my_lookup(LISP word, LISP args);
 > 
 > And at the end of init section I added the following:
 > 
 > init_subr_2("pba.lookup",my_lookup,
 >     	"(pba.lookup WORD FEATURES)\n\
 >     	My test function...");
 > 
 > Not sure if that bit is right?

Yes, that;s right, the C function my_lookup is a 2 argument function
so you use init_subr_2 to declare it.

I'm assuming you added these lines in the function 

void festival_Lexicon_init(void)

at the end of lexicon.cc

 > I then recompiled the lexicon module and started festival and typed the
 > following:
 > 
 > Festival Speech Synthesis System 1.4.1:release November 1999
 > Copyright (C) University of Edinburgh, 1996-1999. All rights reserved.
 > For details type `(festival_warranty)'
 > 

At this stage I would test to see if the new function is actually there,
it obviously isn't due to your next error message.  You should be 
able to type

   festival> (pba.lookup nil nil)

and get something back

Minimally you should be able type

   festival> pba.lookup
   #<SUBR(6) pba.lookup>

This did for me.

 > festival> (lex.set.lts.method 'pba.lookup)
 > pba.lookup
 > festival> (SayText "Hello this is an unknown word, gsusk.")
 > SIOD ERROR: unbound variable
 > pba.lookup

This means there it didn't get defined.  The things to
check are.  Did festival actually recompile lexicon.cc, 
init_modules.cc and relink main/festival itself?  Is it that
versions you are actually using?

Let me know if this still doesn't work.

Alan

Alan W Black                                email: awb@cs.cmu.edu
Language Technologies Institute             http://www.cs.cmu.edu/~awb/
Carnegie Mellon University                  tel: +1-412-268-6299  
5000 Forbes Ave, Pittsburgh PA, 15213, USA. fax: +1-412-268-6298

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
			       Sent Via festival-talk@cstr.ed.ac.uk
		        To unsubscribe mail majordomo@cstr.ed.ac.uk

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic