Import Upstream version 2.1-release

This commit is contained in:
Lu zhiping 2022-06-27 15:30:22 +08:00
commit 5e8937e909
513 changed files with 746594 additions and 0 deletions

8
.time-stamp Normal file
View File

@ -0,0 +1,8 @@
Festival Lite
flite
2.1
Dec 2017
release
awb
leith
Mon Dec 25 10:16:52 EST 2017

79
ACKNOWLEDGEMENTS Normal file
View File

@ -0,0 +1,79 @@
The initial development of flite was primarily done by awb while
travelling, perhaps the name is doubly appropriate as a substantial
amount of the coding was done over 30,000ft). During most of that
time awb was funded by the Language Technonologies Institute at
Carnegie Mellon University.
Kevin A. Lenzo was involved in the design, conversion techniques and
representions for the voice distributed with flite (as well as being
the actual kal voice itself).
Other contributions are:
Henry Spencer
For the regex code
University of Edinburgh
for releasing Festival for free, making a companion runtime synthesizer
a practical project, much of the design of flite relies on the
architecture decisions made in the Festival Speech Synthesis Systems and
the Edinburgh Speech Tools.
The duration cart tree and intonation (accent and F0) models were
derived from the models in the Festival distribution. which in turn
were trained from the Boston University FM Radio Data Corpus.
Carnegie Mellon University
The included lexicon is derived from CMULEX and the letter to sound
rules are constructed using the Lenzo and Black techniques for
building LTS decision graphs.
Nagoya Institute of Technology
The mlsa code derives from HTS (following a long chain)
Tomoki Toda
The mlsa and mlpg support came view Tomoki's support for voice convertion
in FestVox which in turn (some of which) comes from NITECH's HTS.
Marcela Charfuelan (DFKI)
For the mixed-excitation techniques. These originally came from NITECH
but we understood the technqiues from Marcela's Open Mary Java code and
implemented them in our optimized version of MLSA.
David Huggins-Daines (dhd@cepstral.com)
much of the clunits code, porting to multiple platforms, substantial
code tidy up and configure/autoconf guidance.
Cepstral, LLC (http://cepstral.com)
For supporting DHD to spend time (in 2001) on flite and passing
back the important early fixes and enhancements including SAPI
support (funded by Portuguese FCT to produce an open source
synthesis solution).
Willie Walker <william.walker@sun.com> and the rest of the Sun Speech Group
lots of low level bugs (and fixes).
Portuguese Foundation for Science and Technology (FCT) Praxis XXI program
The SAPI interface provided by Cepstral, LLC was partially funded by
the above program.
Craig Reese: IDA/Supercomputing Research Center
Joe Campbell: Department of Defense
who wrote the ulaw conversion routines in src/speech/cst_wave_utils.c
Mario Lang:
causing the support of shared libraries to happen
Eric House (fixin@peak.org)
who provided examples of how to do 68K Call Backs for system functions
Greg Parker gparker@sealiesoftware.com
peal, the binding glue and shared library foo for getting the arm
version doing something reasonable under PalmOS
Lukas Loehrer <loehrerl@gmx.net> Feb 2006
alsa support (default if available)
Udhyakumar N
For making the mixed excitation code work, and show its value
Brian Langner
redid the Visual Studio support
Alok Parlikar
Android support, and cg voice dumping (and loading), indic support
Gopala Anumanchipalli
spamf0 support, unitran integration
Richard Sproat and Kyoung-young Kim (UIUC)
Unitran: unicode to sampa grapheme mapping tables
Sun Microsystems
g72x code
Larry McCourry
Windows Visual Student support for 2.0.0
Cobalt Speech and Language Inc
Updates to Visual Studio Support and Support for Clustergen Voices under SAPI
Suresh Bazaj and Shyam Krishna
Indian Language support

208
COPYING Normal file
View File

@ -0,0 +1,208 @@
Flite is free software.
We have kept the core code to BSD-like copyright, thus the system is
free to use in commercial products, with commercial extensions. GPL
code is only included as part of the build process and does not
taint any of the run-time code.
As a collection it is distributed under the following license. Note
a few files in this distribution have a different but equally free
non-conflicting licence, see below.
Language Technologies Institute
Carnegie Mellon University
Copyright (c) 1999-2017
All Rights Reserved.
Permission is hereby granted, free of charge, to use and distribute
this software and its documentation without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of this work, and to
permit persons to whom this work is furnished to do so, subject to
the following conditions:
1. The code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Any modifications must be clearly marked as such.
3. Original authors' names are not deleted.
4. The authors' names are not used to endorse or promote products
derived from this software without specific prior written
permission.
CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK
DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
All files within this distribution have the above license except
the following
src/cg/cst_mlpg.h
src/cg/cst_mlpg.c
src/cg/cst_mlsa.h
src/cg/cst_mlsa.c
src/cg/cst_vc.h
src/cg/cst_vc.c
/*********************************************************************/
/* */
/* Nagoya Institute of Technology, Aichi, Japan, */
/* Nara Institute of Science and Technology, Nara, Japan */
/* and */
/* Carnegie Mellon University, Pittsburgh, PA */
/* Copyright (c) 2003-2004 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and */
/* distribute this software and its documentation without */
/* restriction, including without limitation the rights to use, */
/* copy, modify, merge, publish, distribute, sublicense, and/or */
/* sell copies of this work, and to permit persons to whom this */
/* work is furnished to do so, subject to the following conditions: */
/* */
/* 1. The code must retain the above copyright notice, this list */
/* of conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* */
/* NAGOYA INSTITUTE OF TECHNOLOGY, NARA INSTITUTE OF SCIENCE AND */
/* TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, AND THE CONTRIBUTORS TO */
/* THIS WORK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, */
/* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, */
/* IN NO EVENT SHALL NAGOYA INSTITUTE OF TECHNOLOGY, NARA */
/* INSTITUTE OF SCIENCE AND TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, */
/* NOR THE CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR */
/* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM */
/* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, */
/* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */
/* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
/* */
/*********************************************************************/
These functions are derived from the versions in festvox/src/vc/ as
modified by Tomoki Toda which in turn contain code derived from
NITECH's HTS system. Their copyright has the same freedoms as
as Flite's but under NAIST, NITECH and/or CMU.
src/audio/au_wince.c
src/utils/cst_file_stdio.c
src/utils/cst_mmap_posix.c
src/utils/cst_mmap_win32.c
src/utils/cst_mmap_none.c
src/utils/cst_file_wince.c
sapi/ (non-CG)
are copyright Cepstral, LLC rather than CMU but fall under the same
free licence as the above, except for the owner.
sapi/ CG support
are copyright Cobalt, LLC rather than CMU but fall under the same
free licence as the above, except for the owner.
doc/alice
Is the first two chapters of Alice in Wonderland as distributed by the
Gutenburg project and is now in the public domain
src/regex/regexp.c
src/regex/regsub.c
* Copyright (c) 1986 by University of Toronto.
* Written by Henry Spencer. Not derived from licensed software.
*
* Permission is granted to anyone to use this software for any
* purpose on any computer system, and to redistribute it freely,
* subject to the following restrictions:
*
* 1. The author is not responsible for the consequences of use of
* this software, no matter how awful, even if they arise
* from defects in it.
*
* 2. The origin of this software must not be misrepresented, either
* by explicit claim or by omission.
*
* 3. Altered versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
src/speech/rateconv.c
* Copyright (c) 1992, 1995 by Markus Mummert
*
* Redistribution and use of this software, modifcation and inclusion
* into other forms of software are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of this software must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. If this software is redistributed in a modified condition
* it must reveal clearly that it has been modified.
lang/usenglish/us_durz_cart.c
lang/usenglish/us_durz_cart.h
lang/usenglish/us_int_accent_cart.c
lang/usenglish/us_int_accent_cart.h
lang/usenglish/us_int_tone_cart.c
lang/usenglish/us_int_tone_cart.h
lang/usenglish/us_phoneset.c
lang/usenglish/us_f0lr.c
These are directly (or indirectly) compiled/derived from files that are
part of the Festival Speech Synthesis System (1.4.1). Hence they have
a joint copyright CMU/Edinburgh but with the same free licence
configure
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
configure.sub
config.guess
missing
install-sh
mkinstalldirs
Copyright FSF, and under the GPL, these files are only used for
convenient configuration and are not part of the generated binary,
and therefore do not impose any GPL restrctions on the rest of the
system. But as they are standard methods for configuration they
are included.
src/speech/g72x.h
src/speech/g721.c
src/speech/g72x.c
src/speech/g723_24.c
src/speech/g723_40.c
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
lang/cmu_grapheme_lex/grapheme_unitran_tables.c
/* Copyright 2008-2012, University of Illinois at Urbana-Champaign */
/* distributed under the Apache License, Version (2.0) */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* Original table developed by Richard Sproat and Kyoung-young Kim */
/* Ported for Festvox by Gopala Anumachipalli gopalakr@cs.cmu.edu Sep 2012 */
/* Then converted to C for CMU Flite (cmuflite.org) */

49
Exports.def Normal file
View File

@ -0,0 +1,49 @@
LIBRARY "fliteDll"
EXPORTS
flite_init
flite_voice_select
flite_file_to_speech
flite_text_to_speech
flite_phones_to_speech
flite_ssml_file_to_speech
flite_ssml_text_to_speech
flite_text_to_wave
flite_synth_text
flite_synth_phones
flite_do_synth
flite_process_output
usenglish_init
cmu_lex_init
cmu_dari_lang_init
cmu_dari_lex_init
cmu_pashto_lang_init
cmu_pashto_lex_init
new_voice
delete_voice
flite_feat_set
flite_feat_set_float
flite_feat_set_int
flite_feat_set_string
flite_feat_remove
flite_ffeature_string
flite_get_param_val
flite_get_param_float
flite_get_param_int
flite_get_param_string
flite_voice_add_lex_addenda
cg_synth
cg_db_val
clunits_synth
clunit_db_val
dur_stats_val
cart_val
uttfunc_val
lexicon_val
cst_strdup
cst_sprintf
audio_open
audio_write
audio_close
audio_stream_chunk
audio_streaming_info_val
new_audio_streaming_info

134
Makefile Normal file
View File

@ -0,0 +1,134 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 1999-2017 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Fast efficient small run-time speech synthesis system ##
## http://cmuflite.org ##
## ##
## Authors: Alan W Black (awb@cs.cmu.edu) ##
## Kevin A. Lenzo (lenzo@cs.cmu.edu) ##
## and others see ACKNOWLEDGEMENTS ##
## Date: Dec 2017 ##
## Version: 2.1 release ##
## ##
###########################################################################
TOP=.
DIRNAME=
BUILD_DIRS = include src lang doc
ALL_DIRS=config $(BUILD_DIRS) testsuite \
wince windows android \
sapi tools main
CONFIG=configure configure.in config.sub config.guess \
missing install-sh mkinstalldirs
OLD_WINDOWS = Exports.def flite.sln fliteDll.vcproj
WINDOWS = Exports.def flite.sln flite.v11.suo fliteDll.vcxproj fliteDll.vcxproj.filters
FILES = Makefile README.md ACKNOWLEDGEMENTS COPYING $(CONFIG) $(WINDOWS)
DIST_CLEAN = .time-stamp $(TOP)/build/ \
config.cache config.log config.status \
config/config config/system.mak FileList
HOST_ONLY_DIRS = tools main
ALL = $(BUILD_DIRS)
config_dummy := $(shell test -f config/config || ( echo '*** '; echo '*** Making default config file ***'; echo '*** '; ./configure; ) >&2)
include $(TOP)/config/common_make_rules
ifeq ($(TARGET_OS),wince)
BUILD_DIRS += wince
endif
config/config: config/config.in config.status
./config.status
configure: configure.in
autoconf
get_voices:
./bin/get_voices us_voices
# ./bin/get_voices indic_voices
backup: time-stamp
@ $(RM) -f $(TOP)/FileList
@ $(MAKE) file-list
@ echo .time-stamp >>FileList
@ ln -s . $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)
@ sed 's/^\.\///' <FileList | sed 's/^/'$(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)'\//' >.file-list-all
@ tar jcvf $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE).tar.bz2 `cat $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)/.file-list-all`
@ $(RM) -f $(TOP)/.file-list-all
@ $(RM) $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)
@ ls -l $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE).tar.bz2
backupbz2: time-stamp
@ $(RM) -f $(TOP)/FileList
@ $(MAKE) file-list
@ echo .time-stamp >>FileList
@ ln -s . $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)
@ sed 's/^\.\///' <FileList | sed 's/^/'$(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)'\//' | grep -v cmu_us_kal | grep -v cmu_us_awb | grep -v cmu_us_rms | grep -v cmu_us_slt | grep -v cmu_time_awb >.file-list-all
@ tar jcvf $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE).tar.bz2 `cat $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)/.file-list-all`
@ $(RM) -f $(TOP)/.file-list-all
@ $(RM) $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE)
@ ls -l $(PROJECT_PREFIX)-$(PROJECT_VERSION)-$(PROJECT_STATE).tar.bz2
tags:
@ $(RM) -f $(TOP)/FileList
@ $(MAKE) file-list
etags `cat FileList | grep "\.[ch]$$"`
install:
@echo Installing
mkdir -p $(DESTDIR)$(INSTALLBINDIR)
mkdir -p $(DESTDIR)$(INSTALLLIBDIR)
mkdir -p $(DESTDIR)$(INSTALLINCDIR)
$(INSTALL) -m 644 include/*.h $(DESTDIR)$(INSTALLINCDIR)
@ $(MAKE) -C main --no-print-directory DESTDIR=$(DESTDIR) install
time-stamp :
@ echo $(PROJECT_NAME) >.time-stamp
@ echo $(PROJECT_PREFIX) >>.time-stamp
@ echo $(PROJECT_VERSION) >>.time-stamp
@ echo $(PROJECT_DATE) >>.time-stamp
@ echo $(PROJECT_STATE) >>.time-stamp
@ echo $(LOGNAME) >>.time-stamp
@ hostname >>.time-stamp
@ date >>.time-stamp
# Convinience command, to generate cg dumped voices
voices: ./bin/flite_cmu_us_awb ./bin/flite_cmu_us_rms ./bin/flite_cmu_us_rms
mkdir -p voices
./bin/flite_cmu_us_awb -voicedump voices/cmu_us_awb.flitevox
./bin/flite_cmu_us_rms -voicedump voices/cmu_us_rms.flitevox
./bin/flite_cmu_us_slt -voicedump voices/cmu_us_slt.flitevox
test:
@ $(MAKE) --no-print-directory -C testsuite test

430
README.md Normal file
View File

@ -0,0 +1,430 @@
Flite: a small run-time speech synthesis engine
version 2.1-release
Copyright Carnegie Mellon University 1999-2017
All rights reserved
http://cmuflite.org
https://github.com/festvox/flite
Flite is an open source small fast run-time text to speech engine. It
is the latest addition to the suite of free software synthesis tools
including University of Edinburgh's Festival Speech Synthesis System
and Carnegie Mellon University's FestVox project, tools, scripts and
documentation for building synthetic voices. However, flite itself
does not require either of these systems to compile and run.
The core Flite library was developed by Alan W Black <awb@cs.cmu.edu>
(mostly in his so-called spare time) while employed in the Language
Technologies Institute at Carnegie Mellon University. The name
"flite", originally chosen to mean "festival-lite" is perhaps doubly
appropriate as a substantial part of design and coding was done over
30,000ft while awb was travelling, and (usually) isn't in meetings.
The voices, lexicon and language components of flite, both their
compression techniques and their actual contents were developed by
Kevin A. Lenzo <lenzo@cs.cmu.edu> and Alan W Black <awb@cs.cmu.edu>.
Flite is the answer to the complaint that Festival is too big, too slow,
and not portable enough.
o Flite is designed for very small devices, such as PDAs, and also
for large server machines which need to serve lots of ports.
o Flite is not a replacement for Festival but an alternative run time
engine for voices developed in the FestVox framework where size and
speed is crucial.
o Flite is all in ANSI C, it contains no C++ or Scheme, thus requires
more care in programming, and is harder to customize at run time.
o It is thread safe
o Voices, lexicons and language descriptions can be compiled
(mostly automatically for voices and lexicons) into C representations
from their FestVox formats
o All voices, lexicons and language model data are const and in the
text segment (i.e. they may be put in ROM). As they are linked in
at compile time, there is virtually no startup delay.
o Although the synthesized output is not exactly the same as the same
voice in Festival they are effectively equivalent. That is, flite
doesn't sound better or worse than the equivalent voice in festival,
just faster, smaller and scalable.
o For standard diphone voices, maximum run time memory
requirements are approximately less than twice the memory requirement
for the waveform generated. For 32bit archtectures
this effectively means under 1M.
o The flite program supports, synthesis of individual strings or files
(utterance by utterance) to direct audio devices or to waveform files.
o The flite library offers simple functions suitable for use in specific
applications.
Flite is distributed with a single 8K diphone voice (derived from the
cmu_us_kal voice), a pruned lexicon (derived from
cmulex) and a set of models for US English. Here are comparisons
with Festival using basically the same 8KHz diphone voice
Flite Festival
core code 60K 2.6M
USEnglish 100K ??
lexicon 600K 5M
diphone 1.8M 2.1M
runtime <1M 16-20M
On a 500Mhz PIII, a timing test of the first two chapters of
"Alice in Wonderland" (doc/alice) was done. This produces about
1300 seconds of speech. With flite it takes 19.128 seconds (about
70.6 times faster than real time) with Festival it takes 97 seconds
(13.4 times faster than real time). On the ipaq (with the 16KHz diphones)
flite synthesizes 9.79 time faster than real time.
Requirements:
-------------
o A good C compiler, some of these files are quite large and some C
compilers might choke on these, gcc is fine. Sun CC 3.01 has been
tested too. Visual C++ 6.0 is known to fail on the large diphone
database files. We recommend you use GCC Windows Subsystem for Linux
Cygwin or mingw32 instead.
o GNU Make
o An audio device isn't required as flite can write its output to
a waveform file.
Supported platforms:
--------------------
We have successfully compiled and run on
o Various Intel Linux systems (and iPaq Linux), under various versions
of GCC (2.7.2 to 6.x)
o Mac OS X
o Various Android devices
o Various openwrt devices
o FreeBSD 3.x and 4.x
o Solaris 5.7, and Solaris 9
o Windows 2000/XP and later under Cygwin 1.3.5 and later
o Windows 10 with Windows Subsystem for Linux
o Successfully compiles and runs under 64Bit Linux architectures
o OSF1 V4.0 (gives an unimportant warning about sizes when compiled cst_val.c)
Previously we supported PalmOS and Windows CE but these seem to be rare
nowadays so they are no longer actively supported.
Other similar platforms should just work, we have also cross compiled
on a Linux machine for StrongARM. However note that new byte order
architectures may not work directly as there is some careful
byte order constraints in some structures. These are portable but may
require reordering of some fields, contact us if you are moving to
a new archiecture.
News
----
New in 2.1 (Oct 2017)
o Improved Indic front end support (thanks to Suresh Bazaj @ Hear2Read)
o 18 English Voices (various accents)
o 12 Indian Voices (Bengali, Gujarati, Hindi, Kannada, Marathi, Panjabi
Tamil and Telugu) usually with bilingual (with English) support
o Can do byteswap architectures [again] (ar9331 yun arduino, zsun etc)
o flitecheck front-end test suite
o grapheme based festvox builds give working flitevox voices
o SAPI support for CG voices (thanks to Alok Parlikar @ Cobalt Speech and
Language INC)
o gcc 6.x support
o .flitevox files (and models) 40% of previous size, but same quality
New in 2.0.0 (Dec 2014)
o Indic language support (Hindi, Tamil and Telugu)
o SSML support
o CG voices as files accessilble by file:/// and http://
(and set of 13 voices to load)
o random forest (multimodel support) improves voice quality
o Supports diffrent sample rates/mgc order to tune for speed
o Kal diphone 500K smaller
o Fixed lots of API issues
o thread safe (again) [after initialization]
o Generalized tokenstreams (used in Bard Storyteller)
o simple-Pulseaudio support
o Improved Android support
o Removed PalmOS support from distribution
o Companion multilingual ebook reader Bard Storyteller
https://github.com/festvox/bard
New in 1.4.1 (March 2010)
o better ssml support (actually does something)
o better clunit support (smaller)
o Android support
New in 1.4 (December 2009)
o crude multi-voice selection support (may change)
o 4 basic voices are included 3 clustergen (awb, rms and slt) plus
the kal diphone database
o CMULEX now uses maximum onset for syllabification
o alsa support
o Clustergen support (including mlpg with mixed excitation)
But is still slow on limited processors
o Windows support with Visual Studio (specifically for the Olympus
Spoken Dialog System)
o WinCE support is redone with cegcc/mingw32ce with example
example TTS app: Flowm: Flite on Windows Mobile
o Speed-ups in feature interpretation limiting calls to alloc
o Speed-ups (and fixes) for converting clunits festvox voices
New in 1.3-release (October 2005)
o fixes to lpc residual extraction to give better quality output
o An updated lexicon (festlex_CMU from festival-2.0.95) and better
compression its about 30% of the previous size, with about
the same accuracy
o Fairly substantial code movements to better support PalmOS and
multi-platform cross compilation builds
o A PalmOS 5.0 port with an small example talking app ("flop")
o runs under ix86_64 linux
New in 1.2-release (February 2003)
o A build process for diphone and clunits/ldom voices
FestVox voices can be converted (sometimes) automatically
o Various bug fixes
o Initial support for Mac OS X (not talking to audio device yet)
but compiles and runs
o Text files can be synthesize to a single audio file
o (optional) shared library support (Linux)
Compilation
-----------
In general
tar zxvf flite-2.1-current.tar.gz
cd flite-2.1-current
./configure
make
make get_voices
Where tar is gnu tar (gtar), and make is gnu make (gmake).
Or
git clone http://github.com/festvox/flite
cd flite
./configure
make
make get_voices
Configuration should be automatic, but maybe doesn't work in all cases
especially if you have some new compiler. You can explicitly set the
compiler in config/config and add any options you see fit. Configure
tries to guess these but it might be unable to guess for cross
compilation cases Interesting options there are
-DWORDS_BIGENDIAN=1 for bigendian machines (e.g. Sparc, M68x, ar9331)
-DNO_UNION_INITIALIZATION=1 For compilers without C 99 union inintialization
-DCST_AUDIO_NONE if you don't need/want audio support
There are different sets of voices and languages you can select between
them (and your own sets if you make config/XXX.lv). For example
./configure --with-langvox=transtac
Will use the languages and voices defined in config/transtac.lv
Usage:
------
The ./bin/flite binary contains all supported voices and you may
choose between the voices with the -voice flag and list the supported
voices with the -lw flag. Note the kal (diphone) voice is a different
technology from the others and is much less computationally expensive
but more robotic. For each voice additional binaries that contain
only that voice are created in ./bin/flite_FULLVOICENAME,
e.g. ./bin/flite_cmu_us_awb. You can also refer to external clustergen
.flitevox voice via a pathname argument with -voice (note the pathname
must contain at least one "/")
If it compiles properly a binary will be put in bin/, note by
default -g is on so it will be bigger than is actually required
./bin/flite "Flite is a small fast run-time synthesis engine" flite.wav
Will produce an 8KHz riff headered waveform file (riff is Microsoft's
wave format often called .WAV).
./bin/flite doc/alice
Will play the text file doc/alice. If the first argument contains
a space it is treated as text otherwise it is treated as a filename.
If a second argument is given a waveform file is written to it,
if no argument is given or "play" is given it will attempt to
write directly to the audio device (if supported). if "none"
is given the audio is simply thrown away (used for benchmarking).
Explicit options are also available.
./bin/flite -v doc/alice none
Will synthesize the file without playing the audio and give a summary
of the speed.
./bin/flite doc/alice alice.wav
will synthesize the whole of alice into a single file (previoous
versions would only give the last utterance in the file, but
that is fixed now).
An additional set of feature setting options are available, these are
*debug* options, Voices are represented as sets of feature values (see
lang/cmu_us_kal/cmu_us_kal.c) and you can override values on the
command line. This can stop flite from working if malicious values
are set and therefor this facility is not intended to be made
available for standard users. But these are useful for
debugging. Some typical examples are
Use simple concatenation of diphones without prosodic modification
./bin/flite --sets join_type=simple_join doc/intro
Print sentences as they are said
./bin/flite -pw doc/alice
Make it speak slower
./bin/flite --setf duration_stretch=1.5 doc/alice
Make it speak higher pitch
./bin/flite --setf int_f0_target_mean=145 doc/alice
The talking clock is an example talking clode as discussed on
http://festvox.org/ldom it requires a single argument HH:MM
under Unix you can call it
./bin/flite_time `date +%H:%M`
List the voices linked in directly in this build
./bin/flite -lv
Speak with the US male rms voice (builtin version)
./bin/flite -voice rms -f doc/alice
Speak with the "Scottish" male awb voice (builtin version)
./bin/flite -voice awb -f doc/alice
Speak with the US female slt voice
./bin/flite -voice slt -f doc/alice
Speak with AEW voice, download on the fly from festvox.org
./bin/flite -voice http://festvox.org/flite/packed/flite-2.1/voices/cmu_us_aew.flitevox -f doc/alice
Speak with AHW voice loaded from the local file.
./bin/flite -voice voices/cmu_us_ahw.flitevox -f doc/alice
You can download the available voices into voices/
./bin/get_voices us_voices
and/or
./bin/get_voices indic_voices
Voice quality
-------------
So you've eagerly downloaded flite, compiled it and run it, now you
are disappointed that it doesn't sound wonderful, sure its fast and
small but what you really hoped for was the dulcit tones of a deep
baritone voice that would make you desperately hang on every phrase it
mellifluously produces. But instead you get an 8Khz diphone voice that
sounds like it came from the last millenium.
Well, first, you are right, it is an 8KHz diphone voice from the last
millenium, and that was actually deliberate. As we developed flite we
wanted a voice that was stable and that we could directly compare with
that very same voice in Festival. Flite is an *engine*. We want to
be able take voices built with the FestVox process and compile them
for flite, the result should be exactly the same quality (though of
course trading the size for quality in flite is also an option). The
included voice is just a sample voice that was used in the testing
process.
We expect that often voices will be loaded from external files, and we
have now set up a voice repository in
http://festvox.org/flite/flite-2.1/voices/*.flitevox
If you visit there with a browser you can hear the examples. You can
also download the .flitevox files to you machine so you don't need a
network connect everytime you need to load a voice.
We are now actively adding to this list of available voices in English (16)
and other languages.
Bard Storyteller: https://github.com/festvox/bard
--------------------------------------------------
Bard is a companion app that reads ebooks, both displaying them and
actually reading them to you out loud using flite. Bard supports a
wide range of fonts, and flite voices, and books in text, html and
epub format. Bard is used as a evaluation of flite's capabilities and
an example of a serious application using flite.

59
android/Makefile Normal file
View File

@ -0,0 +1,59 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2010 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Author: Alok Parlikar (aup@cs.cmu.edu) ##
## ##
## Android support for Flite ##
## ##
## Android support for Flite is now in a different project ##
## ##
## git clone https://github.com/happyalu/Flite-TTS-Engine-for-Android ##
## ##
## and follow instructions in Flite-TTS-Engine-for-Android/README.rst ##
## ##
###########################################################################
TOP = ..
DIRNAME = android
BUILD_DIRS =
ALL_DIRS = $(BUILD_DIRS)
H =
SRCS =
OBJS = $(SRCS:.c=.o)
IMGS =
OTHER =
FILES = Makefile README
include $(TOP)/config/common_make_rules
all:

11
android/README Normal file
View File

@ -0,0 +1,11 @@
Android Support for Flite
-------------------------
This directory provides the source code of an Android app that can use Flite.
This is now in a separate project
git clone https://github.com/happyalu/Flite-TTS-Engine-for-Android
and follow instructions in Flite-TTS-Engine-for-Android/README.rst

1568
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1796
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

48
config/Makefile Normal file
View File

@ -0,0 +1,48 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 1999 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Config directory ##
## ##
###########################################################################
TOP=..
DIRNAME=config
BUILD_DIRS =
ALL_DIRS=
LVMODULES = all.lv default.lv transtac.lv android.lv ben.lv bolt.lv
FILES = Makefile common_make_rules project.mak config.in system.mak.in \
$(LVMODULES)
ALL =
include $(TOP)/config/common_make_rules

9
config/all.lv Normal file
View File

@ -0,0 +1,9 @@
#
# all languages, lexicons and voices
LEXES = cmulex cmu_dari_lex cmu_pashto_lex cmu_iq_lex cmu_indic_lex
LANGS = usenglish cmu_dari_lang cmu_pashto_lang cmu_iq_lang cmu_indic_lang
VOXES = cmu_us_kal cmu_time_awb cmu_us_kal16 \
cmu_us_awb cmu_us_rms cmu_us_slt
EXTRABINS = $(BINDIR)/flite_time$(EXEEXT)

5
config/android.lv Normal file
View File

@ -0,0 +1,5 @@
#
# The base languages, lexicons and voices
LEXES += cmulex cmu_indic_lang
LANGS += usenglish cmu_indic_lex
#VOXES += cmu_us_generic_cg

7
config/ben.lv Normal file
View File

@ -0,0 +1,7 @@
#
# The base languages, lexicons and voices
LEXES += cmulex
LANGS += usenglish
VOXES += cmu_us_kal

9
config/bolt.lv Normal file
View File

@ -0,0 +1,9 @@
#
# The base languages, lexicons and voices
LEXES = cmulex cmu_iq_lex
LANGS = usenglish cmu_iq_lang
VOXES = cmu_us_rms
VOXES = cmu_us_kal cmu_us_rms
EXTRABINS =

219
config/common_make_rules Normal file
View File

@ -0,0 +1,219 @@
########################################################-*-mode:Makefile-*-
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 1999 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Common make rules included in all Makefiles ##
## ##
###########################################################################
# System type
-include $(TOP)/config/system.mak
# Include project specific rules
-include $(TOP)/config/project.mak
## User defined configuration options
include $(TOP)/config/config
INCLUDES = -I$(TOP)/include
ifeq ($(TARGET_OS),palmos)
INCLUDES += -I$(TOP)/palm/include
endif
CPPFLAGS += $(LOCAL_INCLUDES) $(INCLUDES)
CFLAGS += $(EXTRA_CC_FLAGS) $(OPT) $(DBG)
## These'll become (target)arch dependent at some point
TARGET_PLATFORM=$(TARGET_CPU)-$(TARGET_OS)
HOST_PLATFORM=$(HOST_CPU)-$(HOST_OS)
ifndef BUILDDIR
BUILDDIR=$(TOP)/build/$(TARGET_PLATFORM)
endif
OBJDIR=$(BUILDDIR)/obj/$(DIRNAME)
BINDIR=$(BUILDDIR)/bin
ifeq ($(HOST_PLATFORM),$(TARGET_PLATFORM))
BINDIR=$(TOP)/bin
endif
LIBDIR=$(BUILDDIR)/lib
BUILDDIRS=$(OBJDIR) $(BINDIR) $(LIBDIR)
FLITELIBS = $(BUILDDIR)/lib/libflite.a
FLITELIBFLAGS = -L$(BUILDDIR)/lib -lflite
LDFLAGS += -lm $(AUDIOLIBS) $(OTHERLIBS)
FULLOBJS = $(OBJS:%=$(OBJDIR)/%)
ifdef SHFLAGS
SOOBJS = $(OBJS:.o=.os)
FULLSHOBJS = $(SOOBJS:%=$(OBJDIR)/%)
ifdef LIBNAME
ALL += $(OBJDIR)/.build_so
endif
endif
ifdef LIBNAME
ALL += $(OBJDIR)/.build_lib
endif
# Only do some directories when you are not cross compiling
ifeq ($(HOST_PLATFORM),$(TARGET_PLATFORM))
OTHER_BUILD_DIRS = $(HOST_ONLY_DIRS)
ALL += $(HOST_ONLY_BUILDS)
endif
# When target is palm add the palm directory at the top level
ifeq ($(DIRNAME),)
ifeq ($(TARGET_OS),palmos)
OTHER_BUILD_DIRS += palm
endif
endif
all: $(BUILDDIRS) $(OTHER_BUILD_DIRS) $(OBJDIR)/.make_build_dirs $(ALL) nothing
nothing:
@ echo > /dev/null
$(BUILDDIRS):
@ mkdir -p $@ 2>/dev/null || true
$(OBJDIR)/%.o : %.c
$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.os : %.c
$(CC) $(SHFLAGS) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(OBJDIR)/.build_lib: $(FULLOBJS)
@ (cd $(OBJDIR) && $(AR) cruv ../../../$(LIBDIR)/lib$(LIBNAME).a $(OBJS))
@ $(RANLIB) $(LIBDIR)/lib$(LIBNAME).a
@ touch $(OBJDIR)/.build_lib
$(OBJDIR)/.build_so: $(FULLSHOBJS)
@ (cd $(OBJDIR) && $(AR) cruv ../../../$(LIBDIR)/lib$(LIBNAME).shared.a $(SOOBJS))
@ $(RANLIB) $(LIBDIR)/lib$(LIBNAME).shared.a
@ touch $(OBJDIR)/.build_so
# Used in the lib/ directory and in building new voices
$(LIBDIR)/%.so: $(LIBDIR)/%.shared.a
@ echo making $@
@ rm -rf shared_os && mkdir shared_os
@ rm -f $@ $@.${PROJECT_VERSION} $@.${PROJECT_SHLIB_VERSION}
@ (cd shared_os && ar x ../$<)
@ (cd shared_os && $(CC) -shared -Wl,-soname,`basename $@`.${PROJECT_SHLIB_VERSION} -o ../$@.${PROJECT_VERSION} *.os)
@ (cd $(LIBDIR) && ln -s `basename $@.${PROJECT_VERSION}` `basename $@.${PROJECT_SHLIB_VERSION}` )
@ (cd $(LIBDIR) && ln -s `basename $@.${PROJECT_SHLIB_VERSION}` `basename $@` )
@ rm -rf shared_os
$(OBJDIR)/.make_build_dirs:
@ echo making in $(DIRNAME) ...
ifdef BUILD_DIRS
@ set -e; for i in $(BUILD_DIRS) $(OTHER_BUILD_DIRS) ; \
do \
$(MAKE) -C $$i --no-print-directory; \
done
endif
clean:
@ echo make clean in $(DIRNAME) ...
@ rm -rf .build_lib .build_so *.o *.os *.a *~ $(LOCAL_CLEAN) $(OBJDIR)
ifdef ALL_DIRS
@ set -e; for i in $(ALL_DIRS) ; \
do \
$(MAKE) -C $$i --no-print-directory clean; \
done
endif
distclean:
@ echo make distclean in $(DIRNAME) ...
ifdef ALL_DIRS
@ set -e; for i in $(ALL_DIRS) ; \
do \
$(MAKE) -C $$i --no-print-directory distclean; \
done
endif
@ rm -rf .build_lib .build_shlib make.depend \
*.o *.os *.a *~ $(LOCAL_CLEAN) $(DIST_CLEAN) $(OBJDIR)
DEPEND=$(OBJDIR)/make.depend
MAKE_DEPEND=$(CC) -MM $(CPPFLAGS) $(CFLAGS)
depend:
@ echo make depend in $(DIRNAME) ...
@ rm -f $(DEPEND)
@ $(MAKE) nothing
ifdef ALL_DIRS
@ set -e; for i in $(ALL_DIRS) ; \
do \
$(MAKE) -C $$i --no-print-directory depend ; \
done
endif
$(DEPEND): $(SRCS) $(OBJDIR)
ifdef BUILD_DIRS
@ rm -f $(DEPEND)
@ for i in $(SRCS) ; \
do \
echo "# $$i" ; \
$(MAKE_DEPEND) $$i | sed -e 's,^\([^:][^:]*\):,$(OBJDIR)/\1:,'; \
echo ; \
done > $(DEPEND)
endif
file-list:
@ echo making file-list in $(DIRNAME) ...
ifeq ($(TOP),.)
@ for f in $(FILES) ; \
do \
echo $$f >>$(TOP)/FileList ; \
done
else
@ for f in $(FILES) ; \
do \
echo $(DIRNAME)/$$f >>$(TOP)/FileList ; \
done
endif
ifdef ALL_DIRS
@ for i in $(ALL_DIRS) ; \
do \
$(MAKE) -C $$i --no-print-directory file-list; \
done
endif
info:
@echo Project Name = $(PROJECT_NAME)
@echo Project Prefix = $(PROJECT_PREFIX)
@echo Project Version = $(PROJECT_VERSION)
@echo Project Date = $(PROJECT_DATE)
@echo Project State = $(PROJECT_STATE)
@echo
@echo Configuration Variables
@echo none at present
# If there are sources in this directory, load in the dependencies
ifdef SRCS
-include $(DEPEND)
endif

55
config/config.in Normal file
View File

@ -0,0 +1,55 @@
# -*- makefile -*-
#
# This file is automatically generated by configure.
# Do not hand edit.
TARGET_OS = @TARGET_OS@
TARGET_CPU = @TARGET_CPU@
HOST_OS = @HOST_OS@
HOST_CPU = @HOST_CPU@
CC = @CC@
CFLAGS = @CFLAGS@ @ENDIANDEFS@
CPPFLAGS = @CPPFLAGS@
SHFLAGS = @SHFLAGS@
LDFLAGS = @LDFLAGS@
AR = @AR@
RANLIB = @RANLIB@
INSTALL = @INSTALL@
NM = @NM@
M68KCC = @M68KCC@
WINDRES = @WINDRES@
DLLTOOL = @DLLTOOL@
DLLWRAP = @DLLWRAP@
SIZE = @SIZE@
STRIP = @STRIP@
AUDIODRIVER = @AUDIODRIVER@
AUDIODEFS = @AUDIODEFS@
AUDIOLIBS = @AUDIOLIBS@
LEXDEFS = @LEXDEFS@
VOXDEFS = @VOXDEFS@
OTHERLIBS = @OTHERLIBS@
MMAPTYPE = @MMAPTYPE@
STDIOTYPE = @STDIOTYPE@
FL_LANG = @FL_LANG@
FL_VOX = @FL_VOX@
FL_LEX = @FL_LEX@
# The list of which languages, lexicons and voices have to be included
langvox = @FL_LANGVOX@
include $(TOP)/config/$(langvox).lv
prefix = @prefix@
exec_prefix = @exec_prefix@
EXEEXT = @EXEEXT@
INSTALLBINDIR = @bindir@
INSTALLLIBDIR = @libdir@
INSTALLINCDIR = @includedir@/flite

8
config/default.lv Normal file
View File

@ -0,0 +1,8 @@
#
# The base languages, lexicons and voices
LEXES += cmulex cmu_indic_lex cmu_grapheme_lex
LANGS += usenglish cmu_indic_lang cmu_grapheme_lang
VOXES += cmu_us_kal cmu_time_awb cmu_us_kal16 \
cmu_us_awb cmu_us_rms cmu_us_slt
EXTRABINS += $(BINDIR)/flite_time$(EXEEXT)

43
config/project.mak Normal file
View File

@ -0,0 +1,43 @@
########################################################-*-mode:Makefile-*-
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 1999 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Project description ##
## ##
###########################################################################
PROJECT_NAME = Festival Lite
PROJECT_PREFIX = flite
PROJECT_VERSION = 2.1
PROJECT_DATE = Dec 2017
PROJECT_STATE = release
PROJECT_SHLIB_VERSION = 1

9
config/system.mak.in Normal file
View File

@ -0,0 +1,9 @@
# -*- makefile -*-
#
# This file is automatically generated by configure.
# Do not hand edit.
OSTYPE := @host_os@
MACHINETYPE := @host_cpu@
PLATFORM := @host@
FULLOSTYPE := @host_vendor@-@host_os@

9
config/transtac.lv Normal file
View File

@ -0,0 +1,9 @@
#
# The base languages, lexicons and voices
LEXES = cmulex cmu_dari_lex cmu_pashto_lex
LANGS = usenglish cmu_dari_lang cmu_pashto_lang
VOXES = cmu_us_rms
VOXES = cmu_us_kal cmu_us_rms
EXTRABINS =

5640
configure vendored Executable file

File diff suppressed because it is too large Load Diff

490
configure.in Normal file
View File

@ -0,0 +1,490 @@
dnl########################################################################
dnl ##
dnl Language Technologies Institute ##
dnl Carnegie Mellon University ##
dnl Copyright (c) 1999-2008 ##
dnl All Rights Reserved. ##
dnl ##
dnl Permission is hereby granted, free of charge, to use and distribute ##
dnl this software and its documentation without restriction, including ##
dnl without limitation the rights to use, copy, modify, merge, publish, ##
dnl distribute, sublicense, and/or sell copies of this work, and to ##
dnl permit persons to whom this work is furnished to do so, subject to ##
dnl the following conditions: ##
dnl 1. The code must retain the above copyright notice, this list of ##
dnl conditions and the following disclaimer. ##
dnl 2. Any modifications must be clearly marked as such. ##
dnl 3. Original authors' names are not deleted. ##
dnl 4. The authors' names are not used to endorse or promote products ##
dnl derived from this software without specific prior written ##
dnl permission. ##
dnl ##
dnl CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
dnl DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
dnl ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
dnl SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
dnl ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
dnl THIS SOFTWARE. ##
dnl ##
dnl########################################################################
AC_INIT(include/flite.h)
AC_CANONICAL_SYSTEM
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_CHECK_TOOL(AR, ar)
AC_C_BIGENDIAN(ENDIANDEFS=-DWORDS_BIGENDIAN=1,,)
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall"
fi
AC_ARG_ENABLE( shared,
[ --disable-shared without shared library support],
[case "${enableval}" in
yes) shared=true ;;
no) shared=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for shared options) ;;
esac],
[shared=false])
case "$target_cpu" in
i386|i486|i586|i686)
TARGET_CPU=i386
;;
*)
TARGET_CPU=$target_cpu
;;
esac
TARGET_OS=$target_os
M68KCC=
M68KCLAGS=
WINDRES=
CHROMEBIN_PREFIX=
if test "$target_os" = "chrome" ; then
case "$TARGET_CPU" in
i386*)
CFLAGS="$CFLAGS -m32"
CHROMEBIN_PREFIX=" $CHROME_NDK/toolchain/linux_x86_newlib/bin/i686-nacl"
;;
x86_64*)
CFLAGS="$CFLAGS -m64"
CHROMEBIN_PREFIX=" $CHROME_NDK/toolchain/linux_x86_newlib/bin/x86_64-nacl"
esac
fi
case "$target_os" in
palmos*)
shared=false
CFLAGS="$CFLAGS -DCST_NO_SOCKETS"
# PalmOS Apps are always in M68K
M68KCC=/usr/m68k-palmos/bin/gcc
# Generic build is ARM or M68K (probably ARM though)
CC="/usr/$TARGET_CPU-palmos/bin/gcc"
if test "$target_cpu" = "arm"
then
CC="$CC -fPIC -march=armv4t"
fi
RANLIB=/usr/$TARGET_CPU-palmos/bin/ranlib
AR=/usr/$TARGET_CPU-palmos/bin/ar
LEXDEFS="-DCST_NO_STATIC_LEX -DCST_NO_STATIC_LTS_MODEL"
VOXDEFS="-DCST_NO_STATIC_VOX"
;;
dnl wince*)
dnl # For the GNUWINCE environment
dnl # http://win-ce.voxware.com:28575/Development%20Tools/
dnl shared=false
dnl CFLAGS="$CFLAGS -DCST_NO_SOCKETS -march=armv4 -mapcs-32 -malignment-traps -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
dnl CC="/usr/local/wince/bin/arm-wince-pe-gcc"
dnl RANLIB=/usr/local/wince/bin/arm-wince-pe-ranlib
dnl AR=/usr/local/wince/bin/arm-wince-pe-ar
dnl ;;
wince*)
# For the CEGCC environment (mingw32ce)
# http://cegcc.sourceforge.net/
shared=false
# cegcc
# CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_CE -DNEWLIB -DSARM -DWIN32 -DGNUWINCE"
# CC="/opt/cegcc/bin/arm-cegcc-gcc"
# RANLIB="/opt/cegcc/bin/arm-cegcc-ranlib"
# AR="/opt/cegcc/bin/arm-cegcc-ar"
# mingw32ce
CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_CE -DSARM -DWIN32"
if test -f "/opt/mingw32ce/bin/arm-mingw32ce-gcc"
then
MINGW32CEPREF="/opt/mingw32ce/bin/arm-mingw32ce-"
else
MINGW32CEPREF="/opt/mingw32ce/bin/arm-wince-mingw32ce-"
fi
CC="${MINGW32CEPREF}gcc"
RANLIB="${MINGW32CEPREF}ranlib"
AR="${MINGW32CEPREF}ar"
SIZE="${MINGW32CEPREF}size"
STRIP="${MINGW32CEPREF}strip"
WINDRES="${MINGW32CEPREF}windres"
DLLTOOL="${MINGW32CEPREF}dlltool"
DLLWRAP="${MINGW32CEPREF}dllwrap"
NM="${MINGW32CEPREF}nm"
;;
mingw*)
# For the Windows under mingw32 environment
# http://www.mingw.org
shared=false
CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared"
MINGWPREF="i386-mingw32-"
CC="${MINGWPREF}gcc"
RANLIB="${MINGWPREF}ranlib"
AR="${MINGWPREF}ar"
WINDRES="${MINGWPREF}windres"
DLLTOOL="${MINGWPREF}dlltool"
DLLWRAP="${MINGWPREF}dllwrap"
NM="${MINGWPREF}nm"
;;
android*)
# For Android with Android NDK
# http://developer.android.com/sdk/ndk/index.html
shared=false
# We target our compilation to android-14 (4.0) platform
ANDROID_NDK_PLATFORM_PATH="$ANDROID_NDK/platforms/android-14"
ANDROID_GCC_VERSION=4.6
if test "$target_cpu" = "armeabi"
then
ANDROID_TOOLCHAIN="arm-linux-androideabi-$ANDROID_GCC_VERSION"
ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-arm"
ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/arm-linux-androideabi"
CFLAGS="$CFLAGS -fpic -mthumb -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
fi
if test "$target_cpu" = "armeabiv7a"
then
ANDROID_TOOLCHAIN="arm-linux-androideabi-$ANDROID_GCC_VERSION"
ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-arm"
ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/arm-linux-androideabi"
CFLAGS="$CFLAGS -fpic -march=armv7-a -mfloat-abi=softfp -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
fi
if test "$target_cpu" = "x86"
then
ANDROID_TOOLCHAIN="x86-$ANDROID_GCC_VERSION"
ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-x86"
ANDROIDBIN="$ANDROID_NDK/toolchains/x86-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/i686-linux-android"
CFLAGS="$CFLAGS -fpic -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
fi
if test "$target_cpu" = "mips"
then
ANDROID_TOOLCHAIN="mipsel-linux-android-$ANDROID_GCC_VERSION"
ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-mips"
ANDROIDBIN="$ANDROID_NDK/toolchains/mipsel-linux-android-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/mipsel-linux-android"
CFLAGS="$CFLAGS -fpic -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
fi
# Common to all android variants
CC="${ANDROIDBIN}-gcc"
RANLIB="${ANDROIDBIN}-ranlib"
AR="${ANDROIDBIN}-ar"
NM="${ANDROIDBIN}-nm"
;;
chrome*)
shared=false
CFLAGS="$CFLAGS -DCST_NO_SOCKETS"
CC="${CHROMEBIN_PREFIX}-gcc"
RANLIB="${CHROMEBIN_PREFIX}-ranlib"
AR="${CHROMEBIN_PREFIX}-ar"
NM="${CHROMEBIN_PREFIX}-nm"
;;
uclinux*)
LDFLAGS="$LDFLAGS -Wl,-elf2flt"
;;
darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp"
;;
esac
AC_SUBST(TARGET_OS)
AC_SUBST(TARGET_CPU)
AC_SUBST(M68KCC)
AC_SUBST(WINDRES)
AC_SUBST(SIZE)
AC_SUBST(STRIP)
AC_SUBST(DLLTOOL)
AC_SUBST(DLLWRAP)
AC_SUBST(NM)
AC_SUBST(LEXDEFS)
AC_SUBST(VOXDEFS)
AC_SUBST(ENDIANDEFS)
case "$host_cpu" in
i386|i486|i586|i686)
HOST_CPU=i386
;;
*)
HOST_CPU=$host_cpu
;;
esac
HOST_OS=$host_os
AC_SUBST(HOST_OS)
AC_SUBST(HOST_CPU)
SHFLAGS=
OTHERLIBS=
dnl For OpenPandora and other (softfloat) ARMs with neon
if grep -q Pandora /proc/cpuinfo
then
CFLAGS="$CFLAGS -DPANDORA -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
fi
withpic=false
AC_ARG_WITH( pic, [ --with-pic with pic ],
withpic=$with_pic )
if test "x$with_pic" = "xyes"; then
case "$target_os" in
linux*)
CFLAGS="$CFLAGS -fPIC"
;;
solaris*)
CFLAGS="$CFLAGS -fPIC"
;;
*)
CFLAGS="$CFLAGS -fPIC"
;;
esac
fi
if test "$shared" = true; then
case "$target_os" in
linux*|k*bsd*-gnu|gnu*)
SHFLAGS="-fPIC"
;;
solaris*)
SHFLAGS="-fPIC"
OTHERLIBS="-lsocket -ldl"
;;
*)
;;
esac
fi
case "$target_os" in
wince*)
# cegcc
#OTHERLIBS="-lc -lgcc -lwinsock -lcoredll"
# mingw32ce
OTHERLIBS=
;;
*)
;;
esac
AC_SUBST(OTHERLIBS)
AC_SUBST(SHFLAGS)
AC_ARG_ENABLE( sockets,
[ --disable-sockets without socket support],
[case "${enableval}" in
yes) sockets=true ;;
no) sockets=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for sockets options) ;;
esac],
[sockets=true])
if test "$sockets" = false; then
AC_DEFINE(CST_NO_SOCKETS)
fi
dnl
dnl Does this compiler support initialization of unions
dnl
AC_TRY_COMPILE([#include <stdio.h>],
[ struct a { union { float b; int c; } d; };
const struct a e = { .d={ .b=3.14 } }; ],
[unioninit=yes],
[unioninit=no])
if test "$unioninit" = no; then
AC_DEFINE(NO_UNION_INITIALIZATION)
fi
dnl
dnl Does this platform support mmap(2)
dnl Note we don't use AC_FUNC_MMAP because we really only care whether
dnl read-only mappings work.
dnl
AC_CHECK_FUNC(mmap,MMAPTYPE=posix)
dnl Force no mmap for chrome
if test "$target_os" = "chrome"
then
MMAPTYPE=none
fi
dnl AC_CHECK_FUNC doesn't seem to work for Win32 API calls...
if test "x$MMAPTYPE" = x; then
case "$target_os" in
cygwin*|mingw*)
MMAPTYPE=win32
;;
android*)
MMAPTYPE=posix
;;
*)
MMAPTYPE=none
;;
esac
fi
dnl
dnl allow the user to override the one detected above
dnl
AC_ARG_WITH( mmap,
[ --with-mmap with specific mmap support (none posix win32) ],
MMAPTYPE=$with_mmap )
AC_SUBST(MMAPTYPE)
dnl stdio type, palmos/wince are different
if test "$target_os" = "palmos"
then
STDIOTYPE=palmos
else
if test "$target_os" = "wince"
then
STDIOTYPE=wince
else
STDIOTYPE=stdio
fi
fi
AC_SUBST(STDIOTYPE)
dnl
dnl determine audio type or use none if none supported on this platform
dnl
AUDIODRIVER=none
AC_CHECK_HEADER(sys/soundcard.h,
[AUDIODRIVER="oss"
AUDIODEFS=-DCST_AUDIO_LINUX])
AC_CHECK_HEADER(machine/soundcard.h,
[AUDIODRIVER="oss"
AUDIODEFS=-DCST_AUDIO_FREEBSD])
AC_CHECK_HEADER(sys/audioio.h,
[AUDIODRIVER="sun"
AUDIODEFS=-DCST_AUDIO_SUNOS])
# We're going to make alsa the default now, if supported
AC_CHECK_HEADER(alsa/asoundlib.h,
[AUDIODRIVER="alsa"
AUDIODEFS=-DCST_AUDIO_ALSA
AUDIOLIBS=-lasound])
AC_CHECK_HEADER(mmsystem.h,
[AUDIODRIVER="wince"
AUDIODEFS=-DCST_AUDIO_WINCE
AUDIOLIBS=-lwinmm])
dnl I don't care what you ask for, for wince you get wince
case "$target_os" in
wince*)
AUDIODRIVER="wince"
AUDIODEFS=-DCST_AUDIO_WINCE
AUDIOLIBS=
;;
mingw*)
AUDIODRIVER="none"
AUDIODEFS=-DCST_AUDIO_NONE
AUDIOLIBS=
;;
android*)
AUDIODRIVER="none"
AUDIODEFS=-DCST_AUDIO_NONE
AUDIOLIBS=
;;
chrome*)
AUDIODRIVER="none"
AUDIODEFS=-DCST_AUDIO_NONE
AUDIOLIBS=
;;
*)
;;
esac
dnl
dnl allow the user to override the one detected above
dnl
AC_ARG_WITH( audio,
[ --with-audio with specific audio support (none linux freebsd etc) ],
AUDIODRIVER=$with_audio
AUDIODEFS="" )
if test "x$AUDIODEFS" = x; then
case "$AUDIODRIVER" in
linux|oss)
AUDIODRIVER=oss
AUDIODEFS=-DCST_AUDIO_LINUX
;;
alsa)
AUDIODRIVER="alsa"
AUDIODEFS=-DCST_AUDIO_ALSA
AUDIOLIBS=-lasound
;;
pa|pulseaudio)
AUDIODRIVER="pulseaudio"
AUDIODEFS=-DCST_AUDIO_PULSEAUDIO
AUDIOLIBS='-lpulse-simple -lpulse'
;;
*bsd)
AUDIODRIVER=oss
AUDIODEFS=-DCST_AUDIO_FREEBSD
;;
qnx)
AUDIODRIVER=alsa
AUDIODEFS=-DCST_AUDIO_QNX
;;
none)
AUDIODEFS=-DCST_AUDIO_NONE
;;
esac
fi
AC_SUBST(AUDIODRIVER)
AC_SUBST(AUDIODEFS)
AC_SUBST(AUDIOLIBS)
dnl
dnl language/lexicon/voice parameters
dnl
AC_ARG_WITH( lang, [ --with-lang with language ],
FL_LANG=$with_lang )
if test "x$with_lang" = "x"; then
FL_LANG="usenglish"
fi
AC_SUBST(FL_LANG)
AC_ARG_WITH( vox, [ --with-vox with vox ],
FL_VOX=$with_vox )
if test "x$with_vox" = "x"; then
FL_VOX="cmu_us_kal"
fi
AC_SUBST(FL_VOX)
AC_ARG_WITH( lex, [ --with-lex with lexicon ],
FL_LEX=$with_lex )
if test "x$with_lex" = "x"; then
FL_LEX="cmulex"
fi
AC_SUBST(FL_LEX)
AC_SUBST(EXEEXT)
FL_LANGVOX="default"
AC_ARG_WITH( langvox,
[ --with-langvox with subsets of lang, lex and voices ],
FL_LANGVOX=$with_langvox )
AC_SUBST(FL_LANGVOX)
AC_OUTPUT(config/config config/system.mak)

69
doc/Makefile Normal file
View File

@ -0,0 +1,69 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 1999 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Documenation ##
## ##
###########################################################################
TOP=..
DIRNAME=doc
BUILD_DIRS =
ALL_DIRS=
FILES = Makefile flite.texi intro.txt alice stuff.ed
ALL =
include $(TOP)/config/common_make_rules
doc: flite.html flite.pdf
cp -p flite.pdf html
flite.html: flite.texi
@ if [ ! -d html ] ; \
then mkdir -p html ; fi
(cd html; texi2html -number -split_chapter ../flite.texi)
@ if [ -d html/flite ] ; \
then mv html/flite/*.html html ; \
rmdir html/flite; fi
@ for i in html/*.html ; \
do \
sed 's/<BODY>/<BODY bgcolor="#ffffff">/' $$i >ttt.html; \
mv ttt.html $$i ; \
done
@ cat stuff.ed | ed html/flite_toc.html
@ (cd html; rm -f index.html; ln flite_toc.html index.html)
flite.pdf: flite.texi
@ texi2pdf flite.texi

456
doc/alice Normal file
View File

@ -0,0 +1,456 @@
ALICE'S ADVENTURES IN WONDERLAND by Lewis Carroll.
CHAPTER I: Down the Rabbit-Hole.
Alice was beginning to get very tired of sitting by her sister
on the bank, and of having nothing to do: once or twice she had
peeped into the book her sister was reading, but it had no
pictures or conversations in it, `and what is the use of a book,'
thought Alice `without pictures or conversation?'
So she was considering in her own mind (as well as she could,
for the hot day made her feel very sleepy and stupid), whether
the pleasure of making a daisy-chain would be worth the trouble
of getting up and picking the daisies, when suddenly a White
Rabbit with pink eyes ran close by her.
There was nothing so VERY remarkable in that; nor did Alice
think it so VERY much out of the way to hear the Rabbit say to
itself, `Oh dear! Oh dear! I shall be late!' (when she thought
it over afterwards, it occurred to her that she ought to have
wondered at this, but at the time it all seemed quite natural);
but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT-
POCKET, and looked at it, and then hurried on, Alice started to
her feet, for it flashed across her mind that she had never
before seen a rabbit with either a waistcoat-pocket, or a watch to
take out of it, and burning with curiosity, she ran across the
field after it, and fortunately was just in time to see it pop
down a large rabbit-hole under the hedge.
In another moment down went Alice after it, never once
considering how in the world she was to get out again.
The rabbit-hole went straight on like a tunnel for some way,
and then dipped suddenly down, so suddenly that Alice had not a
moment to think about stopping herself before she found herself
falling down a very deep well.
Either the well was very deep, or she fell very slowly, for she
had plenty of time as she went down to look about her and to
wonder what was going to happen next. First, she tried to look
down and make out what she was coming to, but it was too dark to
see anything; then she looked at the sides of the well, and
noticed that they were filled with cupboards and book-shelves;
here and there she saw maps and pictures hung upon pegs. She
took down a jar from one of the shelves as she passed; it was
labelled `ORANGE MARMALADE', but to her great disappointment it
was empty: she did not like to drop the jar for fear of killing
somebody, so managed to put it into one of the cupboards as she
fell past it.
`Well!' thought Alice to herself, `after such a fall as this, I
shall think nothing of tumbling down stairs! How brave they'll
all think me at home! Why, I wouldn't say anything about it,
even if I fell off the top of the house!' (Which was very likely
true.)
Down, down, down. Would the fall NEVER come to an end! `I
wonder how many miles I've fallen by this time?' she said aloud.
`I must be getting somewhere near the centre of the earth. Let
me see: that would be four thousand miles down, I think--' (for,
you see, Alice had learnt several things of this sort in her
lessons in the schoolroom, and though this was not a VERY good
opportunity for showing off her knowledge, as there was no one to
listen to her, still it was good practice to say it over) `--yes,
that's about the right distance--but then I wonder what Latitude
or Longitude I've got to?' (Alice had no idea what Latitude was,
or Longitude either, but thought they were nice grand words to
say.)
Presently she began again. `I wonder if I shall fall right
THROUGH the earth! How funny it'll seem to come out among the
people that walk with their heads downward! The Antipathies, I
think--' (she was rather glad there WAS no one listening, this
time, as it didn't sound at all the right word) `--but I shall
have to ask them what the name of the country is, you know.
Please, Ma'am, is this New Zealand or Australia?' (and she tried
to curtsey as she spoke--fancy CURTSEYING as you're falling
through the air! Do you think you could manage it?) `And what
an ignorant little girl she'll think me for asking! No, it'll
never do to ask: perhaps I shall see it written up somewhere.'
Down, down, down. There was nothing else to do, so Alice soon
began talking again. `Dinah'll miss me very much to-night, I
should think!' (Dinah was the cat.) `I hope they'll remember
her saucer of milk at tea-time. Dinah my dear! I wish you were
down here with me! There are no mice in the air, I'm afraid, but
you might catch a bat, and that's very like a mouse, you know.
But do cats eat bats, I wonder?' And here Alice began to get
rather sleepy, and went on saying to herself, in a dreamy sort of
way, `Do cats eat bats? Do cats eat bats?' and sometimes, `Do
bats eat cats?' for, you see, as she couldn't answer either
question, it didn't much matter which way she put it. She felt
that she was dozing off, and had just begun to dream that she
was walking hand in hand with Dinah, and saying to her very
earnestly, `Now, Dinah, tell me the truth: did you ever eat a
bat?' when suddenly, thump! thump! down she came upon a heap of
sticks and dry leaves, and the fall was over.
Alice was not a bit hurt, and she jumped up on to her feet in a
moment: she looked up, but it was all dark overhead; before her
was another long passage, and the White Rabbit was still in
sight, hurrying down it. There was not a moment to be lost:
away went Alice like the wind, and was just in time to hear it
say, as it turned a corner, `Oh my ears and whiskers, how late
it's getting!' She was close behind it when she turned the
corner, but the Rabbit was no longer to be seen: she found
herself in a long, low hall, which was lit up by a row of lamps
hanging from the roof.
There were doors all round the hall, but they were all locked;
and when Alice had been all the way down one side and up the
other, trying every door, she walked sadly down the middle,
wondering how she was ever to get out again.
Suddenly she came upon a little three-legged table, all made of
solid glass; there was nothing on it except a tiny golden key,
and Alice's first thought was that it might belong to one of the
doors of the hall; but, alas! either the locks were too large, or
the key was too small, but at any rate it would not open any of
them. However, on the second time round, she came upon a low
curtain she had not noticed before, and behind it was a little
door about fifteen inches high: she tried the little golden key
in the lock, and to her great delight it fitted!
Alice opened the door and found that it led into a small
passage, not much larger than a rat-hole: she knelt down and
looked along the passage into the loveliest garden you ever saw.
How she longed to get out of that dark hall, and wander about
among those beds of bright flowers and those cool fountains, but
she could not even get her head though the doorway; `and even if
my head would go through,' thought poor Alice, `it would be of
very little use without my shoulders. Oh, how I wish
I could shut up like a telescope! I think I could, if I only
know how to begin.' For, you see, so many out-of-the-way things
had happened lately, that Alice had begun to think that very few
things indeed were really impossible.
There seemed to be no use in waiting by the little door, so she
went back to the table, half hoping she might find another key on
it, or at any rate a book of rules for shutting people up like
telescopes: this time she found a little bottle on it, (`which
certainly was not here before,' said Alice,) and round the neck
of the bottle was a paper label, with the words `DRINK ME'
beautifully printed on it in large letters.
It was all very well to say `Drink me,' but the wise little
Alice was not going to do THAT in a hurry. `No, I'll look
first,' she said, `and see whether it's marked "poison" or not';
for she had read several nice little histories about children who
had got burnt, and eaten up by wild beasts and other unpleasant
things, all because they WOULD not remember the simple rules
their friends had taught them: such as, that a red-hot poker
will burn you if you hold it too long; and that if you cut your
finger VERY deeply with a knife, it usually bleeds; and she had
never forgotten that, if you drink much from a bottle marked
`poison,' it is almost certain to disagree with you, sooner or
later.
However, this bottle was NOT marked `poison,' so Alice ventured
to taste it, and finding it very nice, (it had, in fact, a sort
of mixed flavour of cherry-tart, custard, pine-apple, roast
turkey, toffee, and hot buttered toast,) she very soon finished
it off.
* * * * * * *
* * * * * *
* * * * * * *
`What a curious feeling!' said Alice; `I must be shutting up
like a telescope.'
And so it was indeed: she was now only ten inches high, and
her face brightened up at the thought that she was now the right
size for going though the little door into that lovely garden.
First, however, she waited for a few minutes to see if she was
going to shrink any further: she felt a little nervous about
this; `for it might end, you know,' said Alice to herself, `in my
going out altogether, like a candle. I wonder what I should be
like then?' And she tried to fancy what the flame of a candle is
like after the candle is blown out, for she could not remember
ever having seen such a thing.
After a while, finding that nothing more happened, she decided
on going into the garden at once; but, alas for poor Alice! when
she got to the door, she found he had forgotten the little golden
key, and when she went back to the table for it, she found she
could not possibly reach it: she could see it quite plainly
through the glass, and she tried her best to climb up one of the
legs of the table, but it was too slippery; and when she had
tired herself out with trying, the poor little thing sat down and
cried.
`Come, there's no use in crying like that!' said Alice to
herself, rather sharply; `I advise you to leave off this minute!'
She generally gave herself very good advice, (though she very
seldom followed it), and sometimes she scolded herself so
severely as to bring tears into her eyes; and once she remembered
trying to box her own ears for having cheated herself in a game
of croquet she was playing against herself, for this curious
child was very fond of pretending to be two people. `But it's no
use now,' thought poor Alice, `to pretend to be two people! Why,
there's hardly enough of me left to make ONE respectable
person!'
Soon her eye fell on a little glass box that was lying under
the table: she opened it, and found in it a very small cake, on
which the words `EAT ME' were beautifully marked in currants.
`Well, I'll eat it,' said Alice, `and if it makes me grow larger,
I can reach the key; and if it makes me grow smaller, I can creep
under the door; so either way I'll get into the garden, and I
don't care which happens!'
She ate a little bit, and said anxiously to herself, `Which
way? Which way?', holding her hand on the top of her head to
feel which way it was growing, and she was quite surprised to
find that she remained the same size: to be sure, this generally
happens when one eats cake, but Alice had got so much into the
way of expecting nothing but out-of-the-way things to happen,
that it seemed quite dull and stupid for life to go on in the
common way.
So she set to work, and very soon finished off the cake.
* * * * * * *
* * * * * *
* * * * * * *
CHAPTER II
The Pool of Tears
`Curiouser and curiouser!' cried Alice (she was so much
surprised, that for the moment she quite forgot how to speak good
English); `now I'm opening out like the largest telescope that
ever was! Good-bye, feet!' (for when she looked down at her
feet, they seemed to be almost out of sight, they were getting so
far off). `Oh, my poor little feet, I wonder who will put on
your shoes and stockings for you now, dears? I'm sure _I_ shan't
be able! I shall be a great deal too far off to trouble myself
about you: you must manage the best way you can; --but I must be
kind to them,' thought Alice, `or perhaps they won't walk the
way I want to go! Let me see: I'll give them a new pair of
boots every Christmas.'
And she went on planning to herself how she would manage it.
`They must go by the carrier,' she thought; `and how funny it'll
seem, sending presents to one's own feet! And how odd the
directions will look!
ALICE'S RIGHT FOOT, ESQ.
HEARTHRUG,
NEAR THE FENDER,
(WITH ALICE'S LOVE).
Oh dear, what nonsense I'm talking!'
Just then her head struck against the roof of the hall: in
fact she was now more than nine feet high, and she at once took
up the little golden key and hurried off to the garden door.
Poor Alice! It was as much as she could do, lying down on one
side, to look through into the garden with one eye; but to get
through was more hopeless than ever: she sat down and began to
cry again.
`You ought to be ashamed of yourself,' said Alice, `a great
girl like you,' (she might well say this), `to go on crying in
this way! Stop this moment, I tell you!' But she went on all
the same, shedding gallons of tears, until there was a large pool
all round her, about four inches deep and reaching half down the
hall.
After a time she heard a little pattering of feet in the
distance, and she hastily dried her eyes to see what was coming.
It was the White Rabbit returning, splendidly dressed, with a
pair of white kid gloves in one hand and a large fan in the
other: he came trotting along in a great hurry, muttering to
himself as he came, `Oh! the Duchess, the Duchess! Oh! won't she
be savage if I've kept her waiting!' Alice felt so desperate
that she was ready to ask help of any one; so, when the Rabbit
came near her, she began, in a low, timid voice, `If you please,
sir--' The Rabbit started violently, dropped the white kid
gloves and the fan, and skurried away into the darkness as hard
as he could go.
Alice took up the fan and gloves, and, as the hall was very
hot, she kept fanning herself all the time she went on talking:
`Dear, dear! How queer everything is to-day! And yesterday
things went on just as usual. I wonder if I've been changed in
the night? Let me think: was I the same when I got up this
morning? I almost think I can remember feeling a little
different. But if I'm not the same, the next question is, Who in
the world am I? Ah, THAT'S the great puzzle!' And she began
thinking over all the children she knew that were of the same age
as herself, to see if she could have been changed for any of
them.
`I'm sure I'm not Ada,' she said, `for her hair goes in such
long ringlets, and mine doesn't go in ringlets at all; and I'm
sure I can't be Mabel, for I know all sorts of things, and she,
oh! she knows such a very little! Besides, SHE'S she, and I'm I,
and--oh dear, how puzzling it all is! I'll try if I know all the
things I used to know. Let me see: four times five is twelve,
and four times six is thirteen, and four times seven is--oh dear!
I shall never get to twenty at that rate! However, the
Multiplication Table doesn't signify: let's try Geography.
London is the capital of Paris, and Paris is the capital of Rome,
and Rome--no, THAT'S all wrong, I'm certain! I must have been
changed for Mabel! I'll try and say "How doth the little--"'
and she crossed her hands on her lap as if she were saying lessons,
and began to repeat it, but her voice sounded hoarse and
strange, and the words did not come the same as they used to do:--
`How doth the little crocodile
Improve his shining tail,
And pour the waters of the Nile
On every golden scale!
`How cheerfully he seems to grin,
How neatly spread his claws,
And welcome little fishes in
With gently smiling jaws!'
`I'm sure those are not the right words,' said poor Alice, and
her eyes filled with tears again as she went on, `I must be Mabel
after all, and I shall have to go and live in that poky little
house, and have next to no toys to play with, and oh! ever so
many lessons to learn! No, I've made up my mind about it; if I'm
Mabel, I'll stay down here! It'll be no use their putting their
heads down and saying "Come up again, dear!" I shall only look
up and say "Who am I then? Tell me that first, and then, if I
like being that person, I'll come up: if not, I'll stay down
here till I'm somebody else"--but, oh dear!' cried Alice, with a
sudden burst of tears, `I do wish they WOULD put their heads
down! I am so VERY tired of being all alone here!'
As she said this she looked down at her hands, and was
surprised to see that she had put on one of the Rabbit's little
white kid gloves while she was talking. `How CAN I have done
that?' she thought. `I must be growing small again.' She got up
and went to the table to measure herself by it, and found that,
as nearly as she could guess, she was now about two feet high,
and was going on shrinking rapidly: she soon found out that the
cause of this was the fan she was holding, and she dropped it
hastily, just in time to avoid shrinking away altogether.
`That WAS a narrow escape!' said Alice, a good deal frightened at
the sudden change, but very glad to find herself still in
existence; `and now for the garden!' and she ran with all speed
back to the little door: but, alas! the little door was shut
again, and the little golden key was lying on the glass table as
before, `and things are worse than ever,' thought the poor child,
`for I never was so small as this before, never! And I declare
it's too bad, that it is!'
As she said these words her foot slipped, and in another
moment, splash! she was up to her chin in salt water. He first
idea was that she had somehow fallen into the sea, `and in that
case I can go back by railway,' she said to herself. (Alice had
been to the seaside once in her life, and had come to the general
conclusion, that wherever you go to on the English coast you find
a number of bathing machines in the sea, some children digging in
the sand with wooden spades, then a row of lodging houses, and
behind them a railway station.) However, she soon made out that
she was in the pool of tears which she had wept when she was nine
feet high.
`I wish I hadn't cried so much!' said Alice, as she swam about,
trying to find her way out. `I shall be punished for it now, I
suppose, by being drowned in my own tears! That WILL be a queer
thing, to be sure! However, everything is queer to-day.'
Just then she heard something splashing about in the pool a
little way off, and she swam nearer to make out what it was: at
first she thought it must be a walrus or hippopotamus, but then
she remembered how small she was now, and she soon made out that
it was only a mouse that had slipped in like herself.
`Would it be of any use, now,' thought Alice, `to speak to this
mouse? Everything is so out-of-the-way down here, that I should
think very likely it can talk: at any rate, there's no harm in
trying.' So she began: `O Mouse, do you know the way out of
this pool? I am very tired of swimming about here, O Mouse!'
(Alice thought this must be the right way of speaking to a mouse:
she had never done such a thing before, but she remembered having
seen in her brother's Latin Grammar, `A mouse--of a mouse--to a
mouse--a mouse--O mouse!' The Mouse looked at her rather
inquisitively, and seemed to her to wink with one of its little
eyes, but it said nothing.
`Perhaps it doesn't understand English,' thought Alice; `I
daresay it's a French mouse, come over with William the
Conqueror.' (For, with all her knowledge of history, Alice had
no very clear notion how long ago anything had happened.) So she
began again: `Ou est ma chatte?' which was the first sentence in
her French lesson-book. The Mouse gave a sudden leap out of the
water, and seemed to quiver all over with fright. `Oh, I beg
your pardon!' cried Alice hastily, afraid that she had hurt the
poor animal's feelings. `I quite forgot you didn't like cats.'
`Not like cats!' cried the Mouse, in a shrill, passionate
voice. `Would YOU like cats if you were me?'
`Well, perhaps not,' said Alice in a soothing tone: `don't be
angry about it. And yet I wish I could show you our cat Dinah:
I think you'd take a fancy to cats if you could only see her.
She is such a dear quiet thing,' Alice went on, half to herself,
as she swam lazily about in the pool, `and she sits purring so
nicely by the fire, licking her paws and washing her face--and
she is such a nice soft thing to nurse--and she's such a capital
one for catching mice--oh, I beg your pardon!' cried Alice again,
for this time the Mouse was bristling all over, and she felt
certain it must be really offended. `We won't talk about her any
more if you'd rather not.'
`We indeed!' cried the Mouse, who was trembling down to the end
of his tail. `As if I would talk on such a subject! Our family
always HATED cats: nasty, low, vulgar things! Don't let me hear
the name again!'
`I won't indeed!' said Alice, in a great hurry to change the
subject of conversation. `Are you--are you fond--of--of dogs?'
The Mouse did not answer, so Alice went on eagerly: `There is
such a nice little dog near our house I should like to show you!
A little bright-eyed terrier, you know, with oh, such long curly
brown hair! And it'll fetch things when you throw them, and
it'll sit up and beg for its dinner, and all sorts of things--I
can't remember half of them--and it belongs to a farmer, you
know, and he says it's so useful, it's worth a hundred pounds!
He says it kills all the rats and--oh dear!' cried Alice in a
sorrowful tone, `I'm afraid I've offended it again!' For the
Mouse was swimming away from her as hard as it could go, and
making quite a commotion in the pool as it went.
So she called softly after it, `Mouse dear! Do come back
again, and we won't talk about cats or dogs either, if you don't
like them!' When the Mouse heard this, it turned round and swam
slowly back to her: its face was quite pale (with passion, Alice
thought), and it said in a low trembling voice, `Let us get to
the shore, and then I'll tell you my history, and you'll
understand why it is I hate cats and dogs.'
It was high time to go, for the pool was getting quite crowded
with the birds and animals that had fallen into it: there were a
Duck and a Dodo, a Lory and an Eaglet, and several other curious
creatures. Alice led the way, and the whole party swam to the
shore.

1334
doc/flite.texi Normal file

File diff suppressed because it is too large Load Diff

6
doc/intro.txt Normal file
View File

@ -0,0 +1,6 @@
Flite is a small, fast run-time synthesis engine, designed for
embedded systems and servers. Flite was developed by Alan W Black and
Kevin Lenzo at Carnegie Mellon University, in Pittsburgh. The
city with TTS at its heart.

23
doc/stuff.ed Normal file
View File

@ -0,0 +1,23 @@
13
d
d
a
<ADDRESS>by <A HREF="http://www.cs.cmu.edu/~awb/">Alan W Black</A> and <A HREF="http://www.cs.cmu.edu/~lenzo/">Kevin A. Lenzo</A></ADDRESS>
<ADDRESS><A HREF="http://www.speech.cs.cmu.edu">Speech Group at Carnegie Mellon University</A></ADDRESS>
<HR>
Full distribution with sources and this document
<A HREF="http://cmuflite.org/packed/flite-2.0/flite-2.0.0-release.tar.gz">flite-2.0.0-release.tar.gz</A><br>
PDF version of this document alone
<A HREF="flite.pdf">flite.pdf</A>
<br>
Updates and news on Flite will be posted on
<A HREF="http://cmuflite.org">http://cmuflite.org</A>
</P>
<P>
NOTE: this document is incomplete
</P>
<HR>
.
w
q

46
flite.sln Normal file
View File

@ -0,0 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fliteDll", "fliteDll.vcxproj", "{FAEFFFEB-D98F-4641-A0CF-04E31C8F90F2}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cmu_us_rms", "lang\cmu_us_rms\cmu_us_rms.vcxproj", "{596A15AB-57B8-4EC2-BEC5-C34689D7ED5C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cmu_us_slt", "lang\cmu_us_slt\cmu_us_slt.vcproj", "{053E27FE-907D-4863-B99E-F39A01E5951A}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FAEFFFEB-D98F-4641-A0CF-04E31C8F90F2}.Debug|Win32.ActiveCfg = Debug|Win32
{FAEFFFEB-D98F-4641-A0CF-04E31C8F90F2}.Debug|Win32.Build.0 = Debug|Win32
{FAEFFFEB-D98F-4641-A0CF-04E31C8F90F2}.Release|Win32.ActiveCfg = Release|Win32
{FAEFFFEB-D98F-4641-A0CF-04E31C8F90F2}.Release|Win32.Build.0 = Release|Win32
{596A15AB-57B8-4EC2-BEC5-C34689D7ED5C}.Debug|Win32.ActiveCfg = Debug|Win32
{596A15AB-57B8-4EC2-BEC5-C34689D7ED5C}.Debug|Win32.Build.0 = Debug|Win32
{596A15AB-57B8-4EC2-BEC5-C34689D7ED5C}.Release|Win32.ActiveCfg = Release|Win32
{596A15AB-57B8-4EC2-BEC5-C34689D7ED5C}.Release|Win32.Build.0 = Release|Win32
{053E27FE-907D-4863-B99E-F39A01E5951A}.Debug|Win32.ActiveCfg = Debug|Win32
{053E27FE-907D-4863-B99E-F39A01E5951A}.Debug|Win32.Build.0 = Debug|Win32
{053E27FE-907D-4863-B99E-F39A01E5951A}.Release|Win32.ActiveCfg = Release|Win32
{053E27FE-907D-4863-B99E-F39A01E5951A}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
flite.v11.suo Executable file

Binary file not shown.

283
fliteDll.vcxproj Executable file
View File

@ -0,0 +1,283 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Template|Win32">
<Configuration>Template</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Template|x64">
<Configuration>Template</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<SccProjectName />
<SccLocalPath />
<ProjectGuid>{190BF306-14E8-449F-B343-5A42ECCD87C9}</ProjectGuid>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<MinimalRebuild>true</MinimalRebuild>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
<PrecompiledHeaderOutputFile>.\Debug\FliteTTSEngineObj.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>.\Debug\</ObjectFileName>
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\FliteTTSEngineObj.bsc</OutputFile>
</Bscmake>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\FliteTTSEngineObj.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
<PrecompiledHeaderOutputFile>.\Debug\FliteTTSEngineObj.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>.\Debug\</ObjectFileName>
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\FliteTTSEngineObj.bsc</OutputFile>
</Bscmake>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\FliteTTSEngineObj.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MaxSpeed</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<PrecompiledHeaderOutputFile>.\Release\FliteTTSEngineObj.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release\FliteTTSEngineObj.bsc</OutputFile>
</Bscmake>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(Outdir)\FliteTTSEngineObj.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MaxSpeed</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<PrecompiledHeaderOutputFile>.\Release\FliteTTSEngineObj.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release\FliteTTSEngineObj.bsc</OutputFile>
</Bscmake>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>$(Outdir)\FliteTTSEngineObj.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_lang.c" />
<ClCompile Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_phoneset.c" />
<ClCompile Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_phrasing_cart.c" />
<ClCompile Include="..\..\lang\cmu_grapheme_lex\cmu_grapheme_lex.c" />
<ClCompile Include="..\..\lang\cmu_grapheme_lex\grapheme_unitran_tables.c" />
<ClCompile Include="..\..\lang\cmu_indic_lang\cmu_indic_lang.c" />
<ClCompile Include="..\..\lang\cmu_indic_lang\cmu_indic_phoneset.c" />
<ClCompile Include="..\..\lang\cmu_indic_lang\cmu_indic_phrasing_cart.c" />
<ClCompile Include="..\..\lang\cmu_indic_lex\cmu_indic_lex.c" />
<ClCompile Include="FliteTTSEngineObj.cpp" />
<ClCompile Include="flite_sapi_usenglish.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_lang.h" />
<ClInclude Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_phrasing_cart.h" />
<ClInclude Include="..\..\lang\cmu_grapheme_lex\cmu_grapheme_lex.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\cmu_indic_lang.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\cmu_indic_phrasing_cart.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_eng_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_guj_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_hin_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_kan_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_mar_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_tam_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_tel_num_table.h" />
<ClInclude Include="..\..\lang\cmu_indic_lex\cmu_indic_lex.h" />
<ClInclude Include="FliteTTSEngineObj.h" />
<ClInclude Include="flite_sapi_usenglish.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\flite\flite.vcxproj">
<Project>{c8a762df-2981-43e7-967d-1cd89cca7f14}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

98
fliteDll.vcxproj.filters Executable file
View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{91f28f48-be41-4740-a034-9f29738d838b}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{f10c59ad-99f5-4d94-aad0-e923a63c5186}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="flite_sapi_usenglish.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FliteTTSEngineObj.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_lang.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_phoneset.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_phrasing_cart.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_grapheme_lex\cmu_grapheme_lex.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_grapheme_lex\grapheme_unitran_tables.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_indic_lang\cmu_indic_lang.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_indic_lang\cmu_indic_phoneset.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_indic_lang\cmu_indic_phrasing_cart.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\lang\cmu_indic_lex\cmu_indic_lex.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="flite_sapi_usenglish.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FliteTTSEngineObj.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_lang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_grapheme_lang\cmu_grapheme_phrasing_cart.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_grapheme_lex\cmu_grapheme_lex.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\cmu_indic_lang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\cmu_indic_phrasing_cart.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_guj_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_hin_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_kan_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_mar_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_tam_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_tel_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lang\indic_eng_num_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\lang\cmu_indic_lex\cmu_indic_lex.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

94
include/Makefile Normal file
View File

@ -0,0 +1,94 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 1999 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Flite basic include files ##
## ##
###########################################################################
TOP=..
DIRNAME=include
BUILD_DIRS =
ALL_DIRS=
H = cst_alloc.h \
cst_args.h \
cst_audio.h \
cst_cart.h \
cst_clunits.h \
cst_cg.h \
cst_diphone.h \
cst_endian.h \
cst_error.h \
cst_features.h \
cst_file.h \
cst_hrg.h \
cst_item.h \
cst_math.h \
cst_lexicon.h \
cst_lts.h \
cst_lts_rewrites.h \
cst_phoneset.h \
cst_regex.h \
cst_relation.h \
cst_sigpr.h \
cst_socket.h \
cst_string.h \
cst_sts.h \
cst_synth.h \
cst_tokenstream.h \
cst_track.h \
cst_units.h \
cst_utt_utils.h \
cst_utterance.h \
cst_val.h \
cst_val_const.h \
cst_val_defs.h \
cst_viterbi.h \
cst_voice.h \
cst_wave.h \
cst_ss.h \
cst_ffeatures.h \
cst_wchar.h \
flite.h
FILES = Makefile $(H) flite_version.h
INSTALL_HEADERS = $(H)
ALL = flite_version.h
LOCAL_CLEAN = flite_version.h
include $(TOP)/config/common_make_rules
flite_version.h: $(TOP)/config/project.mak
@grep "^PROJECT" $(TOP)/config/project.mak | \
awk '{printf("#define FLITE_%s \"%s",$$1,$$3); for (i=4; i<=NF; i++) printf(" %s",$$i); printf("\"\n")}' >flite_version.h

82
include/cst_alloc.h Normal file
View File

@ -0,0 +1,82 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: July 1999 */
/*************************************************************************/
/* */
/* Basic wraparounds for malloc and free */
/* */
/*************************************************************************/
#ifndef __CST_ALLOC_H__
#define __CST_ALLOC_H__
#ifndef TRUE
#define TRUE (1==1)
#endif
#ifndef FALSE
#define FALSE (1==0)
#endif
/* Global allocation (the only kind on Unix) */
void *cst_safe_alloc(int size);
void *cst_safe_calloc(int size);
void *cst_safe_realloc(void *p,int size);
/* Allocate on local heap (needed on WinCE for various reasons) */
#ifdef UNDER_CE
#include <windows.h>
typedef HANDLE cst_alloc_context;
cst_alloc_context new_alloc_context(int size);
void delete_alloc_context(cst_alloc_context ctx);
void *cst_local_alloc(cst_alloc_context ctx, int size);
void cst_local_free(cst_alloc_context ctx, void *p);
#else /* not UNDER_CE */
typedef void * cst_alloc_context;
#define new_alloc_context(size) (NULL)
#define delete_alloc_context(ctx)
#define cst_local_alloc(ctx,size) cst_safe_alloc(size)
#define cst_local_free(cst,p) cst_free(p)
#endif /* UNDER_CE */
/* The public interface to the alloc functions */
/* Note the underlying call is calloc, so everything is zero'd */
#define cst_alloc(TYPE,SIZE) ((TYPE *)cst_safe_alloc(sizeof(TYPE)*(SIZE)))
#define cst_calloc(TYPE,SIZE) ((TYPE *)cst_safe_calloc(sizeof(TYPE)*(SIZE)))
#define cst_realloc(P,TYPE,SIZE) ((TYPE *)cst_safe_realloc((void *)(P),sizeof(TYPE)*(SIZE)))
void cst_free(void *p);
#endif

49
include/cst_args.h Normal file
View File

@ -0,0 +1,49 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2001 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: November 2001 */
/*************************************************************************/
/* */
/* parse args */
/* */
/*************************************************************************/
#ifndef _CST_ARGS_H__
#define _CST_ARGS_H__
#include "cst_features.h"
cst_val *cst_args(char **argv, int argc,
const char *description,
cst_features *args);
#endif

123
include/cst_audio.h Normal file
View File

@ -0,0 +1,123 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2000 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: August 2000 */
/*************************************************************************/
/* */
/* Audio */
/* */
/*************************************************************************/
#ifndef _CST_AUDIO_H__
#define _CST_AUDIO_H__
#include "cst_wave.h"
#include "cst_hrg.h"
#ifdef CST_AUDIO_WIN32
#define CST_AUDIOBUFFSIZE 8092
#else
#define CST_AUDIOBUFFSIZE 128
#endif
#define CST_AUDIO_DEFAULT_PORT 1746
#define CST_AUDIO_DEFAULT_SERVER "localhost"
#define CST_AUDIO_DEFAULT_ENCODING "short"
typedef enum {
CST_AUDIO_LINEAR16 = 0,
CST_AUDIO_LINEAR8,
CST_AUDIO_MULAW
} cst_audiofmt;
/* Returns the number of bytes per sample for a given audio format */
int audio_bps(cst_audiofmt fmt);
typedef struct cst_audiodev_struct {
int sps, real_sps;
int channels, real_channels;
cst_audiofmt fmt, real_fmt;
int byteswap;
cst_rateconv *rateconv;
void *platform_data;
} cst_audiodev;
/* Generic audio functions */
cst_audiodev *audio_open(int sps, int channels, cst_audiofmt fmt);
int audio_close(cst_audiodev *ad);
int audio_write(cst_audiodev *ad, void *buff, int num_bytes);
int audio_flush(cst_audiodev *ad); /* wait for buffers to empty */
int audio_drain(cst_audiodev *ad); /* empty buffers now */
/* Generic high level audio functions */
int play_wave(cst_wave *w);
int play_wave_sync(cst_wave *w, cst_relation *rel,
int (*call_back)(cst_item *));
int play_wave_client(cst_wave *w, const char *servername, int port,
const char *encoding);
int auserver(int port);
/* Play wave to specified device */
int play_wave_device(cst_wave *w, cst_audiodev *ad);
/* Output to a file as if its an audio device */
cst_audiodev *audio_open_file(int sps, int channels, cst_audiofmt fmt,
const char *filename);
int audio_close_file(cst_audiodev *ad);
int audio_write_file(cst_audiodev *ad, void *buff, int num_bytes);
int audio_drain_file(cst_audiodev *ad);
int audio_flush_file(cst_audiodev *ad);
/* For audio streaming */
#define CST_AUDIO_STREAM_STOP -1
#define CST_AUDIO_STREAM_CONT 0
typedef struct cst_audio_streaming_info_struct
{
int min_buffsize;
int (*asc)(const cst_wave *w,int start,int size,
int last, struct cst_audio_streaming_info_struct *asi);
const cst_utterance *utt; /* in case you need more information */
const cst_item *item; /* because you'll probably want this */
/* But this is *not* updated automatically */
void *userdata;
} cst_audio_streaming_info;
cst_audio_streaming_info *new_audio_streaming_info();
void delete_audio_streaming_info(cst_audio_streaming_info *asi);
CST_VAL_USER_TYPE_DCLS(audio_streaming_info,cst_audio_streaming_info)
typedef int (*cst_audio_stream_callback)(const cst_wave *w,int start,int size,
int last, cst_audio_streaming_info *asi);
/* An example audio streaming callback function src/audio/au_streaming.c */
int audio_stream_chunk(const cst_wave *w, int start, int size,
int last, cst_audio_streaming_info *asi);
#endif

77
include/cst_cart.h Normal file
View File

@ -0,0 +1,77 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2000 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: January 2000 */
/*************************************************************************/
/* */
/* CART tree support */
/* */
/*************************************************************************/
#ifndef _CST_CART_H__
#define _CST_CART_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_item.h"
#include "cst_relation.h"
#define CST_CART_OP_NONE 255
#define CST_CART_OP_LEAF 255
#define CST_CART_OP_IS 0
#define CST_CART_OP_IN 1
#define CST_CART_OP_LESS 2
#define CST_CART_OP_GREATER 3
#define CST_CART_OP_MATCHES 4
#define CST_CART_OP_EQUALS 5
typedef struct cst_cart_node_struct {
unsigned char feat;
unsigned char op;
/* yes is always the next node */
unsigned short no_node; /* or answer index */
const cst_val *val;
} cst_cart_node;
typedef struct cst_cart_struct {
const cst_cart_node *rule_table;
const char * const *feat_table;
} cst_cart;
void delete_cart(cst_cart *c);
CST_VAL_USER_TYPE_DCLS(cart,cst_cart)
const cst_val *cart_interpret(cst_item *item, const cst_cart *tree);
#endif

165
include/cst_cg.h Normal file
View File

@ -0,0 +1,165 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2007-2017 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: November 2007 */
/*************************************************************************/
/* */
/* clustergen db */
/* */
/* A statistical corpus based synthesizer. */
/* See Black, A. (2006), CLUSTERGEN: A Statistical Parametric */
/* Synthesizer using Trajectory Modeling", Interspeech 2006 - ICSLP, */
/* Pittsburgh, PA. */
/* http://www.cs.cmu.edu/~awb/papers/is2006/IS061394.PDF */
/* */
/*************************************************************************/
#ifndef _CST_CG_H__
#define _CST_CG_H__
#include "cst_cart.h"
#include "cst_track.h"
#include "cst_wave.h"
#include "cst_audio.h"
#include "cst_synth.h" /* for dur_stat */
/* The parameters in the spectral model(s) may be encoded in various ways */
/* mostly to preserve space. The decoded can be dependent on the shape type */
/* This needs to be coordinated with the model creation in make_cg.scm */
/* This is currently very BIG_HAMMER-like and hard coded */
/* Original rf3 (and before) encoding stddev follows mean in pairs:
F0 (1), MCEP_STATIC (25), MCEP_DELTA (25), ME (5), Voicing (1) (114 shorts)
Encoded as linear range in unsigned short from min over range */
#define CST_CG_MODEL_SHAPE_BASE_MINRANGE 1
/* Quantized rf3, encode everything as two 8 bit values in each short.
Good generic quantized version, but the next one is used for most models
(57 shorts)
*/
#define CST_CG_MODEL_SHAPE_QUANTIZED_PARAMS 2
/* Quantized rf3, (mostly stddev follows mean in pairs -- except deltas
no F0, MCEP_STATIC (50) MCEP_DELTAS stddev (25), ME (5), Voice (2)
Encoded as unsigned chars that index into qtable. we don't include
the mcep_deltas means, they aren't needed. They are still held as shorts
so you need to sub index them see cst_cg_quantized_params_index()
(41 shorts) */
#define CST_CG_MODEL_SHAPE_QUANTIZED_PARAMS_41 3
typedef struct cst_cg_db_struct {
/* Please do not change this structure, but if you do, only add things
to the end of the struct. If do you change it , please modify
dump/load voice too (in cst_cg_dump_voice and cst_cg_map) */
const char *name;
const char * const *types;
int num_types;
int sample_rate;
float f0_mean, f0_stddev;
/* Cluster trees */
int num_f0_models;
const cst_cart ***f0_trees;
int num_param_models;
const cst_cart *** param_trees;
const cst_cart *spamf0_accent_tree; /* spam accent tree */
const cst_cart *spamf0_phrase_tree; /* spam phrase tree */
/* Model params e.g. mceps, deltas intersliced with stddevs */
/* may be compressed/quantized based on value of model_shape */
int *num_channels;
int *num_frames;
const unsigned short *** model_vectors;
int num_channels_spamf0_accent;
int num_frames_spamf0_accent;
const float * const * spamf0_accent_vectors;
/* Currently shared between different models */
const float *model_min; /* for vector coeffs encoding */
const float *model_range; /* for vector coeffs encoding */
const float ***qtable; /* q(uantization) tables for each model */
int model_shape; /* model compression technique */
float frame_advance;
/* duration models (cart + phonedurs) */
int num_dur_models;
const dur_stat *** dur_stats;
const cst_cart ** dur_cart;
/* phone to states map */
const char * const * const *phone_states;
/* Other parameters */
int do_mlpg; /* implies deltas are in the model_vectors */
float *dynwin;
int dynwinsize;
float mlsa_alpha;
float mlsa_beta;
int multimodel;
int mixed_excitation;
/* filters for Mixed Excitation */
int ME_num;
int ME_order;
const double * const *me_h;
int spamf0;
float gain;
int freeable; /* doesn't get dumped, but 1 when this a freeable struct */
} cst_cg_db;
CST_VAL_USER_TYPE_DCLS(cg_db,cst_cg_db)
void delete_cg_db(cst_cg_db *db);
cst_utterance *cg_synth(cst_utterance *utt);
cst_wave *mlsa_resynthesis(const cst_track *t,
const cst_track *str,
cst_cg_db *cg_db,
cst_audio_streaming_info *asc,
int mlsa_speech_param);
cst_track *mlpg(const cst_track *param_track, cst_cg_db *cg_db);
cst_voice *cst_cg_load_voice(const char *voxdir,
const cst_lang lang_table[]);
int cst_cg_dump_voice(const cst_voice *v,const cst_string *filename);
#endif

100
include/cst_clunits.h Normal file
View File

@ -0,0 +1,100 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2000 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: April 2001 */
/*************************************************************************/
/* */
/* clunits db */
/* */
/*************************************************************************/
#ifndef _CST_CLUNITS_H__
#define _CST_CLUNITS_H__
#include "cst_wave.h"
#include "cst_cart.h"
#include "cst_viterbi.h"
#include "cst_track.h"
#include "cst_sts.h"
#define CLUNIT_NONE (unsigned short)65535
typedef struct cst_clunit_struct {
unsigned short type, phone;
int start, end;
int prev, next;
} cst_clunit;
typedef struct cst_clunit_type_struct {
const char *name;
int start, count;
} cst_clunit_type;
typedef struct cst_clunit_db_struct {
const char *name;
const cst_clunit_type *types;
const cst_cart * const *trees;
const cst_clunit *units;
int num_types, num_units;
/* These may be set up at runtime (in file-mapped databases) */
cst_sts_list *sts, *mcep;
/* These are pre-scaled by 65536 to accomodate fixed-point machines */
const int *join_weights;
/* Misc. important parameters */
int optimal_coupling;
int extend_selections;
int f0_weight;
char *(*unit_name_func)(cst_item *s);
} cst_clunit_db;
CST_VAL_USER_TYPE_DCLS(clunit_db,cst_clunit_db)
CST_VAL_USER_TYPE_DCLS(vit_cand,cst_vit_cand)
cst_utterance *clunits_synth(cst_utterance *utt);
cst_utterance *clunits_dump_units(cst_utterance *utt);
char *clunits_ldom_phone_word(cst_item *s);
int clunit_get_unit_index(cst_clunit_db *cludb,
const char *unit_type,
int instance);
int clunit_get_unit_index_name(cst_clunit_db *cludb,
const char *name);
/* Used to test if the unit name is in the database, -1 if not */
int clunit_get_unit_type_index(cst_clunit_db *cludb, const char *name);
#define UNIT_TYPE(db,u) ((db)->types[(db)->units[(u)].type].name)
#define UNIT_INDEX(db,u) ((u) - (db)->types[(db)->units[(u)].type].start)
#endif

72
include/cst_diphone.h Normal file
View File

@ -0,0 +1,72 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2001 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: January 2001 */
/*************************************************************************/
/* */
/* Diphone databases */
/* */
/*************************************************************************/
#ifndef _CST_DIPHONE_H__
#define _CST_DIPHONE_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_wave.h"
#include "cst_track.h"
#include "cst_sts.h"
#include "cst_hrg.h"
struct cst_diphone_entry_struct {
const char *name;
unsigned short start_pm;
unsigned char pb_pm;
unsigned char end_pm;
};
typedef struct cst_diphone_entry_struct cst_diphone_entry;
struct cst_diphone_db_struct {
const char *name;
int num_entries;
const cst_diphone_entry *diphones;
const cst_sts_list *sts;
};
typedef struct cst_diphone_db_struct cst_diphone_db;
CST_VAL_USER_TYPE_DCLS(diphone_db,cst_diphone_db)
cst_utterance* diphone_synth(cst_utterance *utt);
cst_utterance *get_diphone_units(cst_utterance *utt);
#endif

72
include/cst_endian.h Normal file
View File

@ -0,0 +1,72 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: August 2000 */
/*************************************************************************/
/* */
/* endianness */
/* */
/*************************************************************************/
#ifndef __CST_ENDIAN_H__
#define __CST_ENDIAN_H__
/* This gets set to 1 and we test where the on bit is to determine byteorder */
extern const int cst_endian_loc;
/* Sun, HP, SGI Mips, M68000, PowerPC, MIPS24K AR9331 (Yun Arduino, ZSun) */
#define CST_BIG_ENDIAN (((char *)&cst_endian_loc)[0] == 0)
/* Intel, Alpha, DEC Mips, Vax, ARM, Other MIPS (GCW-Zero, Ben Nanonote etc) */
#define CST_LITTLE_ENDIAN (((char *)&cst_endian_loc)[0] != 0)
/* Perq (from Three Rivers) has a third byte order -- but we have no support */
/* EST byte order strings */
#define BYTE_ORDER_BIG "10"
#define BYTE_ORDER_LITTLE "01"
#define SWAPINT(x) ((((unsigned int)x) & 0xff) << 24 | \
(((unsigned int)x) & 0xff00) << 8 | \
(((unsigned int)x) & 0xff0000) >> 8 | \
(((unsigned int)x) & 0xff000000) >> 24)
/* For m68k we want to be a little more explicit */
#define SWAPLONG(x) ((((unsigned long)x) & 0xff) << 24 | \
(((unsigned long)x) & 0xff00) << 8 | \
(((unsigned long)x) & 0xff0000) >> 8 | \
(((unsigned long)x) & 0xff000000) >> 24)
#define SWAPSHORT(x) ((((unsigned short)x) & 0xff) << 8 | \
(((unsigned short)x) & 0xff00) >> 8)
void swap_bytes_short(short * b,int n);
void swapdouble(double *d);
void swapfloat(float *f);
#endif

78
include/cst_error.h Normal file
View File

@ -0,0 +1,78 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Error handler */
/* */
/*************************************************************************/
#ifndef _CST_ERROR_H__
#define _CST_ERROR_H__
#include <stdlib.h>
#ifdef DIE_ON_ERROR
# ifdef UNDER_CE
# define cst_error() *(int *)0=0
# else
# define cst_error() abort()
# endif
#elif __palmos__
#ifdef __ARM_ARCH_4T__
typedef long *jmp_buf[10]; /* V1-V8, SP, LR (see po_setjmp.c) */
extern jmp_buf *cst_errjmp;
extern char cst_error_msg[];
int setjmp(register jmp_buf env);
void longjmp(register jmp_buf env, register int value);
# define cst_error() (cst_errjmp ? longjmp(*cst_errjmp,1) : 0)
#else /* m68K */
/* I've never tested this or even compiled it (Flite is ARM compiled) */
# define cst_error() ErrFatalDisplayIf(-1, "cst_error")
#endif
#else /* not palmos */
#include <setjmp.h>
extern jmp_buf *cst_errjmp;
# define cst_error() (cst_errjmp ? longjmp(*cst_errjmp,1) : exit(-1))
#endif
/* WinCE sometimes doesn't have stdio, so this is a wrapper for
fprintf(stderr, ...) */
int cst_errmsg(const char *fmt, ...);
#define cst_dbgmsg cst_errmsg
/* Need macros to help set catches */
#endif

102
include/cst_features.h Normal file
View File

@ -0,0 +1,102 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* feature-values lists */
/* */
/*************************************************************************/
#ifndef _CST_FEATURES_H__
#define _CST_FEATURES_H__
#include "cst_alloc.h"
#include "cst_val.h"
#include "cst_string.h"
typedef struct cst_featvalpair_struct {
const char *name;
cst_val *val;
struct cst_featvalpair_struct *next;
} cst_featvalpair;
typedef struct cst_features_struct {
struct cst_featvalpair_struct *head;
cst_alloc_context ctx;
cst_val *owned_strings; /* fnames that are owned by this struct */
/* Link to other cst_features that we search too */
const struct cst_features_struct *linked;
} cst_features;
/* Constructor functions */
cst_features *new_features(void);
cst_features *new_features_local(cst_alloc_context ctx);
void delete_features(cst_features *f);
/* Accessor functions */
int feat_int(const cst_features *f, const char *name);
float feat_float(const cst_features *f, const char *name);
const char *feat_string(const cst_features *f, const char *name);
const cst_val *feat_val(const cst_features *f, const char *name);
int get_param_int(const cst_features *f, const char *name,int def);
float get_param_float(const cst_features *f, const char *name, float def);
const char *get_param_string(const cst_features *f, const char *name, const char *def);
const cst_val *get_param_val(const cst_features *f, const char *name, cst_val *def);
/* Setting functions */
void feat_set_int(cst_features *f, const char *name, int v);
void feat_set_float(cst_features *f, const char *name, float v);
void feat_set_string(cst_features *f, const char *name, const char *v);
void feat_set(cst_features *f, const char *name,const cst_val *v);
int feat_remove(cst_features *f,const char *name);
int feat_present(const cst_features *f,const char *name);
int feat_length(const cst_features *f);
/* Feature names are expected to be literals -- its *much* faster to do */
/* look ups and less alloc/frees are necesssary. Almosts always this is */
/* fine, but when you are making up new fnames, you can get a copy of the */
/* string that will be deleted when the cst_features is deleted */
const char *feat_own_string(cst_features *f,const char *name);
CST_VAL_USER_TYPE_DCLS(features,cst_features)
int feat_copy_into(const cst_features *from,cst_features *to);
/* Link FROM into TO so FROM's features will be searched after TO's features */
int feat_link_into(const cst_features *from,cst_features *to);
/* For debugging */
int cst_feat_print(cst_file fd,const cst_features *f);
#endif

65
include/cst_ffeatures.h Normal file
View File

@ -0,0 +1,65 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2007 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: November 2007 */
/*************************************************************************/
/* Language independant feature functions */
/*************************************************************************/
#ifndef _CST_FFEATURES_H
#define _CST_FFEATURES_H
#include "cst_val.h"
#include "cst_item.h"
const cst_val *ph_vc(const cst_item *p);
const cst_val *ph_vlng(const cst_item *p);
const cst_val *ph_vheight(const cst_item *p);
const cst_val *ph_vrnd(const cst_item *p);
const cst_val *ph_vfront(const cst_item *p);
const cst_val *ph_ctype(const cst_item *p);
const cst_val *ph_cplace(const cst_item *p);
const cst_val *ph_cvox(const cst_item *p);
const cst_val *cg_duration(const cst_item *p);
const cst_val *cg_state_pos(const cst_item *p);
const cst_val *cg_state_place(const cst_item *p);
const cst_val *cg_state_index(const cst_item *p);
const cst_val *cg_state_rindex(const cst_item *p);
const cst_val *cg_phone_place(const cst_item *p);
const cst_val *cg_phone_index(const cst_item *p);
const cst_val *cg_phone_rindex(const cst_item *p);
void basic_ff_register(cst_features *ffunctions);
#endif /* _CST_FFEATURES_H */

150
include/cst_file.h Normal file
View File

@ -0,0 +1,150 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: August 2000 */
/*************************************************************************/
/* */
/* Some File stuff */
/* */
/*************************************************************************/
#ifndef _CST_FILE_H__
#define _CST_FILE_H__
#define CST_WRONG_FORMAT -2
#define CST_ERROR_FORMAT -1
#define CST_OK_FORMAT 0
#ifdef UNDER_CE
/* File access stuff (WinCE 2.11 is really damaged) */
#include <windows.h>
#include <winbase.h>
typedef HANDLE cst_file;
#elif __palmos__
#include <PalmOS.h>
#include <System/StdIOPalm.h>
typedef FILE * cst_file;
#else
#include <stdio.h>
typedef FILE * cst_file;
#endif
/* File mapping stuff */
#ifdef _WIN32
#include <windows.h>
typedef struct cst_filemap_struct {
void *mem;
cst_file fh;
size_t mapsize;
HANDLE h;
} cst_filemap;
#elif __palmos__
typedef struct cst_filemap_struct {
void *mem;
cst_file fh;
unsigned int mapsize;
int fd;
} cst_filemap;
#else
typedef struct cst_filemap_struct {
void *mem;
cst_file fh;
size_t mapsize;
int fd;
} cst_filemap;
#endif
#define CST_OPEN_WRITE (1<<0)
#define CST_OPEN_READ (1<<1)
#define CST_OPEN_APPEND (1<<2)
/* We actually ignore this -- files are always opened in in binary mode */
#define CST_OPEN_BINARY (1<<3)
#define CST_SEEK_ABSOLUTE 0
#define CST_SEEK_RELATIVE 1
#define CST_SEEK_ENDREL 2
cst_file cst_fopen(const char *path, int mode);
long cst_fwrite(cst_file fh, const void *buf, long size, long count);
long cst_fread(cst_file fh, void *buf, long size, long count);
int cst_fprintf(cst_file fh, const char *fmt, ...);
int cst_sprintf(char *s, const char *fmt, ...);
#ifdef _WIN32
#define snprintf c99_snprintf
__inline int c99_vsnprintf(char* str, size_t size, const char* format,
va_list ap) {
int count = -1;
if (size != 0)
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
if (count == -1)
count = _vscprintf(format, ap);
return count;
}
__inline int c99_snprintf(char* str, size_t size, const char* format, ...)
{
int count;
va_list ap;
va_start(ap, format);
count = c99_vsnprintf(str, size, format, ap);
va_end(ap);
return count;
}
#endif
#define cst_snprintf snprintf
#if defined(__palmos__)
#include <stdarg.h>
int cst_vsprintf(char *s, const char *fmt, va_list args);
#endif
int cst_fclose(cst_file fh);
int cst_fgetc(cst_file fh);
/* These aren't LFS-compliant. I don't think we'll need >2G files. */
long cst_ftell(cst_file fh);
long cst_fseek(cst_file fh, long pos, int whence);
long cst_filesize(cst_file fh);
cst_filemap *cst_mmap_file(const char *path);
int cst_munmap_file(cst_filemap *map);
cst_filemap *cst_read_whole_file(const char *path);
int cst_free_whole_file(cst_filemap *map);
cst_filemap *cst_read_part_file(const char *path);
int cst_free_part_file(cst_filemap *map);
int cst_urlp(const char *url);
cst_file cst_url_open(const char *url);
#endif

50
include/cst_hrg.h Normal file
View File

@ -0,0 +1,50 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Heterogeneous Relation Graphs */
/* */
/*************************************************************************/
#ifndef _CST_HRG_H__
#define _CST_HRG_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_item.h"
#include "cst_relation.h"
#include "cst_utterance.h"
#endif

137
include/cst_item.h Normal file
View File

@ -0,0 +1,137 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Item */
/* */
/*************************************************************************/
#ifndef _CST_ITEM_H__
#define _CST_ITEM_H__
#include "cst_file.h"
#include "cst_features.h"
/* Everyone needs these so forward define these */
typedef struct cst_relation_struct cst_relation;
typedef struct cst_utterance_struct cst_utterance;
typedef struct cst_item_struct cst_item;
/* So items, relations and utterances can be used as vals */
CST_VAL_USER_TYPE_DCLS(relation,cst_relation)
CST_VAL_USER_TYPE_DCLS(item,cst_item)
CST_VAL_USER_TYPE_DCLS(utterance,cst_utterance)
typedef struct cst_item_contents_struct {
cst_features *features;
cst_features *relations;
} cst_item_contents;
struct cst_item_struct {
cst_item_contents *contents; /* the shared part of an item */
cst_relation *relation;
cst_item *n;
cst_item *p;
cst_item *u;
cst_item *d;
};
/* Constructor functions */
cst_item *new_item_relation(cst_relation *r,cst_item *i);
cst_item_contents *new_item_contents(cst_item *i);
/* Remove this item from this references */
void delete_item(cst_item *item);
void item_contents_set(cst_item *current, cst_item *i);
void item_unref_contents(cst_item *i);
cst_item *item_as(const cst_item *i,const char *rname);
cst_utterance *item_utt(const cst_item *i);
/* List accessor/manipulator function */
cst_item *item_next(const cst_item *i);
cst_item *item_prev(const cst_item *i);
cst_item *item_append(cst_item *i,cst_item *new_item);
cst_item *item_prepend(cst_item *i,cst_item *new_item);
/* Tree accessor/manipulator function */
cst_item *item_parent(const cst_item *i);
cst_item *item_nth_daughter(const cst_item *i,int n);
cst_item *item_daughter(const cst_item *i);
cst_item *item_last_daughter(const cst_item *i);
cst_item *item_first(const cst_item *i);
cst_item *item_last(const cst_item *i);
cst_item *item_add_daughter(cst_item *i,cst_item *new_item);
cst_item *item_append_sibling(cst_item *i,cst_item *new_item);
cst_item *item_prepend_sibling(cst_item *i,cst_item *new_item);
/* Feature accessor/manipulator functions */
int item_feat_present(const cst_item *i,const char *name);
int item_feat_remove(const cst_item *i,const char *name);
cst_features *item_feats(const cst_item *i);
const cst_val *item_feat(const cst_item *i,const char *name);
int item_feat_int(const cst_item *i,const char *name);
float item_feat_float(const cst_item *i,const char *name);
const char *item_feat_string(const cst_item *i,const char *name);
void item_set(const cst_item *i,const char *name,const cst_val *val);
void item_set_int(const cst_item *i,const char *name,int val);
void item_set_float(const cst_item *i,const char *name,float val);
void item_set_string(const cst_item *i,const char *name,const char *val);
#define item_name(I) item_feat_string(I,"name")
int item_equal(const cst_item *a, const cst_item *b);
const char *ffeature_string(const cst_item *item,const char *featpath);
int ffeature_int(const cst_item *item,const char *featpath);
float ffeature_float(const cst_item *item,const char *featpath);
const cst_val *ffeature(const cst_item *item,const char *featpath);
cst_item* path_to_item(const cst_item *item,const char *featpath);
/* Feature function, for features that are derived algorithmically from others. */
typedef const cst_val *(*cst_ffunction)(const cst_item *i);
CST_VAL_USER_FUNCPTR_DCLS(ffunc,cst_ffunction)
void ff_register(cst_features *ffeatures, const char *name,
cst_ffunction f);
void ff_unregister(cst_features *ffeatures, const char *name);
/* Generalized item hook function, like cst_uttfunc. */
typedef cst_val *(*cst_itemfunc)(cst_item *i);
CST_VAL_USER_FUNCPTR_DCLS(itemfunc,cst_itemfunc)
#endif

89
include/cst_lexicon.h Normal file
View File

@ -0,0 +1,89 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Lexicon related functions */
/* */
/*************************************************************************/
#ifndef _CST_LEXICON_H__
#define _CST_LEXICON_H__
#include "cst_item.h"
#include "cst_lts.h"
typedef struct lexicon_struct {
const char *name;
int num_entries;
/* Entries are centered around bytes with value 255 */
/* entries and forward (compressed) pronunciations and backwards */
/* each are terminated (preceeded in pron case) by 0 */
/* This saves 4 bytes per entry for an index */
unsigned char *data; /* the entries and phone strings */
int num_bytes; /* the number of bytes in the data */
char **phone_table;
cst_lts_rules *lts_rule_set;
int (*syl_boundary)(const cst_item *i,const cst_val *p);
cst_val *(*lts_function)(const struct lexicon_struct *l, const char *word, const char *pos, const cst_features *feats);
char ***addenda;
/* ngram frequency table used for packed entries */
const char * const *phone_hufftable;
const char * const *entry_hufftable;
cst_utterance *(*postlex)(cst_utterance *u);
cst_val *lex_addenda; /* For pronunciations added at run time */
} cst_lexicon;
cst_lexicon *new_lexicon();
void delete_lexicon(cst_lexicon *lex);
cst_val *cst_lex_make_entry(const cst_lexicon *lex,
const cst_string *entry);
cst_val *cst_lex_load_addenda(const cst_lexicon *lex,
const char *lexfile);
cst_val *lex_lookup(const cst_lexicon *l, const char *word, const char *pos,
const cst_features *feats);
int in_lex(const cst_lexicon *l, const char *word, const char *pos,
const cst_features *feats);
CST_VAL_USER_TYPE_DCLS(lexicon,cst_lexicon)
#endif

78
include/cst_lts.h Normal file
View File

@ -0,0 +1,78 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Letter to sound rules */
/* */
/*************************************************************************/
#ifndef _CST_LTS_H__
#define _CST_LTS_H__
#include "cst_val.h"
typedef unsigned short cst_lts_addr;
typedef int cst_lts_phone;
typedef unsigned char cst_lts_feat;
typedef unsigned char cst_lts_letter;
typedef unsigned char cst_lts_model;
/* end of rule value */
#define CST_LTS_EOR 255
typedef struct cst_lts_rules_struct {
char *name;
const cst_lts_addr *letter_index; /* index into model first state */
const cst_lts_model *models;
const char * const * phone_table;
int context_window_size;
int context_extra_feats;
const char * const * letter_table;
} cst_lts_rules;
/* Note this is designed to be 6 bytes */
typedef struct cst_lts_rule_struct {
cst_lts_feat feat;
cst_lts_letter val;
cst_lts_addr qtrue;
cst_lts_addr qfalse;
} cst_lts_rule;
cst_lts_rules *new_lts_rules();
cst_val *lts_apply(const char *word,const char *feats,const cst_lts_rules *r);
cst_val *lts_apply_val(const cst_val *wlist,const char *feats,const cst_lts_rules *r);
#endif

View File

@ -0,0 +1,55 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2002 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: August 2002 */
/*************************************************************************/
/* */
/* Letter to sound rewrite rules */
/* */
/*************************************************************************/
#ifndef _CST_LTS_REWRITES_H__
#define _CST_LTS_REWRITES_H__
#include "cst_val.h"
typedef struct cst_lts_rewrites_struct {
char *name;
const cst_val *sets;
const cst_val *rules;
} cst_lts_rewrites;
cst_val *lts_rewrites(const cst_val *itape, const cst_lts_rewrites *r);
cst_val *lts_rewrites_word(const char *word, const cst_lts_rewrites *r);
#endif

51
include/cst_math.h Normal file
View File

@ -0,0 +1,51 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2004 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: July 2004 */
/*************************************************************************/
/* */
/* Math wrapper */
/* */
/*************************************************************************/
#ifndef _CST_MATH_H__
#define _CST_MATH_H__
#if __palmos__
/* Sun Microsystem's Free fdlibm */
/* We actually don't use it but it allows the system to compile */
/* #include <fdlibm.h> */
#else
#include <math.h>
#endif
#endif

77
include/cst_phoneset.h Normal file
View File

@ -0,0 +1,77 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 2000 */
/*************************************************************************/
/* */
/* Phoneset functions */
/* */
/*************************************************************************/
#ifndef _CST_PHONESET_H__
#define _CST_PHONESET_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_item.h"
struct cst_phoneset_struct {
const char *name;
const char * const * featnames;
const cst_val * const *featvals;
const char * const * phonenames;
const char *silence;
const int num_phones;
const int * const * fvtable;
int freeable; /* 0 if const in memory, 1 if we alloc'd it */
};
typedef struct cst_phoneset_struct cst_phoneset;
/* Constructor functions */
cst_phoneset *new_phoneset();
void delete_phoneset(const cst_phoneset *u);
const cst_val *phone_feature(const cst_phoneset *ps,
const char* phonename,
const char *featname);
const char *phone_feature_string(const cst_phoneset *ps,
const char* phonename,
const char *featname);
int phone_id(const cst_phoneset *ps,const char* phonename);
int phone_feat_id(const cst_phoneset *ps,const char* featname);
const cst_phoneset *item_phoneset(const cst_item *i);
CST_VAL_USER_TYPE_DCLS(phoneset,cst_phoneset)
#endif

160
include/cst_regex.h Normal file
View File

@ -0,0 +1,160 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: January 2000 */
/*************************************************************************/
/* */
/* cst front-end to Henry Spencer's regex code */
/* */
/*************************************************************************/
/* Includes portions or regexp.h, copyright follows: */
/*
* Copyright (c) 1986 by University of Toronto.
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley
* by Henry Spencer.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)regexp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _CST_REGEX_H__
#define _CST_REGEX_H__
#include "cst_file.h"
#include "cst_string.h"
/*
* The first byte of the regexp internal "program" is actually this magic
* number; the start node begins in the second byte.
*/
#define CST_REGMAGIC 0234
typedef struct cst_regex_struct {
char regstart; /* Internal use only. */
char reganch; /* Internal use only. */
char *regmust; /* Internal use only. */
int regmlen; /* Internal use only. */
int regsize;
char *program;
} cst_regex;
#define CST_NSUBEXP 10
typedef struct cst_regstate_struct {
const char *startp[CST_NSUBEXP];
const char *endp[CST_NSUBEXP];
const char *input;
const char *bol;
} cst_regstate;
cst_regex *new_cst_regex(const char *str);
void delete_cst_regex(cst_regex *r);
int cst_regex_match(const cst_regex *r, const char *str);
cst_regstate *cst_regex_match_return(const cst_regex *r, const char *str);
/* Internal functions from original HS code */
cst_regex *hs_regcomp(const char *);
cst_regstate *hs_regexec(const cst_regex *, const char *);
void hs_regdelete(cst_regex *);
/* Works similarly to snprintf(3), in that at most max characters are
written to out, including the trailing NUL, and the return value is
the number of characters written, *excluding* the trailing NUL.
Also works similarly to wcstombs(3) in that passing NULL as out
will count the number of characters that would be written without
doing any actual conversion, and ignoring max. So, you could use
it like this:
rx = new_cst_regex("\\(.*\\)_\\(.*\\)");
if ((rs = cst_regex_match_return(rx, "foo_bar")) != NULL) {
size_t n;
n = cst_regsub(rs, "\\1_\\2_quux", NULL, 0) + 1;
out = cst_alloc(char, n);
cst_regsub(rs, "\\1_\\2_quux", out, n);
} */
size_t cst_regsub(const cst_regstate *r, const char *in, char *out, size_t max);
/* Initialize the regex engine and global regex constants */
void cst_regex_init();
/* Regexps used in text processing (these are latin-alphabet specific
and to some extent US English-specific) */
extern const cst_regex * const cst_rx_white;
extern const cst_regex * const cst_rx_alpha;
extern const cst_regex * const cst_rx_uppercase;
extern const cst_regex * const cst_rx_lowercase;
extern const cst_regex * const cst_rx_alphanum;
extern const cst_regex * const cst_rx_identifier;
extern const cst_regex * const cst_rx_int;
extern const cst_regex * const cst_rx_double;
extern const cst_regex * const cst_rx_commaint;
extern const cst_regex * const cst_rx_digits;
extern const cst_regex * const cst_rx_dotted_abbrev;
/* Table of regexps used in CART trees (only one so far) */
extern const cst_regex * const cst_regex_table[];
#define CST_RX_dotted_abbrev_NUM 0
#endif

72
include/cst_relation.h Normal file
View File

@ -0,0 +1,72 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Relation */
/* */
/*************************************************************************/
#ifndef _CST_RELATION_H__
#define _CST_RELATION_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_item.h"
#include "cst_utterance.h"
struct cst_relation_struct {
char *name;
cst_features *features;
cst_utterance *utterance;
cst_item *head;
cst_item *tail;
};
/* Constructor functions */
cst_relation *new_relation(const char *name, cst_utterance *u);
void delete_relation(cst_relation *r);
cst_item *relation_head(cst_relation *r);
cst_item *relation_tail(cst_relation *r);
const char *relation_name(cst_relation *r);
cst_item *relation_append(cst_relation *r,cst_item *i);
cst_item *relation_prepend(cst_relation *r,cst_item *i);
int relation_load(cst_relation *r, const char *filename);
int relation_save(cst_relation *r, const char *filename);
#endif

63
include/cst_sigpr.h Normal file
View File

@ -0,0 +1,63 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2001 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: January 2001 */
/*************************************************************************/
/* */
/* Signal processing */
/* */
/*************************************************************************/
#ifndef _CST_SIGPR_H__
#define _CST_SIGPR_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_sts.h"
cst_wave *lpc_resynth(cst_lpcres *lpcres);
cst_wave *lpc_resynth_fixedpoint(cst_lpcres *lpcres);
cst_wave *lpc_resynth_spike(cst_lpcres *lpcres);
void add_residual_windowed(int targ_size,
unsigned char *targ_residual,
int unit_size,
const unsigned char *unit_residual);
void add_residual_g721(int targ_size, unsigned char *targ_residual,
int packed_unit_size, const unsigned char *unit_residual);
void add_residual_g721vuv(int targ_size, unsigned char *targ_residual,
int uunit_size, const unsigned char *unit_residual);
void add_residual_vuv(int targ_size, unsigned char *targ_residual,
int packed_unit_size, const unsigned char *unit_residual);
#endif

49
include/cst_socket.h Normal file
View File

@ -0,0 +1,49 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2000 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: October 2000 */
/*************************************************************************/
/* */
/* General Socket code */
/* */
/*************************************************************************/
#ifndef _CST_SOCKET_H__
#define _CST_SOCKET_H__
int cst_socket_open(const char *host, int port);
int cst_socket_close(int socket);
int cst_socket_server(const char *name, int port,
int (process_client)(int name, int fd));
#endif

58
include/cst_ss.h Normal file
View File

@ -0,0 +1,58 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2001 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: November 2001 */
/*************************************************************************/
/* */
/* sufficient statitsics */
/* */
/*************************************************************************/
#ifndef _CST_SS_H__
#define _CST_SS_H__
typedef struct cst_ss_struct {
double num_samples;
double sum;
double sumx;
} cst_ss;
cst_ss *new_ss();
void delete_ss(cst_ss *ss);
void ss_reset(cst_ss *ss);
double ss_mean(cst_ss *ss);
double ss_variance(cst_ss *ss);
double ss_stddev(cst_ss *ss);
void ss_cummulate(cst_ss *ss,double a);
void ss_cummulate_n(cst_ss *ss,double a, double count);
#endif

74
include/cst_string.h Normal file
View File

@ -0,0 +1,74 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* String manipulation functions */
/* */
/*************************************************************************/
#ifndef __CST_STRING_H__
#define __CST_STRING_H__
#include <string.h>
#if defined(UNDER_CE) && (UNDER_CE < 300)
#define isalnum(a) iswalnum((wint_t)(a))
#define isupper(a) iswupper((wint_t)(a))
#define islower(a) iswlower((wint_t)(a))
#endif
/* typedef unsigned char cst_string; */
typedef char cst_string;
double cst_atof(const char *str);
cst_string *cst_strdup(const cst_string *s);
cst_string *cst_strchr(const cst_string *s, int c);
cst_string *cst_strrchr(const cst_string *str, int c);
#define cst_strstr(h,n) \
((cst_string *)strstr((const char *)h,(const char *)n))
#define cst_strlen(s) (strlen((const char *)s))
#define cst_streq(A,B) (strcmp(A,B) == 0)
#define cst_streqn(A,B,N) (strncmp(A,B,N) == 0)
int cst_member_string(const char *str, const char * const *slist);
char *cst_substr(const char *str,int start, int length);
char *cst_string_before(const char *s,const char *c);
char *cst_strcat(const char *a,const char *b);
char *cst_strcat3(const char *a, const char *b, const char *c);
cst_string *cst_downcase(const cst_string *str);
cst_string *cst_upcase(const cst_string *str);
#endif

137
include/cst_sts.h Normal file
View File

@ -0,0 +1,137 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2001 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: January 2001 */
/*************************************************************************/
/* */
/* Short term signals */
/* */
/*************************************************************************/
#ifndef _CST_STS_H__
#define _CST_STS_H__
/* Need some lower level functions in case we are doing streaming */
#include "cst_wave.h"
#include "cst_audio.h"
/* The short term signal (sts) structure is the basic unit data info */
/* it may be diphones or general units. Indexes and names are held */
/* else where, this information plus the indexes in the Unit relation */
/* allow reconstruction of the signal itself */
struct cst_sts_struct {
const unsigned short *frame;
const int size; /* in samples */
const unsigned char *residual;
};
typedef struct cst_sts_struct cst_sts;
/* Because many C compilers can't compile when there are 100Ks of symbols */
/* We store the sts in pages. Each page of stss gets compiled into an */
/* array in separate files thus reducing the number of symbols -- but */
/* introducing an extra dereference */
struct cst_sts_paged_struct {
/* const unsigned short frame_offset; */
const unsigned int frame_offset;
const unsigned short res_size;
const unsigned int res_offset;
const unsigned short *frame_page;
const unsigned char *res_page;
};
typedef struct cst_sts_paged_struct cst_sts_paged;
/* This represents a database of short-term signals. */
struct cst_sts_list_struct {
/* If the sts are compiled in, this will point to them. */
const cst_sts *sts;
/* Or if the data is paged in different structures */
const cst_sts_paged *sts_paged;
/* Or we could have these set (or set later) */
const unsigned short *frames;
const unsigned char *residuals;
const unsigned int *resoffs;
const unsigned char *ressizes;
int num_sts; /* But I don't think you need that number */
int num_channels; /* typically lpc order */
int sample_rate;
float coeff_min; /* used for decoding the short representation */
float coeff_range; /* for coefficients */
const char *codec; /* encoding type for residual */
};
typedef struct cst_sts_list_struct cst_sts_list;
/* This is used to represent a newly constructed waveform to be synthed */
struct cst_lpcres_struct {
const unsigned short **frames;
int *times;
int num_frames;
int num_channels;
float lpc_min;
float lpc_range;
int num_samples;
int sample_rate;
int *sizes;
unsigned char *residual;
/* Optional call back function */
cst_audio_streaming_info *asi;
/* Expensive decoding can be delayed until resynthesis, hence */
/* streaming will be more useful as the decoding will happen */
/* during playback time */
const unsigned char **packed_residuals;
int delayed_decoding; /* 1 if decoding happens at streaming time */
};
typedef struct cst_lpcres_struct cst_lpcres;
cst_lpcres *new_lpcres();
void delete_lpcres(cst_lpcres *l);
float lpcres_frame_shift(cst_lpcres *t, int frame);
void lpcres_resize_frames(cst_lpcres *l,int num_frames);
void lpcres_resize_samples(cst_lpcres *l,int num_samples);
cst_sts_list *new_sts_list();
void delete_sts_list(cst_sts_list *l);
const unsigned short * get_sts_frame(const cst_sts_list *sts_list, int frame);
const unsigned char * get_sts_residual(const cst_sts_list *sts_list, int frame);
const unsigned char * get_sts_residual_fixed(const cst_sts_list *sts_list, int frame);
int get_frame_size(const cst_sts_list *sts_list, int frame);
int get_unit_size(const cst_sts_list *s,int start, int end);
CST_VAL_USER_TYPE_DCLS(lpcres,cst_lpcres)
CST_VAL_USER_TYPE_DCLS(sts_list,cst_sts_list)
#endif

95
include/cst_synth.h Normal file
View File

@ -0,0 +1,95 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2000 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: September 2000 */
/*************************************************************************/
/* */
/* General synth functions */
/* */
/*************************************************************************/
#ifndef _SYNTH_H__
#define _SYNTH_H__
#include "cst_hrg.h"
#include "cst_tokenstream.h"
#include "cst_voice.h"
#include "cst_wave.h"
typedef int (*cst_breakfunc)(cst_tokenstream *ts,
const char *token,
cst_relation *tokens);
CST_VAL_USER_FUNCPTR_DCLS(breakfunc,cst_breakfunc)
int default_utt_break(cst_tokenstream *ts,
const char *token, cst_relation *tokens);
/* You must call utt_init before any of the others. */
cst_utterance *utt_init(cst_utterance *u, cst_voice *vox);
cst_utterance *utt_synth(cst_utterance *u);
cst_utterance *utt_synth_phones(cst_utterance *u);
cst_utterance *utt_synth_tokens(cst_utterance *u);
cst_utterance *utt_synth_wave(cst_wave *w,cst_voice *v);
typedef struct cst_dur_stats_struct {
const char *phone;
float mean;
float stddev;
} dur_stat;
typedef dur_stat *dur_stats; /* only one star, due to funky cst_val magic */
CST_VAL_USER_TYPE_DCLS(dur_stats,dur_stats)
cst_utterance *default_segmentanalysis(cst_utterance *u);
cst_utterance *default_tokenization(cst_utterance *u);
cst_utterance *default_textanalysis(cst_utterance *u);
cst_val *default_tokentowords(cst_item *i);
cst_utterance *default_phrasing(cst_utterance *u);
cst_utterance *default_pos_tagger(cst_utterance *u);
cst_utterance *default_lexical_insertion(cst_utterance *u);
cst_utterance *default_pause_insertion(cst_utterance *u);
cst_utterance *cart_intonation(cst_utterance *u);
cst_utterance *cart_duration(cst_utterance *u);
cst_utterance *flat_prosody(cst_utterance *u);
typedef struct cst_synth_module_struct {
const char *hookname;
cst_uttfunc defhook;
} cst_synth_module;
cst_utterance *apply_synth_module(cst_utterance *u,
const cst_synth_module *mod);
cst_utterance *apply_synth_method(cst_utterance *u,
const cst_synth_module meth[]);
#endif

166
include/cst_tokenstream.h Normal file
View File

@ -0,0 +1,166 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: July 1999 */
/*************************************************************************/
/* */
/* Tokenizer for strings and files */
/* */
/*************************************************************************/
#ifndef _CST_TOKENSTREAM_H__
#define _CST_TOKENSTREAM_H__
#include "cst_alloc.h"
#include "cst_string.h"
#include "cst_file.h"
#include "cst_features.h"
typedef struct cst_tokenstream_struct {
cst_file fd;
int file_pos;
int line_number;
int eof_flag;
cst_string *string_buffer;
int current_char;
int token_pos;
int ws_max;
cst_string *whitespace;
int prep_max;
cst_string *prepunctuation;
int token_max;
cst_string *token;
int postp_max;
cst_string *postpunctuation;
cst_features *tags; /* e.g xml tags */
/* if set will find token boundaries at every utf8 character */
int utf8_explode_mode;
void *streamtype_data;
/* Should only be set through set_charclasses as charclass table needs */
/* to be updated when you reset these */
const cst_string *p_whitespacesymbols;
const cst_string *p_singlecharsymbols;
const cst_string *p_prepunctuationsymbols;
const cst_string *p_postpunctuationsymbols;
cst_string charclass[256];
/* To allow externally specified reading functions e.g. epub/xml */
int (*open)(struct cst_tokenstream_struct *ts, const char *filename);
void (*close)(struct cst_tokenstream_struct *ts);
int (*eof)(struct cst_tokenstream_struct *ts);
int (*seek)(struct cst_tokenstream_struct *ts, int pos);
int (*tell)(struct cst_tokenstream_struct *ts);
int (*size)(struct cst_tokenstream_struct *ts);
int (*getc)(struct cst_tokenstream_struct *ts);
} cst_tokenstream;
#define TS_CHARCLASS_NONE 0
#define TS_CHARCLASS_WHITESPACE 2
#define TS_CHARCLASS_SINGLECHAR 4
#define TS_CHARCLASS_PREPUNCT 8
#define TS_CHARCLASS_POSTPUNCT 16
#define TS_CHARCLASS_QUOTE 32
#define ts_charclass(C,CLASS,TS) ((TS)->charclass[(unsigned char)C] & CLASS)
extern const cst_string * const cst_ts_default_whitespacesymbols;
extern const cst_string * const cst_ts_default_prepunctuationsymbols;
extern const cst_string * const cst_ts_default_postpunctuationsymbols;
extern const cst_string * const cst_ts_default_singlecharsymbols;
/* Public functions for tokenstream manipulation */
cst_tokenstream *ts_open(const char *filename,
const cst_string *whitespacesymbols,
const cst_string *singlecharsymbols,
const cst_string *prepunctsymbols,
const cst_string *postpunctsymbols);
cst_tokenstream *ts_open_string(const cst_string *string,
const cst_string *whitespacesymbols,
const cst_string *singlecharsymbols,
const cst_string *prepunctsymbols,
const cst_string *postpunctsymbols);
cst_tokenstream *ts_open_generic(const char *filename,
const cst_string *whitespacesymbols,
const cst_string *singlecharsymbols,
const cst_string *prepunctsymbols,
const cst_string *postpunctsymbols,
void *streamtype_data,
int (*open)(cst_tokenstream *ts,
const char *filename),
void (*close)(cst_tokenstream *ts),
int (*eof)(cst_tokenstream *ts),
int (*seek)(cst_tokenstream *ts, int pos),
int (*tell)(cst_tokenstream *ts),
int (*size)(cst_tokenstream *ts),
int (*getc)(cst_tokenstream *ts));
void ts_close(cst_tokenstream *ts);
#ifdef _WIN32
__inline int ts_utf8_sequence_length(char c0);
#else
int ts_utf8_sequence_length(char c0);
#endif
// {
// /* Get the expected length of UTF8 sequence given its most */
// /* significant byte */
// return (( 0xE5000000 >> (( c0 >> 3 ) & 0x1E )) & 3 ) + 1;
// }
int ts_eof(cst_tokenstream *ts);
const cst_string *ts_get(cst_tokenstream *ts);
const cst_string *ts_get_quoted_token(cst_tokenstream *ts,
char quote,
char escape);
/* Externally specified ts interfaces may need this */
cst_string private_ts_getc(cst_tokenstream *ts);
void set_charclasses(cst_tokenstream *ts,
const cst_string *whitespace,
const cst_string *singlecharsymbols,
const cst_string *prepunctuation,
const cst_string *postpunctuation);
int ts_read(void *buff, int size, int num, cst_tokenstream *ts);
int ts_set_stream_pos(cst_tokenstream *ts,int pos);
int ts_get_stream_pos(cst_tokenstream *ts);
int ts_get_stream_size(cst_tokenstream *ts);
#endif

71
include/cst_track.h Normal file
View File

@ -0,0 +1,71 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: August 2000 */
/*************************************************************************/
/* */
/* Waveforms */
/* */
/*************************************************************************/
#ifndef _CST_TRACK_H__
#define _CST_TRACK_H__
#include "cst_file.h"
#include "cst_error.h"
#include "cst_alloc.h"
#include "cst_endian.h"
#include "cst_file.h"
#include "cst_val.h"
typedef struct cst_track_struct {
const char *type;
int num_frames;
int num_channels;
float *times;
float **frames;
} cst_track;
cst_track *new_track();
void delete_track(cst_track *val);
float track_frame_shift(cst_track *t, int frame);
void cst_track_resize(cst_track *t,int num_frames, int num_channels);
cst_track *cst_track_copy(const cst_track *t);
int cst_track_save_est(cst_track *t, const char *filename);
int cst_track_save_est_binary(cst_track *t, const char *filename);
int cst_track_load_est(cst_track *t, const char *filename);
CST_VAL_USER_TYPE_DCLS(track,cst_track)
#endif

62
include/cst_units.h Normal file
View File

@ -0,0 +1,62 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2001 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: January 2001 */
/*************************************************************************/
/* */
/* Unit databases */
/* */
/*************************************************************************/
#ifndef _CST_UNITS_H__
#define _CST_UNITS_H__
#include "cst_file.h"
#include "cst_hrg.h"
#include "cst_sts.h"
cst_utterance *join_units(cst_utterance *utt);
cst_utterance *join_units_windowed(cst_utterance *utt);
cst_utterance *join_units_simple(cst_utterance *utt);
cst_utterance *join_units_modified_lpc(cst_utterance *utt);
cst_utterance *asis_to_pm(cst_utterance *utt);
cst_utterance *f0_targets_to_pm(cst_utterance *utt);
cst_utterance *concat_units(cst_utterance *utt);
void add_residual(int targ_size, unsigned char *targ_residual,
int unit_size, const unsigned char *unit_residual);
void add_residual_pulse(int targ_size, unsigned char *targ_residual,
int unit_size, const unsigned char *unit_residual);
#endif

64
include/cst_utt_utils.h Normal file
View File

@ -0,0 +1,64 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: September 2000 */
/*************************************************************************/
/* */
/* Various utterance access/setting functions */
/* */
/*************************************************************************/
#ifndef _UTT_UTILS_H__
#define _UTT_UTILS_H__
#include "cst_hrg.h"
#include "cst_wave.h"
int utt_set_wave(cst_utterance *u, cst_wave *w);
cst_wave *utt_wave(cst_utterance *u);
const char *utt_input_text(cst_utterance *u);
int utt_set_input_text(cst_utterance *u,const char *text);
#define utt_feat_string(U,F) (feat_string((U)->features,F))
#define utt_feat_int(U,F) (feat_int((U)->features,F))
#define utt_feat_float(U,F) (feat_float((U)->features,F))
#define utt_feat_val(U,F) (feat_val((U)->features,F))
#define utt_set_feat_string(U,F,V) (feat_set_string((U)->features,F,V))
#define utt_set_feat_int(U,F,V) (feat_set_int((U)->features,F,V))
#define utt_set_feat_float(U,F,V) (feat_set_float((U)->features,F,V))
#define utt_set_feat(U,F,V) (feat_set((U)->features,F,V))
#define utt_rel_head(U,R) (relation_head(utt_relation((U),R)))
#endif

74
include/cst_utterance.h Normal file
View File

@ -0,0 +1,74 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Utterances */
/* */
/*************************************************************************/
#ifndef _CST_UTTERANCE_H__
#define _CST_UTTERANCE_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_item.h"
#include "cst_relation.h"
#include "cst_alloc.h"
struct cst_utterance_struct {
cst_features *features;
cst_features *ffunctions;
cst_features *relations;
cst_alloc_context ctx;
};
/* Constructor functions */
cst_utterance *new_utterance();
void delete_utterance(cst_utterance *u);
cst_relation *utt_relation(const cst_utterance *u,const char *name);
cst_relation *utt_relation_create(cst_utterance *u,const char *name);
int utt_relation_delete(cst_utterance *u,const char *name);
int utt_relation_present(cst_utterance *u,const char *name);
typedef cst_utterance *(*cst_uttfunc)(cst_utterance *i);
CST_VAL_USER_FUNCPTR_DCLS(uttfunc,cst_uttfunc)
/* Allocate memory "locally" to an utterance, on platforms that
support/require this (currently only WinCE) */
#define cst_utt_alloc(UTT,TYPE,SIZE) ((TYPE *)cst_local_alloc((UTT)->ctx,sizeof(TYPE)*(SIZE)))
#define cst_utt_free(UTT,PTR) cst_local_free((UTT)->ctx,(PTR))
#endif

173
include/cst_val.h Normal file
View File

@ -0,0 +1,173 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Vals, typed objects */
/* */
/*************************************************************************/
#ifndef _CST_VAL_H__
#define _CST_VAL_H__
#include "cst_file.h"
#include "cst_string.h"
#include "cst_error.h"
#include "cst_alloc.h"
#include "cst_val_defs.h"
/* Only CONS can be an even number */
#define CST_VAL_TYPE_CONS 0
#define CST_VAL_TYPE_INT 1
#define CST_VAL_TYPE_FLOAT 3
#define CST_VAL_TYPE_STRING 5
#define CST_VAL_TYPE_FIRST_FREE 7
#define CST_VAL_TYPE_MAX 54
typedef struct cst_val_cons_struct {
struct cst_val_struct *car;
struct cst_val_struct *cdr;
} cst_val_cons;
typedef struct cst_val_atom_struct {
#ifdef WORDS_BIGENDIAN
short ref_count;
short type; /* order is here important */
#else
#if (defined(__x86_64__) || defined(_M_X64))
int type; /* order is here important */
int ref_count;
#else
short type; /* order is here important */
short ref_count;
#endif
#endif
union
{
#if (defined(__x86_64__) || defined(_M_X64))
double fval;
long long ival;
void *vval;
#else
float fval;
int ival;
void *vval;
#endif
} v;
} cst_val_atom;
typedef struct cst_val_struct {
union
{
cst_val_cons cc;
cst_val_atom a;
} c;
} cst_val;
typedef struct cst_val_def_struct {
const char *name;
void (*delete_function)(void *);
} cst_val_def;
/* Constructor functions */
cst_val *int_val(int i);
cst_val *float_val(float f);
cst_val *string_val(const char *s);
cst_val *val_new_typed(int type, void *vv);
cst_val *cons_val(const cst_val *a, const cst_val *b);
/* Derefence and delete val if no other references */
void delete_val(cst_val *val);
void delete_val_list(cst_val *val);
/* Accessor functions */
int val_int(const cst_val *v);
float val_float(const cst_val *v);
const char *val_string(const cst_val *v);
void *val_void(const cst_val *v);
void *val_generic(const cst_val *v, int type, const char *stype);
const cst_val *val_car(const cst_val *v);
const cst_val *val_cdr(const cst_val *v);
const cst_val *set_cdr(cst_val *v1, const cst_val *v2);
const cst_val *set_car(cst_val *v1, const cst_val *v2);
int cst_val_consp(const cst_val *v);
/* Unsafe accessor function -- for the brave and foolish */
#define CST_VAL_STRING_LVAL(X) ((X)->c.a.v.vval)
#define CST_VAL_TYPE(X) ((X)->c.a.type)
#define CST_VAL_INT(X) ((X)->c.a.v.ival)
#define CST_VAL_FLOAT(X) ((X)->c.a.v.fval)
#define CST_VAL_STRING(X) ((const char *)(CST_VAL_STRING_LVAL(X)))
#define CST_VAL_VOID(X) ((X)->c.a.v.vval)
#define CST_VAL_CAR(X) ((X)->c.cc.car)
#define CST_VAL_CDR(X) ((X)->c.cc.cdr)
#define CST_VAL_REFCOUNT(X) ((X)->c.a.ref_count)
/* Some standard function */
int val_equal(const cst_val *a, const cst_val *b);
int val_less(const cst_val *a, const cst_val *b);
int val_greater(const cst_val *a, const cst_val *b);
int val_member(const cst_val *a, const cst_val *b);
int val_member_string (const char *a, const cst_val *b);
int val_stringp(const cst_val *a);
const cst_val *val_assoc_string(const char *v1,const cst_val *al);
void val_print(cst_file fd,const cst_val *v);
cst_val *val_readlist_string(const char *str);
cst_val *val_reverse(cst_val *v);
cst_val *val_append(cst_val *a,cst_val *b); /* destructive */
int val_length(const cst_val *l);
cst_val *cst_utf8_explode(const cst_string *utf8string);
cst_string *cst_implode(const cst_val *string_list);
cst_val *cst_utf8_ord(const cst_val *utf8_char);
cst_val *cst_utf8_chr(const cst_val *ord);
int cst_utf8_ord_string(const char *utf8_char);
/* make sure you know what you are doing before you call these */
int val_dec_refcount(const cst_val *b);
cst_val *val_inc_refcount(const cst_val *b);
#include "cst_val_const.h"
extern const cst_val_def cst_val_defs[];
/* Generic pointer vals */
typedef void cst_userdata;
CST_VAL_USER_TYPE_DCLS(userdata,cst_userdata)
#endif

381
include/cst_val_const.h Normal file
View File

@ -0,0 +1,381 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2001 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: January 2001 */
/*************************************************************************/
/* */
/* Const Vals, and macros to define them */
/* */
/* Before you give up in disgust bear with me on this. Every single */
/* line in this file has been *very* carefully decided on after much */
/* thought, experimentation and reading more specs of the C language */
/* than most people even thought existed. However inspite of that, the */
/* result is still unsatisfying from an elegance point of view but the */
/* given all the constraints this is probably the best compromise. */
/* */
/* This file offers macros for defining const cst_vals. I know many */
/* are already laughing at me for wanting runtime types on objects and */
/* will use this code as exemplars of why this should be done in C++, I */
/* say good luck to them with their 4M footprint while I go for my */
/* 50K footprint. But I *will* do cst_vals in 8 bytes and I *will* */
/* have them defined const so they are in the text segment */
/* */
/* The problem here is that there is not yet a standard way to do */
/* initialization of unions. There is one in the C99 standard and GCC */
/* already supports it, but other compilers do not so I can't use that */
/* */
/* So I need a way to make an object that will have the right 8 bytes */
/* for ints, floats, strings and cons cells that will work on any C */
/* compiler and will be of type const cst_val. That unfortunately */
/* isn't trivial. */
/* */
/* For the time being ignoring byte order, and address size, which */
/* will be ignored in the particular discuss (though dealt with below) */
/* I'd like to do something like */
/* */
/* const cst_val fredi = { CST_VAL_TYPE_INT,-1, 42 }; */
/* const cst_val fredf = { CST_VAL_TYPE_FLOAT,-1, 4.2 }; */
/* const cst_val freds = { CST_VAL_TYPE_STRING,-1, "42" }; */
/* */
/* Even if you accept warnings this isn't going to work, if you add */
/* extra {} you can get rid of some warnings but the fval/ival/ *vval */
/* part isn't going to work, the compiler *may* try to take the value */
/* and assign it using the type of the first field defined in the */
/* union. This could be made to work for ints and void* as pointers */
/* can be used as ints (even of 64 bit architectures) but the float */
/* isn't going to work. Casting will cause the float to be changed to */
/* an int by CPP which isn't what you want, what you want is that the */
/* four byte region gets filled with the four bytes that represent the */
/* float itself. Now you could get the four byte represention of the */
/* float and pretend that is an int (0xbfff9a4 for 4.2 on intel), that */
/* would work but that doesn't seem satifying and I'd need to have a */
/* preprocessor that could convert that. You could make atoms always */
/* have a pointer to another piece of memory, but that would take up */
/* another 4 bytes not just for these constants but all other cst_vals */
/* create */
/* */
/* So you could do */
/* */
/* const cst_val_int fredi = { CST_VAL_TYPE_INT,-1, 42 }; */
/* const cst_val_float fredf = { CST_VAL_TYPE_FLOAT,-1, 4.2 }; */
/* const cst_val_string freds = { CST_VAL_TYPE_STRING,-1, "42" }; */
/* */
/* Though that's a slippery slope I don't want to have these explicit */
/* new types, the first short defines the type perfectly adequately */
/* and the whole point of runtime types is that there is one object */
/* type. */
/* */
/* Well just initialize them at runtime, but, that isn't thread safe, */
/* slows down startup, requires a instance implicitly in the code and */
/* on the heap. As these are const, they should go in ROM. */
/* */
/* At this moment, I think the second version is the least problematic */
/* though it makes defining val_consts more unpleasant than they should */
/* be and forces changes elsewhere in the code even when the compiler */
/* does support initialization of unions */
/* */
/* */
/*************************************************************************/
#ifndef _CST_VAL_CONSTS_H__
#define _CST_VAL_CONSTS_H__
#include "cst_val_defs.h"
/* There is built-in int to string conversions here for numbers */
/* up to 20, note if you make this bigger you have to hand change */
/* other things too */
#define CST_CONST_INT_MAX 19
#ifndef NO_UNION_INITIALIZATION
/* This is the simple way when initialization of unions is supported */
#define DEF_CONST_VAL_INT(N,V) const cst_val N = {{.a={.type=CST_VAL_TYPE_INT,.ref_count=-1,.v={.ival=V}}}}
#define DEF_CONST_VAL_STRING(N,S) const cst_val N = {{.a={.type=CST_VAL_TYPE_STRING,.ref_count=-1,.v={.vval= (void *)S}}}}
#define DEF_CONST_VAL_FLOAT(N,F) const cst_val N = {{.a={.type=CST_VAL_TYPE_FLOAT,.ref_count=-1,.v={.fval=F}}}}
#define DEF_CONST_VAL_CONS(N,A,D) const cst_val N = {{.cc={.car=(cst_val *)A,.cdr=(cst_val *)D }}}
extern const cst_val val_int_0;
extern const cst_val val_int_1;
extern const cst_val val_int_2;
extern const cst_val val_int_3;
extern const cst_val val_int_4;
extern const cst_val val_int_5;
extern const cst_val val_int_6;
extern const cst_val val_int_7;
extern const cst_val val_int_8;
extern const cst_val val_int_9;
extern const cst_val val_int_10;
extern const cst_val val_int_11;
extern const cst_val val_int_12;
extern const cst_val val_int_13;
extern const cst_val val_int_14;
extern const cst_val val_int_15;
extern const cst_val val_int_16;
extern const cst_val val_int_17;
extern const cst_val val_int_18;
extern const cst_val val_int_19;
extern const cst_val val_int_20;
extern const cst_val val_int_21;
extern const cst_val val_int_22;
extern const cst_val val_int_23;
extern const cst_val val_int_24;
extern const cst_val val_string_0;
extern const cst_val val_string_1;
extern const cst_val val_string_2;
extern const cst_val val_string_3;
extern const cst_val val_string_4;
extern const cst_val val_string_5;
extern const cst_val val_string_6;
extern const cst_val val_string_7;
extern const cst_val val_string_8;
extern const cst_val val_string_9;
extern const cst_val val_string_10;
extern const cst_val val_string_11;
extern const cst_val val_string_12;
extern const cst_val val_string_13;
extern const cst_val val_string_14;
extern const cst_val val_string_15;
extern const cst_val val_string_16;
extern const cst_val val_string_17;
extern const cst_val val_string_18;
extern const cst_val val_string_19;
extern const cst_val val_string_20;
extern const cst_val val_string_21;
extern const cst_val val_string_22;
extern const cst_val val_string_23;
extern const cst_val val_string_24;
#else
/* Only GCC seems to currently support the C99 standard for giving */
/* explicit names for fields for initializing unions, because we want */
/* things to be const, and to be small structures this is really useful */
/* thus for compilers not supporting no_union_initization we use other */
/* structure that we know (hope ?) are the same size and use agressive */
/* casting. The goal here is wholly justified but the method here isn't */
/* pretty */
/* These structures are defined *solely* to get round initialization */
/* problems if you need to use these in any code you are using, you are */
/* unquestionably doing the wrong thing */
typedef struct cst_val_atom_struct_float {
#ifdef WORDS_BIGENDIAN
short ref_count;
short type; /* order is here important */
#else
#if (defined(__x86_64__) || defined(_M_X64))
int type; /* order is here important */
int ref_count;
#else
short type; /* order is here important */
short ref_count;
#endif
#endif
#if (defined(__x86_64__) || defined(_M_X64))
double fval;
#else
float fval;
#endif
} cst_val_float;
typedef struct cst_val_atom_struct_int {
#ifdef WORDS_BIGENDIAN
short ref_count;
short type; /* order is here important (and unintuitive) */
#else
#if (defined(__x86_64__) || defined(_M_X64))
int type; /* order is here important */
int ref_count;
#else
short type; /* order is here important */
short ref_count;
#endif
#endif
#if (defined(__x86_64__) || defined(_M_X64))
long long ival;
#else
int ival;
#endif
} cst_val_int;
typedef struct cst_val_atom_struct_void {
#ifdef WORDS_BIGENDIAN
short ref_count;
short type; /* order is here important */
#else
#if (defined(__x86_64__) || defined(_M_X64))
int type; /* order is here important */
int ref_count;
#else
short type; /* order is here important */
short ref_count;
#endif
#endif
void *vval;
} cst_val_void;
#ifdef WORDS_BIGENDIAN
#define DEF_CONST_VAL_INT(N,V) const cst_val_int N={-1, CST_VAL_TYPE_INT, V}
#define DEF_CONST_VAL_STRING(N,S) const cst_val_void N={-1,CST_VAL_TYPE_STRING,(void *)S}
#define DEF_CONST_VAL_FLOAT(N,F) const cst_val_float N={-1,CST_VAL_TYPE_FLOAT,(float)F}
#else
#define DEF_CONST_VAL_INT(N,V) const cst_val_int N={CST_VAL_TYPE_INT,-1,V}
#define DEF_CONST_VAL_STRING(N,S) const cst_val_void N={CST_VAL_TYPE_STRING,-1,(void *)S}
#define DEF_CONST_VAL_FLOAT(N,F) const cst_val_float N={CST_VAL_TYPE_FLOAT,-1,(float)F}
#endif
#define DEF_CONST_VAL_CONS(N,A,D) const cst_val_cons N={A,D}
/* in the non-union intialization version we these consts have to be */
/* more typed than need, we'll cast the back later */
extern const cst_val_int val_int_0;
extern const cst_val_int val_int_1;
extern const cst_val_int val_int_2;
extern const cst_val_int val_int_3;
extern const cst_val_int val_int_4;
extern const cst_val_int val_int_5;
extern const cst_val_int val_int_6;
extern const cst_val_int val_int_7;
extern const cst_val_int val_int_8;
extern const cst_val_int val_int_9;
extern const cst_val_int val_int_10;
extern const cst_val_int val_int_11;
extern const cst_val_int val_int_12;
extern const cst_val_int val_int_13;
extern const cst_val_int val_int_14;
extern const cst_val_int val_int_15;
extern const cst_val_int val_int_16;
extern const cst_val_int val_int_17;
extern const cst_val_int val_int_18;
extern const cst_val_int val_int_19;
extern const cst_val_int val_int_20;
extern const cst_val_int val_int_21;
extern const cst_val_int val_int_22;
extern const cst_val_int val_int_23;
extern const cst_val_int val_int_24;
extern const cst_val_void val_string_0;
extern const cst_val_void val_string_1;
extern const cst_val_void val_string_2;
extern const cst_val_void val_string_3;
extern const cst_val_void val_string_4;
extern const cst_val_void val_string_5;
extern const cst_val_void val_string_6;
extern const cst_val_void val_string_7;
extern const cst_val_void val_string_8;
extern const cst_val_void val_string_9;
extern const cst_val_void val_string_10;
extern const cst_val_void val_string_11;
extern const cst_val_void val_string_12;
extern const cst_val_void val_string_13;
extern const cst_val_void val_string_14;
extern const cst_val_void val_string_15;
extern const cst_val_void val_string_16;
extern const cst_val_void val_string_17;
extern const cst_val_void val_string_18;
extern const cst_val_void val_string_19;
extern const cst_val_void val_string_20;
extern const cst_val_void val_string_21;
extern const cst_val_void val_string_22;
extern const cst_val_void val_string_23;
extern const cst_val_void val_string_24;
#endif
#define DEF_STATIC_CONST_VAL_INT(N,V) static DEF_CONST_VAL_INT(N,V)
#define DEF_STATIC_CONST_VAL_STRING(N,S) static DEF_CONST_VAL_STRING(N,S)
#define DEF_STATIC_CONST_VAL_FLOAT(N,F) static DEF_CONST_VAL_FLOAT(N,F)
#define DEF_STATIC_CONST_VAL_CONS(N,A,D) static DEF_CONST_VAL_CONS(N,A,D)
/* Some actual val consts */
/* The have casts as in the non-union intialize case the casts are necessary */
/* but in the union initial case these casts are harmless */
#define VAL_INT_0 (cst_val *)&val_int_0
#define VAL_INT_1 (cst_val *)&val_int_1
#define VAL_INT_2 (cst_val *)&val_int_2
#define VAL_INT_3 (cst_val *)&val_int_3
#define VAL_INT_4 (cst_val *)&val_int_4
#define VAL_INT_5 (cst_val *)&val_int_5
#define VAL_INT_6 (cst_val *)&val_int_6
#define VAL_INT_7 (cst_val *)&val_int_7
#define VAL_INT_8 (cst_val *)&val_int_8
#define VAL_INT_9 (cst_val *)&val_int_9
#define VAL_INT_10 (cst_val *)&val_int_10
#define VAL_INT_11 (cst_val *)&val_int_11
#define VAL_INT_12 (cst_val *)&val_int_12
#define VAL_INT_13 (cst_val *)&val_int_13
#define VAL_INT_14 (cst_val *)&val_int_14
#define VAL_INT_15 (cst_val *)&val_int_15
#define VAL_INT_16 (cst_val *)&val_int_16
#define VAL_INT_17 (cst_val *)&val_int_17
#define VAL_INT_18 (cst_val *)&val_int_18
#define VAL_INT_19 (cst_val *)&val_int_19
#define VAL_INT_20 (cst_val *)&val_int_20
#define VAL_INT_21 (cst_val *)&val_int_21
#define VAL_INT_22 (cst_val *)&val_int_22
#define VAL_INT_23 (cst_val *)&val_int_23
#define VAL_INT_24 (cst_val *)&val_int_24
const cst_val *val_int_n(int n);
#define VAL_STRING_0 (cst_val *)&val_string_0
#define VAL_STRING_1 (cst_val *)&val_string_1
#define VAL_STRING_2 (cst_val *)&val_string_2
#define VAL_STRING_3 (cst_val *)&val_string_3
#define VAL_STRING_4 (cst_val *)&val_string_4
#define VAL_STRING_5 (cst_val *)&val_string_5
#define VAL_STRING_6 (cst_val *)&val_string_6
#define VAL_STRING_7 (cst_val *)&val_string_7
#define VAL_STRING_8 (cst_val *)&val_string_8
#define VAL_STRING_9 (cst_val *)&val_string_9
#define VAL_STRING_10 (cst_val *)&val_string_10
#define VAL_STRING_11 (cst_val *)&val_string_11
#define VAL_STRING_12 (cst_val *)&val_string_12
#define VAL_STRING_13 (cst_val *)&val_string_13
#define VAL_STRING_14 (cst_val *)&val_string_14
#define VAL_STRING_15 (cst_val *)&val_string_15
#define VAL_STRING_16 (cst_val *)&val_string_16
#define VAL_STRING_17 (cst_val *)&val_string_17
#define VAL_STRING_18 (cst_val *)&val_string_18
#define VAL_STRING_19 (cst_val *)&val_string_19
#define VAL_STRING_20 (cst_val *)&val_string_20
#define VAL_STRING_21 (cst_val *)&val_string_21
#define VAL_STRING_22 (cst_val *)&val_string_22
#define VAL_STRING_23 (cst_val *)&val_string_23
#define VAL_STRING_24 (cst_val *)&val_string_24
const cst_val *val_string_n(int n);
#endif

112
include/cst_val_defs.h Normal file
View File

@ -0,0 +1,112 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Macros for user defined type objects */
/* */
/*************************************************************************/
#ifndef _CST_VAL_DEFS_H__
#define _CST_VAL_DEFS_H__
#include <stdlib.h>
/* Macro for defining new user structs as vals */
#define CST_VAL_USER_TYPE_DCLS(NAME,TYPE) \
extern const int cst_val_type_##NAME; \
TYPE *val_##NAME(const cst_val *v); \
cst_val *NAME##_val(const TYPE *v);
#define CST_VAL_USER_FUNCPTR_DCLS(NAME,TYPE) \
extern const int cst_val_type_##NAME; \
TYPE val_##NAME(const cst_val *v); \
cst_val *NAME##_val(const TYPE v);
#define CST_VAL_REGISTER_TYPE(NAME,TYPE) \
TYPE *val_##NAME(const cst_val *v) \
{ \
return (TYPE *)val_generic(v,cst_val_type_##NAME,#NAME); \
} \
void val_delete_##NAME(void *v) \
{ \
delete_##NAME((TYPE *)v); \
} \
\
cst_val *NAME##_val(const TYPE *v) \
{ \
return val_new_typed(cst_val_type_##NAME, \
(void *)v); \
} \
#define CST_VAL_REG_TD_TYPE(NAME,TYPE,NUM) \
extern const int cst_val_type_##NAME; \
const int cst_val_type_##NAME=NUM; \
void val_delete_##NAME(void *v); \
/* When objects of this type can never be owned by vals */
#define CST_VAL_REGISTER_TYPE_NODEL(NAME,TYPE) \
TYPE *val_##NAME(const cst_val *v) \
{ \
return (TYPE *)val_generic(v,cst_val_type_##NAME,#NAME); \
} \
\
cst_val *NAME##_val(const TYPE *v) \
{ \
return val_new_typed(cst_val_type_##NAME, \
(void *)v); \
} \
#define CST_VAL_REG_TD_TYPE_NODEL(NAME,TYPE,NUM) \
extern const int cst_val_type_##NAME; \
const int cst_val_type_##NAME=NUM; \
void val_delete_##NAME(void *v) { (void)v; } \
#define CST_VAL_REGISTER_FUNCPTR(NAME,TYPE) \
TYPE val_##NAME(const cst_val *v) \
{ \
return (TYPE)val_generic(v,cst_val_type_##NAME,#NAME); \
} \
\
cst_val *NAME##_val(const TYPE v) \
{ \
return val_new_typed(cst_val_type_##NAME, \
(void *)v); \
} \
#define CST_VAL_REG_TD_FUNCPTR(NAME,TYPE,NUM) \
extern const int cst_val_type_##NAME; \
const int cst_val_type_##NAME=NUM; \
void val_delete_##NAME(void *v) { (void)v; } \
#endif

113
include/cst_viterbi.h Normal file
View File

@ -0,0 +1,113 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2000 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: August 2000 */
/*************************************************************************/
/* */
/* Viterbi support */
/* */
/*************************************************************************/
#ifndef _CST_VITERBI_H__
#define _CST_VITERBI_H__
#include "cst_file.h"
#include "cst_math.h"
#include "cst_utterance.h"
typedef struct cst_vit_cand_struct {
int score;
cst_val *val;
int ival, pos;
cst_item *item;
struct cst_vit_cand_struct *next;
} cst_vit_cand;
cst_vit_cand *new_vit_cand();
void vit_cand_set(cst_vit_cand *vc, cst_val *val);
void vit_cand_set_int(cst_vit_cand *vc, int ival);
void delete_vit_cand(cst_vit_cand *vc);
typedef struct cst_vit_path_struct {
int score;
int state;
cst_vit_cand *cand;
cst_features *f;
struct cst_vit_path_struct *from;
struct cst_vit_path_struct *next;
} cst_vit_path;
cst_vit_path *new_vit_path();
void delete_vit_path(cst_vit_path *vp);
typedef struct cst_vit_point_struct {
cst_item *item;
int num_states;
int num_paths;
cst_vit_cand *cands;
cst_vit_path *paths;
cst_vit_path **state_paths;
struct cst_vit_point_struct *next;
} cst_vit_point;
cst_vit_point *new_vit_point();
void delete_vit_point(cst_vit_point *vp);
struct cst_viterbi_struct;
/* Functions for user call back, to find candiates at a point, and
to join (and score) paths */
typedef cst_vit_cand *(cst_vit_cand_f_t)(cst_item *s,
struct cst_viterbi_struct *vd);
typedef cst_vit_path *(cst_vit_path_f_t)(cst_vit_path *p,
cst_vit_cand *c,
struct cst_viterbi_struct *vd);
typedef struct cst_viterbi_struct {
int num_states;
cst_vit_cand_f_t *cand_func;
cst_vit_path_f_t *path_func;
int big_is_good;
cst_vit_point *timeline;
cst_vit_point *last_point;
cst_features *f;
} cst_viterbi;
cst_viterbi *new_viterbi(cst_vit_cand_f_t *cand_func,
cst_vit_path_f_t *path_func);
void delete_viterbi(cst_viterbi *vd);
void viterbi_initialise(cst_viterbi *vd,cst_relation *r);
void viterbi_decode(cst_viterbi *vd);
int viterbi_result(cst_viterbi *vd, const char *n);
void viterbi_copy_feature(cst_viterbi *vd,const char *featname);
#endif

78
include/cst_voice.h Normal file
View File

@ -0,0 +1,78 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 2000 */
/*************************************************************************/
/* */
/* Voice functions */
/* */
/*************************************************************************/
#ifndef _CST_VOICE_H__
#define _CST_VOICE_H__
#include "cst_file.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_utterance.h"
#include "cst_relation.h"
#include "cst_lexicon.h"
struct cst_voice_struct {
const char *name;
cst_features *features;
cst_features *ffunctions;
/* This hook is called (from utt_init()) after the input text (if
any) has been set and voice features have been copied in, but
before synthesis. */
cst_utterance *(*utt_init)(cst_utterance *u,
struct cst_voice_struct *v);
};
typedef struct cst_voice_struct cst_voice;
/* Hold pointers to language and lexicon init function */
struct cst_lang_struct {
const char *lang;
void (*lang_init)(cst_voice *vox);
cst_lexicon *(*lex_init)();
};
typedef struct cst_lang_struct cst_lang;
/* Constructor functions */
cst_voice *new_voice();
void delete_voice(cst_voice *u);
CST_VAL_USER_TYPE_DCLS(voice,cst_voice)
#endif

164
include/cst_wave.h Normal file
View File

@ -0,0 +1,164 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: August 2000 */
/*************************************************************************/
/* */
/* Waveforms */
/* */
/*************************************************************************/
#ifndef _CST_WAVE_H__
#define _CST_WAVE_H__
#include "cst_file.h"
#include "cst_error.h"
#include "cst_alloc.h"
#include "cst_endian.h"
#include "cst_file.h"
#include "cst_val.h"
typedef struct cst_wave_struct {
const char *type;
int sample_rate;
int num_samples;
int num_channels;
short *samples;
} cst_wave;
typedef struct cst_wave_header_struct {
const char *type;
int hsize;
int num_bytes;
int sample_rate;
int num_samples;
int num_channels;
} cst_wave_header;
cst_wave *new_wave();
cst_wave *copy_wave(const cst_wave *w);
void delete_wave(cst_wave *val);
cst_wave *concat_wave(cst_wave *dest, const cst_wave *src);
#define cst_wave_num_samples(w) (w?w->num_samples:0)
#define cst_wave_num_channels(w) (w?w->num_channels:0)
#define cst_wave_sample_rate(w) (w?w->sample_rate:0)
#define cst_wave_samples(w) (w->samples)
#define cst_wave_set_num_samples(w,s) w->num_samples=s
#define cst_wave_set_num_channels(w,s) w->num_channels=s
#define cst_wave_set_sample_rate(w,s) w->sample_rate=s
int cst_wave_save(cst_wave *w, const char *filename, const char *type);
int cst_wave_save_riff(cst_wave *w, const char *filename);
int cst_wave_save_raw(cst_wave *w, const char *filename);
int cst_wave_append_riff(cst_wave *w,const char *filename);
int cst_wave_save_riff_fd(cst_wave *w, cst_file fd);
int cst_wave_save_raw_fd(cst_wave *w, cst_file fd);
int cst_wave_load(cst_wave *w, const char *filename, const char *type);
int cst_wave_load_riff(cst_wave *w, const char *filename);
int cst_wave_load_raw(cst_wave *w, const char *filename,
const char *bo, int sample_rate);
int cst_wave_load_riff_header(cst_wave_header *header,cst_file fd);
int cst_wave_load_riff_fd(cst_wave *w, cst_file fd);
int cst_wave_load_raw_fd (cst_wave *w, cst_file fd,
const char *bo, int sample_rate);
void cst_wave_resize(cst_wave *w,int samples, int num_channels);
void cst_wave_resample(cst_wave *w, int sample_rate);
void cst_wave_rescale(cst_wave *w, int factor);
/* Resampling code */
typedef struct cst_rateconv_struct {
int channels; /* what do you think? */
int up, down; /* up/down sampling ratio */
double gain; /* output gain */
int lag; /* lag time (in samples) */
int *sin, *sout, *coep; /* filter buffers, coefficients */
/* n.b. outsize is the minimum buffer size for
cst_rateconv_out() when streaming */
int insize, outsize; /* size of filter buffers */
int incount; /* amount of input data */
int len; /* size of filter */
/* internal foo coefficients */
double fsin, fgk, fgg;
/* internal counters */
int inbaseidx, inoffset, cycctr, outidx;
} cst_rateconv;
cst_rateconv * new_rateconv(int up, int down, int channels);
void delete_rateconv(cst_rateconv *filt);
int cst_rateconv_in(cst_rateconv *filt, const short *inptr, int max);
int cst_rateconv_leadout(cst_rateconv *filt);
int cst_rateconv_out(cst_rateconv *filt, short *outptr, int max);
/* File format cruft. */
#define RIFF_FORMAT_PCM 0x0001
#define RIFF_FORMAT_ADPCM 0x0002
#define RIFF_FORMAT_MULAW 0x0006
#define RIFF_FORMAT_ALAW 0x0007
/* Sun/Next header, short and sweet, note its always BIG_ENDIAN though */
typedef struct {
unsigned int magic; /* magic number */
unsigned int hdr_size; /* size of this header */
int data_size; /* length of data (optional) */
unsigned int encoding; /* data encoding format */
unsigned int sample_rate; /* samples per second */
unsigned int channels; /* number of interleaved channels */
} snd_header;
#define CST_SND_MAGIC (unsigned int)0x2e736e64
#define CST_SND_ULAW 1
#define CST_SND_UCHAR 2
#define CST_SND_SHORT 3
/* Convertion functions */
unsigned char cst_short_to_ulaw(short sample);
short cst_ulaw_to_short(unsigned char ulawbyte);
#define CST_G721_LEADIN 8
unsigned char *cst_g721_decode(int *actual_size,int size,
const unsigned char *packed_residual);
unsigned char *cst_g721_encode(int *packed_size,int actual_size,
const unsigned char *unpacked_residual);
CST_VAL_USER_TYPE_DCLS(wave,cst_wave)
#endif

50
include/cst_wchar.h Normal file
View File

@ -0,0 +1,50 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2008 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: June 2008 */
/*************************************************************************/
/* */
/* WCHAR functions */
/* */
/*************************************************************************/
#ifndef __CST_WCHAR_H__
#define __CST_WCHAR_H__
#include <wchar.h>
wchar_t *cst_cstr2wstr(const char *s);
char *cst_wstr2cstr(const wchar_t *s);
#define cst_wstrlen(X) wcslen(X)
#endif

152
include/flite.h Normal file
View File

@ -0,0 +1,152 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 1999 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Author: Alan W Black (awb@cs.cmu.edu) */
/* Date: December 1999 */
/*************************************************************************/
/* */
/* Light weight run-time speech synthesis system, public API */
/* */
/*************************************************************************/
#ifndef _FLITE_H__
#define _FLITE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "cst_string.h"
#include "cst_regex.h"
#include "cst_val.h"
#include "cst_features.h"
#include "cst_item.h"
#include "cst_relation.h"
#include "cst_utterance.h"
#include "cst_wave.h"
#include "cst_track.h"
#include "cst_cart.h"
#include "cst_phoneset.h"
#include "cst_voice.h"
#include "cst_audio.h"
#include "cst_utt_utils.h"
#include "cst_lexicon.h"
#include "cst_synth.h"
#include "cst_units.h"
#include "cst_tokenstream.h"
#ifdef WIN32
/* For Visual Studio 2012 global variable definitions */
#define GLOBALVARDEF __declspec(dllexport)
#else
#define GLOBALVARDEF
#endif
extern GLOBALVARDEF cst_val *flite_voice_list;
extern GLOBALVARDEF cst_lang flite_lang_list[20];
extern GLOBALVARDEF int flite_lang_list_length;
/* Public functions */
int flite_init();
/* General top level functions */
cst_voice *flite_voice_select(const char *name);
cst_voice *flite_voice_load(const char *voice_filename);
int flite_voice_dump(cst_voice *voice, const char *voice_filename);
float flite_file_to_speech(const char *filename,
cst_voice *voice,
const char *outtype);
float flite_text_to_speech(const char *text,
cst_voice *voice,
const char *outtype);
float flite_phones_to_speech(const char *text,
cst_voice *voice,
const char *outtype);
float flite_ssml_file_to_speech(const char *filename,
cst_voice *voice,
const char *outtype);
float flite_ssml_text_to_speech(const char *text,
cst_voice *voice,
const char *outtype);
int flite_voice_add_lex_addenda(cst_voice *v, const cst_string *lexfile);
/* Lower lever user functions */
cst_wave *flite_text_to_wave(const char *text,cst_voice *voice);
cst_utterance *flite_synth_text(const char *text,cst_voice *voice);
cst_utterance *flite_synth_phones(const char *phones,cst_voice *voice);
float flite_ts_to_speech(cst_tokenstream *ts,
cst_voice *voice,
const char *outtype);
cst_utterance *flite_do_synth(cst_utterance *u,
cst_voice *voice,
cst_uttfunc synth);
float flite_process_output(cst_utterance *u,
const char *outtype,
int append);
/* for voices with external voxdata */
int flite_mmap_clunit_voxdata(const char *voxdir, cst_voice *voice);
int flite_munmap_clunit_voxdata(cst_voice *voice);
/* flite public export wrappers for features access */
int flite_get_param_int(const cst_features *f, const char *name,int def);
float flite_get_param_float(const cst_features *f, const char *name, float def);
const char *flite_get_param_string(const cst_features *f, const char *name, const char *def);
const cst_val *flite_get_param_val(const cst_features *f, const char *name, cst_val *def);
void flite_feat_set_int(cst_features *f, const char *name, int v);
void flite_feat_set_float(cst_features *f, const char *name, float v);
void flite_feat_set_string(cst_features *f, const char *name, const char *v);
void flite_feat_set(cst_features *f, const char *name,const cst_val *v);
int flite_feat_remove(cst_features *f, const char *name);
const char *flite_ffeature_string(const cst_item *item,const char *featpath);
int flite_ffeature_int(const cst_item *item,const char *featpath);
float flite_ffeature_float(const cst_item *item,const char *featpath);
const cst_val *flite_ffeature(const cst_item *item,const char *featpath);
cst_item* flite_path_to_item(const cst_item *item,const char *featpath);
/* These functions are *not* thread-safe, they are designed to be called */
/* before the initial synthesis occurs */
int flite_add_voice(cst_voice *voice);
int flite_add_lang(const char *langname,
void (*lang_init)(cst_voice *vox),
cst_lexicon *(*lex_init)());
/* These are init functions for generic grapheme based voices */
void utf8_grapheme_lang_init(cst_voice *v);
cst_lexicon *utf8_grapheme_lex_init(void);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

6
include/flite_version.h Normal file
View File

@ -0,0 +1,6 @@
#define FLITE_PROJECT_NAME "Festival Lite"
#define FLITE_PROJECT_PREFIX "flite"
#define FLITE_PROJECT_VERSION "2.1"
#define FLITE_PROJECT_DATE "Dec 2017"
#define FLITE_PROJECT_STATE "release"
#define FLITE_PROJECT_SHLIB_VERSION "1"

251
install-sh Executable file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

47
lang/Makefile Normal file
View File

@ -0,0 +1,47 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2000 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Language/Lex/Voice specific models/functions ##
## ##
###########################################################################
TOP=..
DIRNAME=lang
# But only the build the ones we are interested in in this configuration
BUILD_DIRS = $(LEXES) $(LANGS) $(VOXES)
ALL_DIRS= $(BUILD_DIRS)
FILES = Makefile $(SCM) $(SRCS)
ALL = $(BUILD_DIRS)
include $(TOP)/config/common_make_rules

View File

@ -0,0 +1,57 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2013 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## grapheme general functions/models ##
## ##
###########################################################################
TOP=../..
DIRNAME=lang/cmu_grapheme_lang
BUILD_DIRS =
ALL_DIRS=
H = cmu_grapheme_lang.h cmu_grapheme_phrasing_cart.h
SRCS = cmu_grapheme_lang.c cmu_grapheme_phoneset.c cmu_grapheme_phrasing_cart.c
SCRIPTS = make_grapheme_phoneset
OBJS = $(SRCS:.c=.o)
SCM=
FILES = Makefile $(SCM) $(SRCS) $(H) $(SCRIPTS)
LIBNAME = flite_cmu_grapheme_lang
LOCAL_INCLUDES =
ALL =
include $(TOP)/config/common_make_rules
# Update this when Festvox's sampa.table is updated
phoneset:
./make_grapheme_phoneset

View File

@ -0,0 +1,128 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2013 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* */
/* grapheme language support */
/* */
/*************************************************************************/
#include "flite.h"
#include "cst_val.h"
#include "cst_voice.h"
#include "cst_lexicon.h"
#include "cst_ffeatures.h"
#include "cmu_grapheme_lang.h"
static cst_val *cmu_grapheme_tokentowords(cst_item *token)
{
/* Return list of words that expand token/name */
cst_val *r;
const char *name;
name = item_name(token);
if (item_feat_present(token,"phones"))
return cons_val(string_val(name),NULL);
#if 0
if (item_feat_present(token,"nsw"))
nsw = item_feat_string(token,"nsw");
utt = item_utt(token);
lex = val_lexicon(feat_val(utt->features,"lexicon"));
#endif
if (cst_strlen(name) > 0)
r = cons_val(string_val(name),0);
else
r = NULL;
return r;
}
int grapheme_utt_break(cst_tokenstream *ts,
const char *token,
cst_relation *tokens)
{
/* We'll respect Latin punctuation */
const char *postpunct = item_feat_string(relation_tail(tokens), "punc");
/* const char *ltoken = item_name(relation_tail(tokens)); */
if (cst_strchr(ts->whitespace,'\n') != cst_strrchr(ts->whitespace,'\n'))
/* contains two new lines */
return TRUE;
else if (strchr(postpunct,':') ||
strchr(postpunct,'?') ||
strchr(postpunct,'!'))
return TRUE;
else if (strchr(postpunct,'.'))
return TRUE;
else
return FALSE;
}
void cmu_grapheme_lang_init(cst_voice *v)
{
/* Set grapheme language stuff */
feat_set_string(v->features,"language","cmu_grapheme_lang");
/* utterance break function */
feat_set(v->features,"utt_break",breakfunc_val(&grapheme_utt_break));
/* Phoneset -- need to get this from voice */
feat_set(v->features,"phoneset",phoneset_val(&cmu_grapheme_phoneset));
feat_set_string(v->features,"silence",cmu_grapheme_phoneset.silence);
/* Get information from voice and add to lexicon */
/* Text analyser -- whitespace defaults */
feat_set_string(v->features,"text_whitespace",
cst_ts_default_whitespacesymbols);
feat_set_string(v->features,"text_postpunctuation",
cst_ts_default_postpunctuationsymbols);
feat_set_string(v->features,"text_prepunctuation",
cst_ts_default_prepunctuationsymbols);
feat_set_string(v->features,"text_singlecharsymbols",
cst_ts_default_singlecharsymbols);
/* Tokenization tokenization function */
feat_set(v->features,"tokentowords_func",itemfunc_val(&cmu_grapheme_tokentowords));
/* Pos tagger (gpos)/induced pos */
/* Phrasing */
feat_set(v->features,"phrasing_cart",cart_val(&cmu_grapheme_phrasing_cart));
/* Intonation, Duration and F0 -- part of cg */
feat_set_string(v->features,"no_intonation_accent_model","1");
/* Default ffunctions (required) */
basic_ff_register(v->ffunctions);
return;
}

View File

@ -0,0 +1,59 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2013 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* grapheme lang public functions */
/*************************************************************************/
#ifndef _cmu_grapheme_lang_h_
#define _cmu_grapheme_lang_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "cst_utterance.h"
#include "cst_cart.h"
#include "cst_val.h"
#include "cst_phoneset.h"
#include "cst_lexicon.h"
#include "cst_synth.h"
void cmu_grapheme_lang_init(cst_voice *v);
extern const cst_phoneset cmu_grapheme_phoneset;
extern const cst_cart cmu_grapheme_phrasing_cart;
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,427 @@
/*******************************************************/
/** Autogenerated phoneset trees for cmu_grapheme */
/*******************************************************/
#include "cst_string.h"
#include "cst_phoneset.h"
extern const cst_phoneset cmu_grapheme_phoneset;
static const char * const cmu_grapheme_featnames[] = {
"clst",
"vc",
"vlng",
"vheight",
"vfront",
"vrnd",
"ctype",
"cplace",
"cvox",
"asp",
"nuk",
NULL };
static const char * const cmu_grapheme_phonenames[] = {
"pau",
"QQ",
"QM",
"A",
"a:",
">",
"tra",
"t:ra",
"h:",
">:",
"A:",
"i",
"i:",
"u",
"u:",
"9r=",
"9r:",
"rr=",
"rr",
"r",
"rrh",
"l=",
"@",
"@:",
"e:",
"aI",
">I",
"o:",
"aU",
"oU",
"oI",
"q",
"k",
"kh",
"G",
"g",
"gh",
"x",
"N",
"c",
"ch",
"z",
"z~",
"J",
"Jh",
"n~",
"T",
"tB",
"tBh",
"D",
"d",
"d~",
"dB",
"dBh",
"n",
"nX",
"nB",
"tr",
"tR",
"dr",
"dR",
"nr",
"p",
"P",
"ph",
"f",
"b",
"bh",
"m",
"M",
"j",
"9rB",
"9r",
"l",
"lr",
"lr=",
"V",
"v",
"c}",
"S",
"sr",
"s",
"h",
"s~",
"t",
"t~",
"hv",
"H",
"n:",
"E",
"e",
"o",
"6",
"6j",
"6w",
"9:",
"9y",
"E:",
"O:",
"O:j",
"a:j",
"a:w",
"dz",
"dZ",
"Z",
"ej",
"gw",
"iw",
"kw",
"ow",
"ts",
"tS",
"u:j",
"w",
"y:",
"LB",
NULL };
static const int cmu_grapheme_fv_000[] = { 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_001[] = { 0, 0, 1, 1, 1, 1, 2, 3, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_002[] = { 0, 0, 1, 1, 1, 1, 2, 4, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_003[] = { 0, 5, 2, 6, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_004[] = { 0, 5, 7, 6, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_005[] = { 0, 5, 2, 6, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_006[] = { 5, 5, 2, 6, 6, 0, 2, 8, 5, 0, 1, -1 };
static const int cmu_grapheme_fv_007[] = { 5, 5, 2, 6, 6, 0, 2, 9, 5, 0, 1, -1 };
static const int cmu_grapheme_fv_008[] = { 0, 5, 2, 6, 6, 0, 10, 1, 0, 5, 1, -1 };
static const int cmu_grapheme_fv_009[] = { 0, 5, 7, 11, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_010[] = { 0, 5, 7, 11, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_011[] = { 0, 5, 2, 12, 12, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_012[] = { 0, 5, 7, 12, 12, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_013[] = { 0, 5, 2, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_014[] = { 0, 5, 7, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_015[] = { 0, 5, 2, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_016[] = { 0, 5, 2, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_017[] = { 0, 5, 7, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_018[] = { 0, 5, 7, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_019[] = { 0, 0, 1, 1, 1, 5, 7, 13, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_020[] = { 0, 5, 7, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_021[] = { 0, 5, 2, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_022[] = { 0, 5, 2, 6, 12, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_023[] = { 0, 5, 7, 6, 12, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_024[] = { 0, 5, 7, 6, 12, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_025[] = { 0, 5, 8, 6, 12, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_026[] = { 0, 5, 8, 6, 12, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_027[] = { 0, 5, 7, 6, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_028[] = { 0, 5, 8, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_029[] = { 0, 5, 8, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_030[] = { 0, 5, 8, 12, 11, 5, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_031[] = { 0, 0, 1, 1, 1, 1, 2, 4, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_032[] = { 0, 0, 1, 1, 1, 1, 2, 4, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_033[] = { 0, 0, 1, 1, 1, 1, 2, 4, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_034[] = { 0, 0, 1, 1, 1, 1, 2, 4, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_035[] = { 0, 0, 1, 1, 1, 1, 2, 4, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_036[] = { 0, 0, 1, 1, 1, 1, 2, 4, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_037[] = { 0, 0, 1, 1, 1, 1, 2, 4, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_038[] = { 0, 0, 1, 1, 1, 1, 14, 4, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_039[] = { 0, 0, 1, 1, 1, 1, 13, 15, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_040[] = { 0, 0, 1, 1, 1, 1, 13, 15, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_041[] = { 0, 0, 1, 1, 1, 1, 13, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_042[] = { 0, 0, 1, 1, 1, 1, 13, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_043[] = { 0, 0, 1, 1, 1, 1, 13, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_044[] = { 0, 0, 1, 1, 1, 1, 13, 15, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_045[] = { 0, 0, 1, 1, 1, 1, 14, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_046[] = { 0, 0, 1, 1, 1, 1, 10, 8, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_047[] = { 0, 0, 1, 1, 1, 1, 2, 8, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_048[] = { 0, 0, 1, 1, 1, 1, 2, 8, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_049[] = { 0, 0, 1, 1, 1, 1, 2, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_050[] = { 0, 0, 1, 1, 1, 1, 2, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_051[] = { 0, 0, 1, 1, 1, 1, 2, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_052[] = { 0, 0, 1, 1, 1, 1, 2, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_053[] = { 0, 0, 1, 1, 1, 1, 2, 8, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_054[] = { 0, 0, 1, 1, 1, 1, 14, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_055[] = { 0, 0, 1, 1, 1, 1, 14, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_056[] = { 0, 0, 1, 1, 1, 1, 14, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_057[] = { 0, 0, 1, 1, 1, 1, 2, 13, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_058[] = { 0, 0, 1, 1, 1, 1, 2, 13, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_059[] = { 0, 0, 1, 1, 1, 1, 2, 13, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_060[] = { 0, 0, 1, 1, 1, 1, 2, 13, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_061[] = { 0, 0, 1, 1, 1, 1, 14, 13, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_062[] = { 0, 0, 1, 1, 1, 1, 2, 7, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_063[] = { 0, 0, 1, 1, 1, 1, 2, 7, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_064[] = { 0, 0, 1, 1, 1, 1, 2, 7, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_065[] = { 0, 0, 1, 1, 1, 1, 2, 7, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_066[] = { 0, 0, 1, 1, 1, 1, 2, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_067[] = { 0, 0, 1, 1, 1, 1, 2, 7, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_068[] = { 0, 0, 1, 1, 1, 1, 14, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_069[] = { 0, 0, 1, 1, 1, 1, 14, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_070[] = { 0, 0, 1, 1, 1, 1, 7, 4, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_071[] = { 0, 0, 1, 1, 1, 1, 7, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_072[] = { 0, 0, 1, 1, 1, 1, 7, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_073[] = { 0, 0, 1, 1, 1, 1, 7, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_074[] = { 0, 0, 1, 1, 1, 1, 7, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_075[] = { 0, 0, 1, 1, 1, 1, 7, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_076[] = { 0, 0, 1, 1, 1, 1, 7, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_077[] = { 0, 0, 1, 1, 1, 1, 7, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_078[] = { 0, 0, 1, 1, 1, 1, 10, 4, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_079[] = { 0, 0, 1, 1, 1, 1, 10, 15, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_080[] = { 0, 0, 1, 1, 1, 1, 10, 15, 5, 5, 0, -1 };
static const int cmu_grapheme_fv_081[] = { 0, 0, 1, 1, 1, 1, 10, 8, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_082[] = { 0, 0, 1, 1, 1, 1, 10, 4, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_083[] = { 0, 0, 1, 1, 1, 1, 10, 8, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_084[] = { 0, 0, 1, 1, 1, 1, 2, 13, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_085[] = { 0, 0, 1, 1, 1, 1, 2, 13, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_086[] = { 0, 0, 1, 1, 1, 1, 10, 4, 0, 5, 0, -1 };
static const int cmu_grapheme_fv_087[] = { 0, 0, 1, 1, 1, 1, 7, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_088[] = { 0, 0, 1, 1, 1, 1, 14, 8, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_089[] = { 0, 5, 2, 6, 12, 0, 1, 1, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_090[] = { 0, 5, 2, 6, 12, 0, 1, 1, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_091[] = { 0, 5, 2, 6, 11, 5, 1, 1, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_092[] = { 0, 5, 1, 1, 1, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_093[] = { 0, 5, 1, 1, 1, 0, 16, 7, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_094[] = { 0, 5, 1, 1, 1, 5, 16, 15, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_095[] = { 0, 5, 7, 1, 1, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_096[] = { 0, 5, 1, 1, 1, 0, 16, 7, 1, 0, 1, -1 };
static const int cmu_grapheme_fv_097[] = { 0, 5, 7, 6, 12, 0, 1, 1, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_098[] = { 0, 5, 7, 6, 11, 0, 1, 1, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_099[] = { 0, 5, 7, 6, 11, 0, 16, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_100[] = { 0, 5, 7, 11, 12, 0, 16, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_101[] = { 0, 5, 7, 11, 12, 0, 16, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_102[] = { 0, 0, 1, 1, 1, 1, 13, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_103[] = { 0, 0, 1, 1, 1, 1, 13, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_104[] = { 0, 0, 1, 1, 1, 1, 13, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_105[] = { 0, 5, 2, 6, 12, 0, 16, 15, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_106[] = { 0, 0, 1, 1, 1, 1, 2, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_107[] = { 0, 5, 2, 12, 12, 0, 16, 7, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_108[] = { 0, 0, 1, 1, 1, 1, 2, 7, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_109[] = { 0, 5, 2, 6, 11, 0, 16, 7, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_110[] = { 0, 0, 1, 1, 1, 1, 2, 13, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_111[] = { 0, 0, 1, 1, 1, 1, 2, 13, 0, 0, 0, -1 };
static const int cmu_grapheme_fv_112[] = { 0, 5, 7, 12, 11, 5, 16, 15, 1, 0, 0, -1 };
static const int cmu_grapheme_fv_113[] = { 0, 0, 1, 1, 1, 5, 16, 7, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_114[] = { 0, 0, 7, 1, 1, 0, 16, 15, 5, 0, 0, -1 };
static const int cmu_grapheme_fv_115[] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1 };
static const int cmu_grapheme_fv_116[] = { 0 };
static const int * const cmu_grapheme_fvtable[] = {
cmu_grapheme_fv_000,
cmu_grapheme_fv_001,
cmu_grapheme_fv_002,
cmu_grapheme_fv_003,
cmu_grapheme_fv_004,
cmu_grapheme_fv_005,
cmu_grapheme_fv_006,
cmu_grapheme_fv_007,
cmu_grapheme_fv_008,
cmu_grapheme_fv_009,
cmu_grapheme_fv_010,
cmu_grapheme_fv_011,
cmu_grapheme_fv_012,
cmu_grapheme_fv_013,
cmu_grapheme_fv_014,
cmu_grapheme_fv_015,
cmu_grapheme_fv_016,
cmu_grapheme_fv_017,
cmu_grapheme_fv_018,
cmu_grapheme_fv_019,
cmu_grapheme_fv_020,
cmu_grapheme_fv_021,
cmu_grapheme_fv_022,
cmu_grapheme_fv_023,
cmu_grapheme_fv_024,
cmu_grapheme_fv_025,
cmu_grapheme_fv_026,
cmu_grapheme_fv_027,
cmu_grapheme_fv_028,
cmu_grapheme_fv_029,
cmu_grapheme_fv_030,
cmu_grapheme_fv_031,
cmu_grapheme_fv_032,
cmu_grapheme_fv_033,
cmu_grapheme_fv_034,
cmu_grapheme_fv_035,
cmu_grapheme_fv_036,
cmu_grapheme_fv_037,
cmu_grapheme_fv_038,
cmu_grapheme_fv_039,
cmu_grapheme_fv_040,
cmu_grapheme_fv_041,
cmu_grapheme_fv_042,
cmu_grapheme_fv_043,
cmu_grapheme_fv_044,
cmu_grapheme_fv_045,
cmu_grapheme_fv_046,
cmu_grapheme_fv_047,
cmu_grapheme_fv_048,
cmu_grapheme_fv_049,
cmu_grapheme_fv_050,
cmu_grapheme_fv_051,
cmu_grapheme_fv_052,
cmu_grapheme_fv_053,
cmu_grapheme_fv_054,
cmu_grapheme_fv_055,
cmu_grapheme_fv_056,
cmu_grapheme_fv_057,
cmu_grapheme_fv_058,
cmu_grapheme_fv_059,
cmu_grapheme_fv_060,
cmu_grapheme_fv_061,
cmu_grapheme_fv_062,
cmu_grapheme_fv_063,
cmu_grapheme_fv_064,
cmu_grapheme_fv_065,
cmu_grapheme_fv_066,
cmu_grapheme_fv_067,
cmu_grapheme_fv_068,
cmu_grapheme_fv_069,
cmu_grapheme_fv_070,
cmu_grapheme_fv_071,
cmu_grapheme_fv_072,
cmu_grapheme_fv_073,
cmu_grapheme_fv_074,
cmu_grapheme_fv_075,
cmu_grapheme_fv_076,
cmu_grapheme_fv_077,
cmu_grapheme_fv_078,
cmu_grapheme_fv_079,
cmu_grapheme_fv_080,
cmu_grapheme_fv_081,
cmu_grapheme_fv_082,
cmu_grapheme_fv_083,
cmu_grapheme_fv_084,
cmu_grapheme_fv_085,
cmu_grapheme_fv_086,
cmu_grapheme_fv_087,
cmu_grapheme_fv_088,
cmu_grapheme_fv_089,
cmu_grapheme_fv_090,
cmu_grapheme_fv_091,
cmu_grapheme_fv_092,
cmu_grapheme_fv_093,
cmu_grapheme_fv_094,
cmu_grapheme_fv_095,
cmu_grapheme_fv_096,
cmu_grapheme_fv_097,
cmu_grapheme_fv_098,
cmu_grapheme_fv_099,
cmu_grapheme_fv_100,
cmu_grapheme_fv_101,
cmu_grapheme_fv_102,
cmu_grapheme_fv_103,
cmu_grapheme_fv_104,
cmu_grapheme_fv_105,
cmu_grapheme_fv_106,
cmu_grapheme_fv_107,
cmu_grapheme_fv_108,
cmu_grapheme_fv_109,
cmu_grapheme_fv_110,
cmu_grapheme_fv_111,
cmu_grapheme_fv_112,
cmu_grapheme_fv_113,
cmu_grapheme_fv_114,
cmu_grapheme_fv_115,
cmu_grapheme_fv_116 };
DEF_STATIC_CONST_VAL_STRING(featval_0,"-");
DEF_STATIC_CONST_VAL_STRING(featval_1,"0");
DEF_STATIC_CONST_VAL_STRING(featval_2,"s");
DEF_STATIC_CONST_VAL_STRING(featval_3,"g");
DEF_STATIC_CONST_VAL_STRING(featval_4,"v");
DEF_STATIC_CONST_VAL_STRING(featval_5,"+");
DEF_STATIC_CONST_VAL_STRING(featval_6,"2");
DEF_STATIC_CONST_VAL_STRING(featval_7,"l");
DEF_STATIC_CONST_VAL_STRING(featval_8,"d");
DEF_STATIC_CONST_VAL_STRING(featval_9,"b");
DEF_STATIC_CONST_VAL_STRING(featval_10,"f");
DEF_STATIC_CONST_VAL_STRING(featval_11,"3");
DEF_STATIC_CONST_VAL_STRING(featval_12,"1");
DEF_STATIC_CONST_VAL_STRING(featval_13,"a");
DEF_STATIC_CONST_VAL_STRING(featval_14,"n");
DEF_STATIC_CONST_VAL_STRING(featval_15,"p");
DEF_STATIC_CONST_VAL_STRING(featval_16,"r");
static const cst_val * const cmu_grapheme_featvals[] = {
(cst_val *)&featval_0,
(cst_val *)&featval_1,
(cst_val *)&featval_2,
(cst_val *)&featval_3,
(cst_val *)&featval_4,
(cst_val *)&featval_5,
(cst_val *)&featval_6,
(cst_val *)&featval_7,
(cst_val *)&featval_8,
(cst_val *)&featval_9,
(cst_val *)&featval_10,
(cst_val *)&featval_11,
(cst_val *)&featval_12,
(cst_val *)&featval_13,
(cst_val *)&featval_14,
(cst_val *)&featval_15,
(cst_val *)&featval_16,
NULL };
const cst_phoneset cmu_grapheme_phoneset = {
"cmu_grapheme",
cmu_grapheme_featnames,
cmu_grapheme_featvals,
cmu_grapheme_phonenames,
"pau",
116,
cmu_grapheme_fvtable,
0 /* not freeable */
};

View File

@ -0,0 +1,44 @@
/*******************************************************/
/** Autogenerated cart trees for us_phrasing */
/*******************************************************/
#include "cst_string.h"
#include "cst_cart.h"
#include "cst_regex.h"
#include "cmu_grapheme_phrasing_cart.h"
extern const cst_cart cmu_grapheme_phrasing_cart;
static const cst_cart_node cmu_grapheme_phrasing_cart_nodes[] = {
{ 0, CST_CART_OP_IS, CTNODE_cmu_grapheme_phrasing_NO_0000, (cst_val *)&val_0000},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 1, CST_CART_OP_IS, CTNODE_cmu_grapheme_phrasing_NO_0002, (cst_val *)&val_0002},
{ 2, CST_CART_OP_IS, CTNODE_cmu_grapheme_phrasing_NO_0003, (cst_val *)&val_0003},
{ 3, CST_CART_OP_IS, CTNODE_cmu_grapheme_phrasing_NO_0004, (cst_val *)&val_0004},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 4, CST_CART_OP_IS, CTNODE_cmu_grapheme_phrasing_NO_0006, (cst_val *)&val_0004},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0005 },
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 5, CST_CART_OP_IS, CTNODE_cmu_grapheme_phrasing_NO_0010, (cst_val *)&val_0002},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 4, CST_CART_OP_IS, CTNODE_cmu_grapheme_phrasing_NO_0012, (cst_val *)&val_0004},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0005 },
{ 255, CST_CART_OP_NONE, 0, 0}};
static const char * const cmu_grapheme_phrasing_feat_table[] = {
"R:Token.parent.n.name",
"R:Token.n.name",
"R:Token.parent.punc",
"R:Token.parent.break",
"break",
"n.name",
NULL };
const cst_cart cmu_grapheme_phrasing_cart = {
cmu_grapheme_phrasing_cart_nodes,
cmu_grapheme_phrasing_feat_table
};

View File

@ -0,0 +1,18 @@
/*******************************************************/
/** Autogenerated cart tree for cmu_grapheme_phrasing */
/** from . */
/*******************************************************/
DEF_STATIC_CONST_VAL_STRING(val_0000,"--");
DEF_STATIC_CONST_VAL_STRING(val_0001,"BB");
#define CTNODE_cmu_grapheme_phrasing_NO_0000 2
DEF_STATIC_CONST_VAL_STRING(val_0002,"0");
DEF_STATIC_CONST_VAL_STRING(val_0003,"");
DEF_STATIC_CONST_VAL_STRING(val_0004,"1");
#define CTNODE_cmu_grapheme_phrasing_NO_0004 6
#define CTNODE_cmu_grapheme_phrasing_NO_0006 8
DEF_STATIC_CONST_VAL_STRING(val_0005,"NB");
#define CTNODE_cmu_grapheme_phrasing_NO_0003 9
#define CTNODE_cmu_grapheme_phrasing_NO_0002 10
#define CTNODE_cmu_grapheme_phrasing_NO_0010 12
#define CTNODE_cmu_grapheme_phrasing_NO_0012 14

View File

@ -0,0 +1,41 @@
#!/bin/sh
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2014 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## Make a universal phoneset, and convert it to C ##
## ##
###########################################################################
cat $FESTVOXDIR/src/grapheme/sampa.top $FESTVOXDIR/src/grapheme/sampa.table $FESTVOXDIR/src/grapheme/sampa.bottom >cmu_grapheme_all_phoneset.scm
$ESTDIR/../festival/bin/festival -b $FLITEDIR/tools/make_phoneset.scm '(phonesettoC "cmu_grapheme" (car (load "cmu_grapheme_all_phoneset.scm" t)) "pau" ".")'

View File

@ -0,0 +1,57 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2013 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## grapheme lexicon and letter to sound rules ##
## ##
###########################################################################
TOP=../..
DIRNAME=lang/cmu_grapheme_lex
BUILD_DIRS =
ALL_DIRS=
H = cmu_grapheme_lex.h
SRCS = cmu_grapheme_lex.c grapheme_unitran_tables.c
SCRIPTS =
OBJS = $(SRCS:.c=.o)
SCM=
FILES = Makefile $(SCM) $(SRCS) $(H) $(SCRIPTS)
LIBNAME = flite_cmu_grapheme_lex
LOCAL_INCLUDES =
ALL =
include $(TOP)/config/common_make_rules
mapping:
${ESTDIR}/../festival/bin/festival -b ${TOP}/tools/make_ug.scm ${FESTVOXDIR}/src/grapheme/unicode_sampa_mapping.scm '(doit)'

View File

@ -0,0 +1,204 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2013 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* */
/* grapheme Lexical function */
/* */
/*************************************************************************/
#include "flite.h"
#include "cst_val.h"
#include "cst_voice.h"
#include "cst_lexicon.h"
#include "cst_ffeatures.h"
#include "cmu_grapheme_lex.h"
static int cst_find_u2sampa(char *ord)
{
int i;
/* Now this is inefficient ... */
for (i=0; i<num_unicode_sampa_mapping; i++)
if (cst_streq(ord,unicode_sampa_mapping[i][0]))
return i;
return -1;
}
static int cst_utf8_as_hex(const char *in,char *out)
{
int o;
o = cst_utf8_ord_string(in);
if ((o > 96) && (o < 123))
{
cst_sprintf(out,"let_%c",(unsigned char)o);
}
else if ((o > 64) && (o < 91))
{ /* Map uppercase to lowercase */
cst_sprintf(out,"let_%c",(unsigned char)o+32);
}
else
cst_sprintf(out,"u%04Xp",o);
return o;
}
cst_val *cmu_grapheme_lex_lts_function(const struct lexicon_struct *l,
const char *word, const char *pos,
const cst_features *feats)
{
cst_val *phones = 0;
cst_val *utflets = 0;
const cst_val *v;
char ord[10];
int i,phindex;
/* string to utf8 chars */
utflets = cst_utf8_explode(word);
for (v=utflets; v; v=val_cdr(v))
{
/* We will add the found phones in reverse order and reverse then */
/* afterwards */
cst_utf8_as_hex(val_string(val_car(v)),ord);
phindex = cst_find_u2sampa(ord);
if (phindex < 0)
printf("awb_debug no sampa %s %s\n",val_string(val_car(v)),ord);
for (i=4; (phindex>=0) && (i>0); i--)
{
if (unicode_sampa_mapping[phindex][i])
phones = cons_val(string_val(unicode_sampa_mapping[phindex][i]),
phones);
}
}
phones = val_reverse(phones);
#if 1
printf("cmu_grapheme_lex.c: word \"%s\" ",word);
val_print(stdout,phones);
printf("\n");
#endif
delete_val(utflets);
return phones;
}
cst_utterance *cmu_grapheme_postlex(cst_utterance *u)
{
return u;
}
static int cmu_grapheme_is_vowel(const char *p)
{
/* This a place holder, we know its sampa, so I should look it up */
/* in the list, not guess from typographical conventions */
if (strchr("aeiouAEIOU",p[0]) == NULL)
return FALSE;
else
return TRUE;
}
static int cmu_grapheme_contains_vowel(const cst_val *r)
{
const cst_val *x;
for (x=r; x; x=val_cdr(x))
{
if (cmu_grapheme_is_vowel(val_string(val_car(x))))
return TRUE;
}
return FALSE;
}
static int cmu_grapheme_has_vowel_in_syl(const cst_item *i)
{
const cst_item *n;
for (n=i; n; n=item_prev(n))
if (cmu_grapheme_is_vowel(ffeature_string(n,"name")))
return TRUE;
return FALSE;
}
int cmu_grapheme_syl_boundary(const cst_item *i,const cst_val *rest)
{
if (!rest)
return TRUE;
else if (!cmu_grapheme_contains_vowel(rest))
return FALSE;
else if (!cmu_grapheme_has_vowel_in_syl(i))
return FALSE;
#if 0
else if (rest && val_cdr(rest) &&
cst_streq("n",val_string(val_car(rest))) &&
!cmu_grapheme_is_vowel(val_string(val_car(rest))))
return FALSE;
else if (rest && val_cdr(rest) &&
cmu_grapheme_is_vowel(ffeature_string(i,"name")) &&
!cmu_grapheme_is_vowel(val_string(val_car(rest))) &&
!cmu_grapheme_is_vowel(val_string(val_car(val_cdr(rest)))))
return FALSE;
else if (rest && val_cdr(rest) && val_cdr(val_cdr(rest)) &&
!cmu_grapheme_is_vowel(val_string(val_car(rest))) &&
!cmu_grapheme_is_vowel(val_string(val_car(val_cdr(rest)))) &&
!cmu_grapheme_is_vowel(val_string(val_car(val_cdr(val_cdr(rest))))))
return FALSE;
else if (rest && val_cdr(rest) &&
(cst_streq(val_string(val_car(rest)),
val_string(val_car(val_cdr(rest))))))
return FALSE;
#endif
else
return TRUE;
}
cst_lexicon cmu_grapheme_lex;
cst_lexicon *cmu_grapheme_lex_init(void)
{
/* Should it be global const or dynamic */
/* Can make lts_rules just a cart tree like others */
cst_lexicon *l;
if (cmu_grapheme_lex.lts_function)
return &cmu_grapheme_lex;
l = &cmu_grapheme_lex;
l->name = cst_strdup("cmu_grapheme_lex");
l->lts_function = cmu_grapheme_lex_lts_function;
l->syl_boundary = cmu_grapheme_syl_boundary;
l->postlex = cmu_grapheme_postlex;
return l;
}

View File

@ -0,0 +1,54 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2013 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* grapheme Lexicon public functions */
/*************************************************************************/
#ifndef _cmu_grapheme_lex_h_
#define _cmu_grapheme_lex_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "cst_lexicon.h"
cst_lexicon *cmu_grapheme_lex_init(void);
extern const int num_unicode_sampa_mapping;
extern const char * const unicode_sampa_mapping[16663][5];
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
###########################################################################
## ##
## Language Technologies Institute ##
## Carnegie Mellon University ##
## Copyright (c) 2013 ##
## All Rights Reserved. ##
## ##
## Permission is hereby granted, free of charge, to use and distribute ##
## this software and its documentation without restriction, including ##
## without limitation the rights to use, copy, modify, merge, publish, ##
## distribute, sublicense, and/or sell copies of this work, and to ##
## permit persons to whom this work is furnished to do so, subject to ##
## the following conditions: ##
## 1. The code must retain the above copyright notice, this list of ##
## conditions and the following disclaimer. ##
## 2. Any modifications must be clearly marked as such. ##
## 3. Original authors' names are not deleted. ##
## 4. The authors' names are not used to endorse or promote products ##
## derived from this software without specific prior written ##
## permission. ##
## ##
## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
## THIS SOFTWARE. ##
## ##
###########################################################################
## ##
## indic general functions/models ##
## ##
###########################################################################
TOP=../..
DIRNAME=lang/cmu_indic_lang
BUILD_DIRS =
ALL_DIRS=
H = cmu_indic_lang.h cmu_indic_phrasing_cart.h \
indic_num_table.h indic_eng_num_table.h \
indic_hin_num_table.h \
indic_kan_num_table.h \
indic_mar_num_table.h \
indic_guj_num_table.h \
indic_tam_num_table.h \
indic_tel_num_table.h \
indic_pan_num_table.h
SRCS = cmu_indic_lang.c cmu_indic_phoneset.c cmu_indic_phrasing_cart.c
SCRIPTS =
OBJS = $(SRCS:.c=.o)
SCM=
FILES = Makefile $(SCM) $(SRCS) $(H) $(SCRIPTS)
LIBNAME = flite_cmu_indic_lang
LOCAL_INCLUDES =
ALL =
include $(TOP)/config/common_make_rules

View File

@ -0,0 +1,716 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2013 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* */
/* indic language support */
/* */
/*************************************************************************/
#include "flite.h"
#include "cst_val.h"
#include "cst_voice.h"
#include "cst_lexicon.h"
#include "cst_ffeatures.h"
#include "cmu_indic_lang.h"
#include "cst_tokenstream.h"
/* ./bin/compile_regexes cst_rx_eng_digits_only "^[0-9,]+$" */
static const unsigned char cst_rx_eng_digits_only_rxprog[] = {
156, 6, 0, 27, 1, 0, 3, 11, 0, 18, 4, 0, 0, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 44, 0, 2, 0, 3, 0, 0, 0,
};
static const cst_regex cst_rx_eng_digits_only_rx = {
0, 1, NULL, 0, 31,
(char *)cst_rx_eng_digits_only_rxprog
};
const cst_regex * const cst_rx_eng_digits_only = &cst_rx_eng_digits_only_rx;
/* ./bin/compile_regexes cst_rx_not_indic "^[0-9a-zA-Z/:_'-,]+$" */
static const unsigned char cst_rx_not_indic_rxprog[] = {
156, 6, 0, 87, 1, 0, 3, 11, 0, 78, 4, 0, 0, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 47, 58, 95, 39, 40,
41, 42, 43, 44, 0, 2, 0, 3, 0, 0, 0,
};
static const cst_regex cst_rx_not_indic_rx = {
0, 1, NULL, 0, 91,
(char *)cst_rx_not_indic_rxprog
};
const cst_regex * const cst_rx_not_indic = &cst_rx_not_indic_rx;
/* ./bin/compile_regexes cst_rx_indic_eng_number "^[1-9][0-9],\\([0-9][0-9],\\)*[0-9][0-9][0-9]$" */
static const unsigned char cst_rx_indic_eng_number_rxprog[] = {
156, 6, 0, 137, 1, 0, 3, 4, 0, 13, 49, 50, 51, 52, 53, 54,
55, 56, 57, 0, 4, 0, 14, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 0, 8, 0, 5, 44, 0, 6, 0, 48, 21, 0, 3, 6, 0, 36,
4, 0, 14, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 4, 0,
14, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 8, 0, 5, 44,
0, 31, 0, 3, 7, 0, 45, 6, 0, 3, 9, 0, 3, 4, 0, 14,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 4, 0, 14, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 0, 4, 0, 14, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 0, 2, 0, 3, 0, 0, 0,
};
static const cst_regex cst_rx_indic_eng_number_rx = {
0, 1, NULL, 0, 141,
(char *)cst_rx_indic_eng_number_rxprog
};
const cst_regex * const cst_rx_indic_eng_number = &cst_rx_indic_eng_number_rx;
cst_val *us_tokentowords(cst_item *token);
/* Note that's an ascii | not the devangari one */
const cst_string * const indic_postpunctuationsymbols = "\"'`.,:;!?(){}[]|";
static cst_val *cmu_indic_tokentowords_one(cst_item *token, const char *name);
cst_val *cmu_indic_tokentowords(cst_item *token) {
return cmu_indic_tokentowords_one(token, item_feat_string(token, "name"));
}
/* Indic numbers. This deals with all (quantity) numbers found in any Indic */
/* language no matter what script they are written in. We use the Indic_Nums */
/* table to convert the strings of digits (points and commas) into lists of */
/* words for those scripts' language. Thus Telugu digits get converted to */
/* Telugu words (even if the voice is a Hindi voice). */
/* We assume use lakh and crore examples when there is commas to identify */
/* thus 10,34,123 (in English digits) will be expanded to 10 lakh, thirty */
/* four thousand one hundred (and) twenty three */
/* We do English too, so I can debug it, and so lakh and crore are right */
#include "indic_eng_num_table.h"
#include "indic_hin_num_table.h"
#include "indic_guj_num_table.h"
#include "indic_kan_num_table.h"
#include "indic_mar_num_table.h"
#include "indic_tel_num_table.h"
#include "indic_tam_num_table.h"
#include "indic_pan_num_table.h"
int ts_utf8_sequence_length(char c0);
// inline int utf8_sequence_length(char c0)
// {
// Get the expected length of UTF8 sequence given its most
// significant byte
// return (( 0xE5000000 >> (( c0 >> 3 ) & 0x1E )) & 3 ) + 1;
// }
int ts_utf8_sequence_length(char c0);
// inline int utf8_sequence_length(char c0)
// {
// Get the expected length of UTF8 sequence given its most
// significant byte
// return (( 0xE5000000 >> (( c0 >> 3 ) & 0x1E )) & 3 ) + 1;
// }
int indic_digit_to_offset(const char *ind_digit)
{
/* This functions returns int value of a single digit in Indic/English scripts.
Also, it returns -1 if the character isn't a digit */
int output=-1;
int i;
int offset=-1;
i = cst_utf8_ord_string(ind_digit);
if ((i >= 0x0030) && (i <= 0x0039)) /*ASCII*/
offset = 0x0030;
if ((i >= 0x0966) && (i <= 0x096F)) /*Devanagari*/
offset = 0x0966;
if ((i >= 0x09E6) && (i <= 0x09EF)) /*Bengali*/
offset = 0x09E6;
if ((i >= 0x0A66) && (i <= 0x0A6F)) /*Gurmukhi*/
offset = 0x0A66;
if ((i >= 0x0AE6) && (i <= 0x0AEF)) /*Gujarati*/
offset = 0x0AE6;
if ((i >= 0x0B66) && (i <= 0x0B6F)) /*Oriya*/
offset = 0x0B66;
if ((i >= 0x0BE6) && (i <= 0x0BEF)) /*Tamil*/
offset = 0x0BE6;
if ((i >= 0x0C66) && (i <= 0x0C6F)) /*Telugu*/
offset = 0x0C66;
if ((i >= 0x0CE6) && (i <= 0x0CEF)) /*Kannada*/
offset = 0x0CE6;
if ((i >= 0x0D66) && (i <= 0x0D6F)) /*Malayalam*/
offset = 0x0D66;
if (offset == -1)
{
/* Not a digit */
return -1;
}
output = i - offset;
return output;
}
static cst_val *indic_number_digit(const char *digit,const indic_num_table *t)
{
int i;
if ((digit == NULL) || (t == NULL))
return NULL;
i = indic_digit_to_offset(digit);
if (i == -1)
{
printf("Error in getting int from digit %s\n", digit);
return NULL;
}
/* The ith array index corresponds to the exact single digit number*/
return cons_val(string_val(num_table_digit(t,i,1)),NULL);
}
static cst_val *indic_number_two_digit(const char *digit1,
const char *digit2,
const indic_num_table *t)
{
int i,j;
cst_val *r = NULL;
if ((digit1 == NULL) || (digit2 == NULL) || (t == NULL))
return NULL;
i = indic_digit_to_offset(digit1);
j = indic_digit_to_offset(digit2);
if (i == -1)
{
printf("Error in getting int from digit %s\n", digit1);
return NULL;
}
if (j == -1)
{
printf("Error in getting int from digit %s\n", digit2);
return NULL;
}
if (i == 0)
{
printf("Single digit erroneously processed as double digit %s\n", digit2);
return cons_val(string_val(num_table_digit(t,i,1)),NULL);
}
/*10*(i-1)+j given correct two digit index*/
if (num_table_two_digit(t,10*(i-1)+j,3) != NULL)
r = cons_val(string_val(num_table_two_digit(t,10*(i-1)+j,3)),r);
if (num_table_two_digit(t,10*(i-1)+j,2) != NULL)
r = cons_val(string_val(num_table_two_digit(t,10*(i-1)+j,2)),r);
return r;
}
static cst_val *indic_number_hundred(const indic_num_table *num_table)
{
return string_val(num_table->hundred);
}
static cst_val *indic_number_thousand(const indic_num_table *num_table)
{
return string_val(num_table->thousand);
}
static cst_val *indic_number_lakh(const indic_num_table *num_table)
{
return string_val(num_table->lakh);
}
static cst_val *indic_number_crore(const indic_num_table *num_table)
{
return string_val(num_table->crore);
}
cst_val *indic_number(const cst_val *number,
const indic_num_table *num_table)
{
cst_val *r = NULL;
/* so its a number in some script (we actually don't care which script) */
#if 0
printf("awb_debug enter indic num ");
val_print(stdout,number); printf("\n");
#endif
if (number == NULL)
r = NULL;
/* If zero is the penultimate digit */
else if ((indic_digit_to_offset(val_string(val_car(number))) == 0) &&
(val_length(number) == 2))
{
/* If the last digit is non-zero */
if (indic_digit_to_offset(val_string(val_car(val_cdr(number)))) != 0)
{
r = indic_number_digit(val_string(val_car(val_cdr(number))),num_table);
}
else
{
/* So it doesn't say zero in the end*/
}
}
/* If the current digit is a 0 and there is a next digit */
else if ((indic_digit_to_offset(val_string(val_car(number))) == 0) &&
(val_cdr(number) != NULL))
{
r = indic_number(val_cdr(number),num_table);
}
else if (val_length(number) == 1)
{
r = indic_number_digit(val_string(val_car(number)),num_table);
}
else if (val_length(number) == 2)
{
r = indic_number_two_digit(val_string(val_car(number)),
val_string(val_car(val_cdr(number))),
num_table);
}
else if (val_length(number) == 3)
{
r = val_append(indic_number_digit(val_string(val_car(number)),num_table),
cons_val(indic_number_hundred(num_table),
indic_number(val_cdr(number),num_table)));
}
else if (val_length(number) == 4)
{
r = val_append(indic_number_digit(val_string(val_car(number)),num_table),
cons_val(indic_number_thousand(num_table),
indic_number(val_cdr(number),num_table)));
}
else if (val_length(number) == 5)
{
r = val_append(indic_number_two_digit(val_string(val_car(number)),
val_string(val_car(val_cdr(number))),
num_table),
cons_val(indic_number_thousand(num_table),
indic_number(val_cdr(val_cdr(number)),num_table)));
}
else if (val_length(number) == 6)
{
r = val_append(indic_number_digit(val_string(val_car(number)),num_table),
cons_val(indic_number_lakh(num_table),
indic_number(val_cdr(number),num_table)));
}
else if (val_length(number) == 7)
{
r = val_append(indic_number_two_digit(val_string(val_car(number)),
val_string(val_car(val_cdr(number))),
num_table),
cons_val(indic_number_lakh(num_table),
indic_number(val_cdr(val_cdr(number)),num_table)));
}
else if (val_length(number) == 8)
{
r = val_append(indic_number_digit(val_string(val_car(number)),num_table),
cons_val(indic_number_crore(num_table),
indic_number(val_cdr(number),num_table)));
}
else if (val_length(number) == 9)
{
r = val_append(indic_number_two_digit(val_string(val_car(number)),
val_string(val_car(val_cdr(number))),
num_table),
cons_val(indic_number_crore(num_table),
indic_number(val_cdr(val_cdr(number)),num_table)));
}
#if 0
printf("awb_debug end of indic num ");
val_print(stdout,r); printf("\n");
#endif
return r;
}
cst_val *indic_number_indiv(const cst_val *number,
const indic_num_table *num_table)
{
cst_val *r = NULL;
/* Exapnd this as a string of digits (not an actual quantity) */
if (number == NULL)
r = NULL;
else
{
r = val_append(indic_number_digit(val_string(val_car(number)),num_table),
indic_number_indiv(val_cdr(number),num_table));
}
return r;
}
#if 0
static int indic_nump_old(const char *number)
{
/* True if all (unicode) characters are in num_table's digit table */
/* or is a comma or dot */
cst_val *p;
const cst_val *q;
int i;
int flag = TRUE;
int fflag;
p = cst_utf8_explode(number);
for (q=p; q && (flag==TRUE); q=val_cdr(q))
{
fflag = FALSE;
for (i=0; i<10; i++)
{
if (indic_digit_to_offset(val_string(val_car(q))) != -1)
{
fflag = TRUE;
break;
}
}
if ((cst_streq(val_string(val_car(q)),",")) ||
/* English zeros sometimes occur */
(cst_streq(val_string(val_car(q)),"0")))
fflag = TRUE;
flag = fflag;
}
delete_val(p); p = NULL;
return flag;
}
#endif
static int indic_nump(const char *number)
{
/* Check if non-empty string */
if (!number[0])
return FALSE;
/* Catch lone commas */
if (number[0] == ',')
return indic_nump(&number[1]);
/* Returns 2 if all characters are numbers or commas */
/* Returns 1 if it starts with a number */
cst_val *p;
const cst_val *q;
int flag = TRUE;
int fflag;
int ffflag = FALSE; /* Switches to TRUE at first digit found */
p = cst_utf8_explode(number);
for (q=p; q && (flag==TRUE); q=val_cdr(q))
{
fflag = FALSE;
if (indic_digit_to_offset(val_string(val_car(q))) != -1)
{
fflag = TRUE;
ffflag = TRUE;
}
else if (cst_streq(val_string(val_car(q)),","))
fflag = TRUE;
flag = fflag;
}
delete_val(p); p = NULL;
return flag+ffflag;
}
static int indic_hyphenated(const char *number)
{
/* Returns positive if first character is , - / and is followed by a */
/* number */
int flag = 0;
if ((number[0] == '-') || (number[0] == '/') || (number[0] == '.'))
flag = indic_nump(&number[1]);
return flag;
}
static int indic_text_splitable(const char *s,int i,int len1)
{
/* Returns true only if this and next chars are not both digits */
/* or both non-digits */
char *ccc, *ddd; /* Store this character and the next character */
int len2; /* Length of next character */
int flag;
ccc = cst_strdup(&s[i]);
ddd = cst_strdup(&s[i+len1]);
len2 = ts_utf8_sequence_length(ddd[0]);
ccc[len1] = '\0';
ddd[len2] = '\0';
/* Makeshift NOR */
flag = (indic_digit_to_offset(ccc) == -1)? !(indic_digit_to_offset(ddd) == -1):
(indic_digit_to_offset(ddd) == -1);
cst_free(ccc);
cst_free(ddd);
return flag;
}
static cst_val *indic_num_normalize(const char *number,
const indic_num_table *num_table)
{
/* Remove , */
cst_val *p, *np;
const cst_val *q;
p = cst_utf8_explode(number);
np = NULL;
for (q=p; q; q=val_cdr(q))
{
if (!cst_streq(val_string(val_car(q)),","))
np = cons_val(string_val(val_string(val_car(q))),np);
}
delete_val(p);
return val_reverse(np);
}
static cst_val *cmu_indic_tokentowords_one(cst_item *token, const char *name)
{
/* Return list of words that expand token/name */
cst_val *r, *p;
const indic_num_table *num_table;
const char *variant;
cst_utterance *utt;
/* printf("awb_debug token_name %s name %s\n",item_name(token),name); */
r = NULL;
if (item_feat_present(token,"phones"))
return cons_val(string_val(name),NULL);
#if 0
if (item_feat_present(token,"nsw"))
nsw = item_feat_string(token,"nsw");
utt = item_utt(token);
lex = val_lexicon(feat_val(utt->features,"lexicon"));
#endif
utt = item_utt(token);
variant = get_param_string(utt->features, "variant", "none");
if (cst_streq(variant,"hin"))
num_table = &hin_num_table;
else if (cst_streq(variant,"guj"))
num_table = &guj_num_table;
else if (cst_streq(variant,"kan"))
num_table = &kan_num_table;
else if (cst_streq(variant,"mar"))
num_table = &mar_num_table;
else if (cst_streq(variant,"nep"))
num_table = &hin_num_table;
else if (cst_streq(variant,"san"))
num_table = &hin_num_table;
else if (cst_streq(variant,"tel"))
num_table = &tel_num_table;
else if (cst_streq(variant,"tam"))
num_table = &tam_num_table;
else if (cst_streq(variant, "pan"))
num_table = &pan_num_table;
else
num_table = &eng_num_table;
/* This matches *English* numbers of the form 99,99,999 that require lakh
or crore expansion -- otherwise they'll be dropped back to the English
front end */
if (cst_regex_match(cst_rx_indic_eng_number,name))
{
/* remove commas */
p = indic_num_normalize(name,num_table);
if (val_length(p) <= 9)
/* Long strings of digits are read as strings of digits */
r = indic_number(p,num_table);
else
r = indic_number_indiv(p,num_table);
delete_val(p);
}
else if (indic_nump(name))
{ /* Its script specific digits (commas/dots) */
if (indic_nump(name) == 2)
{ /* All characters are digits */
// printf("nump is 2\n");
p = indic_num_normalize(name,num_table);
if (val_length(p) <= 9)
r = indic_number(p,num_table);
else
r = indic_number_indiv(p,num_table);
delete_val(p);
}
else if (indic_nump(name) == 1)
{ /* Some characters are digits */
int len = 1;
int i = 0;
char c0;
char *aaa;
char *bbb;
while(name[i] != '\0')
{
/* Iterate over UTF-8 string */
c0 = name[i];
len = ts_utf8_sequence_length(c0);
/* Check if char after this is comma */
if (name[i+len] == ',')
{
/* Skip commas */
i += len;
c0 = name[i];
len = ts_utf8_sequence_length(c0);
i += len;
continue;
}
/* Find where character type switches to or from digits */
if(indic_text_splitable(name, i, len))
break;
i +=len;
}
aaa = cst_strdup(name);
aaa[i+len] = '\0';
bbb = cst_strdup(&name[i+len]);
r = val_append(cmu_indic_tokentowords_one(token, aaa),
cmu_indic_tokentowords_one(token, bbb));
cst_free(aaa);
cst_free(bbb);
}
}
else if (indic_hyphenated(name))
{ /* For numbers seeparated by - / , */
char *aaa;
aaa = cst_strdup(&name[1]);
r = cmu_indic_tokentowords_one(token, aaa);
cst_free(aaa);
}
else if (cst_regex_match(cst_rx_not_indic,name))
/* Do English analysis on non-unicode tokens */
r = us_tokentowords(token);
else if (cst_strlen(name) > 0)
r = cons_val(string_val(name),0);
else
r = NULL;
return r;
}
int indic_utt_break(cst_tokenstream *ts,
const char *token,
cst_relation *tokens)
{
const char *postpunct = item_feat_string(relation_tail(tokens), "punc");
const char *ltoken = item_name(relation_tail(tokens));
if (cst_strchr(ts->whitespace,'\n') != cst_strrchr(ts->whitespace,'\n'))
/* contains two new lines */
return TRUE;
else if ((cst_strlen(ltoken) >= 3) &&
(cst_streq(&ltoken[cst_strlen(ltoken)-3],""))) /* devanagari '|' */
return TRUE;
else if (strchr(postpunct,':') ||
strchr(postpunct,'?') ||
strchr(postpunct,'|') || /* if ascii '|' gets used as dvngr '|' */
strchr(postpunct,'!'))
return TRUE;
else if (strchr(postpunct,'.'))
return TRUE;
else
return FALSE;
}
DEF_STATIC_CONST_VAL_STRING(val_string_zero,"0");
DEF_STATIC_CONST_VAL_STRING(val_string_one,"1");
const cst_val *is_english(const cst_item *p)
{
if (p && cst_regex_match(cst_rx_not_indic,
flite_ffeature_string(p,"name")))
return (cst_val *)&val_string_one;
else
return (cst_val *)&val_string_zero;
}
void cmu_indic_lang_init(cst_voice *v)
{
/* Set indic language stuff */
feat_set_string(v->features,"language","cmu_indic_lang");
/* utterance break function */
feat_set(v->features,"utt_break",breakfunc_val(&indic_utt_break));
/* Phoneset -- need to get this from voice */
feat_set(v->features,"phoneset",phoneset_val(&cmu_indic_phoneset));
feat_set_string(v->features,"silence",cmu_indic_phoneset.silence);
/* Get information from voice and add to lexicon */
/* Text analyser -- whitespace defaults */
feat_set_string(v->features,"text_whitespace",
cst_ts_default_whitespacesymbols);
feat_set_string(v->features,"text_prepunctuation",
cst_ts_default_prepunctuationsymbols);
/* We can't put multi-byte characters in these classes so we can't */
/* add devanagari end of sentence '|' here, but would like to -- */
/* But we do add ascii '|' to it as it sometimes gets used the same way */
feat_set_string(v->features,"text_postpunctuation",
indic_postpunctuationsymbols);
feat_set_string(v->features,"text_singlecharsymbols",
cst_ts_default_singlecharsymbols);
/* Tokenization tokenization function */
feat_set(v->features,"tokentowords_func",itemfunc_val(&cmu_indic_tokentowords));
/* Pos tagger (gpos)/induced pos */
/* Phrasing */
feat_set(v->features,"phrasing_cart",cart_val(&cmu_indic_phrasing_cart));
/* Intonation, Duration and F0 -- part of cg */
feat_set_string(v->features,"no_intonation_accent_model","1");
/* Default ffunctions (required) */
basic_ff_register(v->ffunctions);
/* Indic specific features */
ff_register(v->ffunctions, "lisp_is_english", is_english);
return;
}

View File

@ -0,0 +1,61 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2013 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* indic lang public functions */
/*************************************************************************/
#ifndef _cmu_indic_lang_h_
#define _cmu_indic_lang_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "cst_utterance.h"
#include "cst_cart.h"
#include "cst_val.h"
#include "cst_phoneset.h"
#include "cst_lexicon.h"
#include "cst_synth.h"
void cmu_indic_lang_init(cst_voice *v);
extern const cst_phoneset cmu_indic_phoneset;
extern const cst_cart cmu_indic_phrasing_cart;
extern const cst_regex * const cst_rx_not_indic;
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,400 @@
/*******************************************************/
/** Autogenerated phoneset trees for cmu_indic */
/*******************************************************/
#include "cst_string.h"
#include "cst_phoneset.h"
extern const cst_phoneset cmu_indic_phoneset;
static const char * const cmu_indic_featnames[] = {
"clst",
"vc",
"vlng",
"vheight",
"vfront",
"vrnd",
"ctype",
"cplace",
"cvox",
"asp",
"nuk",
NULL };
static const char * const cmu_indic_phonenames[] = {
"pau",
"A",
"A:",
"i",
"i:",
"u",
"uy",
"u:",
"9r=",
"lr=",
"E",
"e",
"e:",
"aI",
"o",
"o:",
"aU",
"M",
"h",
"ay",
"ow",
"k",
"kh",
"g",
"gh",
"N",
"c",
"ch",
"J",
"Jh",
"n~",
"tr",
"tR",
"dr",
"dR",
"nr",
"tB",
"tBh",
"dB",
"dBh",
"nB",
"n",
"p",
"ph",
"b",
"bh",
"m",
"j",
"9r",
"l",
"lr",
"zr",
"v",
"c}",
"sr",
"s",
"hv",
"q",
"x",
"G",
"z",
"rr",
"rrh",
"f",
"dh",
"B",
"nX",
"Anas",
"A:nas",
"inas",
"i:nas",
"unas",
"u:nas",
"enas",
"e:nas",
"aInas",
"onas",
"o:nas",
"aUnas",
"aynas",
"ownas",
"aa",
"ae",
"ah",
"ao",
"aw",
"ax",
"axr",
"d",
"eh",
"er",
"ey",
"hh",
"ih",
"iy",
"jh",
"ng",
"oy",
"r",
"sh",
"t",
"th",
"uh",
"uw",
"w",
"y",
"zh",
NULL };
static const int cmu_indic_fv_000[] = { 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, -1 };
static const int cmu_indic_fv_001[] = { 0, 2, 3, 4, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_002[] = { 0, 2, 5, 6, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_003[] = { 0, 2, 3, 7, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_004[] = { 0, 2, 5, 7, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_005[] = { 0, 2, 3, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_006[] = { 0, 2, 3, 7, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_007[] = { 0, 2, 5, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_008[] = { 0, 2, 3, 7, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_009[] = { 0, 2, 8, 4, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_010[] = { 0, 2, 9, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_011[] = { 0, 2, 3, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_012[] = { 0, 2, 5, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_013[] = { 0, 2, 8, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_014[] = { 0, 2, 3, 4, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_015[] = { 0, 2, 5, 4, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_016[] = { 0, 2, 8, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_017[] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_018[] = { 0, 0, 1, 1, 1, 1, 10, 11, 0, 2, 0, -1 };
static const int cmu_indic_fv_019[] = { 0, 2, 3, 4, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_020[] = { 0, 2, 5, 6, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_021[] = { 0, 0, 1, 1, 1, 1, 3, 11, 0, 0, 0, -1 };
static const int cmu_indic_fv_022[] = { 0, 0, 1, 1, 1, 1, 3, 11, 0, 2, 0, -1 };
static const int cmu_indic_fv_023[] = { 0, 0, 1, 1, 1, 1, 3, 11, 2, 0, 0, -1 };
static const int cmu_indic_fv_024[] = { 0, 0, 1, 1, 1, 1, 3, 11, 2, 2, 0, -1 };
static const int cmu_indic_fv_025[] = { 0, 0, 1, 1, 1, 1, 12, 11, 2, 0, 0, -1 };
static const int cmu_indic_fv_026[] = { 0, 0, 1, 1, 1, 1, 9, 13, 0, 0, 0, -1 };
static const int cmu_indic_fv_027[] = { 0, 0, 1, 1, 1, 1, 9, 13, 0, 2, 0, -1 };
static const int cmu_indic_fv_028[] = { 0, 0, 1, 1, 1, 1, 9, 13, 2, 0, 0, -1 };
static const int cmu_indic_fv_029[] = { 0, 0, 1, 1, 1, 1, 9, 13, 2, 2, 0, -1 };
static const int cmu_indic_fv_030[] = { 0, 0, 1, 1, 1, 1, 12, 13, 2, 0, 0, -1 };
static const int cmu_indic_fv_031[] = { 0, 0, 1, 1, 1, 1, 3, 9, 0, 0, 0, -1 };
static const int cmu_indic_fv_032[] = { 0, 0, 1, 1, 1, 1, 3, 9, 0, 2, 0, -1 };
static const int cmu_indic_fv_033[] = { 0, 0, 1, 1, 1, 1, 3, 9, 2, 0, 0, -1 };
static const int cmu_indic_fv_034[] = { 0, 0, 1, 1, 1, 1, 3, 9, 2, 2, 0, -1 };
static const int cmu_indic_fv_035[] = { 0, 0, 1, 1, 1, 1, 12, 9, 2, 0, 0, -1 };
static const int cmu_indic_fv_036[] = { 0, 0, 1, 1, 1, 1, 3, 8, 0, 0, 0, -1 };
static const int cmu_indic_fv_037[] = { 0, 0, 1, 1, 1, 1, 3, 8, 0, 2, 0, -1 };
static const int cmu_indic_fv_038[] = { 0, 0, 1, 1, 1, 1, 3, 8, 2, 0, 0, -1 };
static const int cmu_indic_fv_039[] = { 0, 0, 1, 1, 1, 1, 3, 8, 2, 2, 0, -1 };
static const int cmu_indic_fv_040[] = { 0, 0, 1, 1, 1, 1, 12, 8, 2, 0, 0, -1 };
static const int cmu_indic_fv_041[] = { 0, 0, 1, 1, 1, 1, 12, 9, 2, 0, 0, -1 };
static const int cmu_indic_fv_042[] = { 0, 0, 1, 1, 1, 1, 3, 5, 0, 0, 0, -1 };
static const int cmu_indic_fv_043[] = { 0, 0, 1, 1, 1, 1, 3, 5, 0, 2, 0, -1 };
static const int cmu_indic_fv_044[] = { 0, 0, 1, 1, 1, 1, 3, 5, 2, 0, 0, -1 };
static const int cmu_indic_fv_045[] = { 0, 0, 1, 1, 1, 1, 3, 5, 2, 2, 0, -1 };
static const int cmu_indic_fv_046[] = { 0, 0, 1, 1, 1, 1, 12, 5, 2, 0, 0, -1 };
static const int cmu_indic_fv_047[] = { 0, 0, 1, 1, 1, 1, 14, 13, 2, 0, 0, -1 };
static const int cmu_indic_fv_048[] = { 0, 0, 1, 1, 1, 1, 14, 9, 2, 0, 0, -1 };
static const int cmu_indic_fv_049[] = { 0, 0, 1, 1, 1, 1, 14, 8, 2, 0, 0, -1 };
static const int cmu_indic_fv_050[] = { 0, 0, 1, 1, 1, 1, 14, 9, 2, 0, 0, -1 };
static const int cmu_indic_fv_051[] = { 0, 0, 1, 1, 1, 1, 14, 9, 2, 0, 0, -1 };
static const int cmu_indic_fv_052[] = { 0, 0, 1, 1, 1, 1, 14, 5, 2, 0, 0, -1 };
static const int cmu_indic_fv_053[] = { 0, 0, 1, 1, 1, 1, 10, 13, 0, 2, 0, -1 };
static const int cmu_indic_fv_054[] = { 0, 0, 1, 1, 1, 1, 10, 9, 0, 2, 0, -1 };
static const int cmu_indic_fv_055[] = { 0, 0, 1, 1, 1, 1, 10, 8, 0, 2, 0, -1 };
static const int cmu_indic_fv_056[] = { 0, 0, 1, 1, 1, 1, 10, 11, 2, 2, 0, -1 };
static const int cmu_indic_fv_057[] = { 0, 0, 1, 1, 1, 1, 3, 15, 0, 0, 2, -1 };
static const int cmu_indic_fv_058[] = { 0, 0, 1, 1, 1, 1, 10, 15, 0, 0, 2, -1 };
static const int cmu_indic_fv_059[] = { 0, 0, 1, 1, 1, 1, 10, 15, 2, 0, 2, -1 };
static const int cmu_indic_fv_060[] = { 0, 0, 1, 1, 1, 1, 10, 8, 2, 0, 2, -1 };
static const int cmu_indic_fv_061[] = { 0, 0, 1, 1, 1, 1, 3, 9, 2, 0, 2, -1 };
static const int cmu_indic_fv_062[] = { 0, 0, 1, 1, 1, 1, 3, 9, 2, 2, 2, -1 };
static const int cmu_indic_fv_063[] = { 0, 0, 1, 1, 1, 1, 10, 16, 0, 0, 2, -1 };
static const int cmu_indic_fv_064[] = { 0, 0, 1, 1, 1, 1, 10, 8, 2, 0, 2, -1 };
static const int cmu_indic_fv_065[] = { 0, 0, 1, 1, 1, 1, 10, 5, 2, 0, 2, -1 };
static const int cmu_indic_fv_066[] = { 0, 0, 1, 1, 1, 1, 12, 11, 2, 0, 0, -1 };
static const int cmu_indic_fv_067[] = { 0, 2, 3, 4, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_068[] = { 0, 2, 5, 6, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_069[] = { 0, 2, 3, 7, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_070[] = { 0, 2, 5, 7, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_071[] = { 0, 2, 3, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_072[] = { 0, 2, 5, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_073[] = { 0, 2, 3, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_074[] = { 0, 2, 5, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_075[] = { 0, 2, 8, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_076[] = { 0, 2, 3, 4, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_077[] = { 0, 2, 5, 4, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_078[] = { 0, 2, 8, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_079[] = { 0, 2, 3, 4, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_080[] = { 0, 2, 3, 6, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_081[] = { 0, 2, 5, 6, 6, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_082[] = { 0, 2, 3, 6, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_083[] = { 0, 2, 3, 4, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_084[] = { 0, 2, 5, 6, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_085[] = { 0, 2, 8, 6, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_086[] = { 0, 2, 9, 4, 4, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_087[] = { 0, 2, 9, 4, 4, 0, 14, 9, 2, 0, 1, -1 };
static const int cmu_indic_fv_088[] = { 0, 0, 1, 1, 1, 1, 3, 9, 2, 0, 1, -1 };
static const int cmu_indic_fv_089[] = { 0, 2, 3, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_090[] = { 0, 2, 9, 4, 4, 0, 14, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_091[] = { 0, 2, 8, 4, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_092[] = { 0, 0, 1, 1, 1, 1, 10, 15, 0, 0, 1, -1 };
static const int cmu_indic_fv_093[] = { 0, 2, 3, 7, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_094[] = { 0, 2, 5, 7, 7, 0, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_095[] = { 0, 0, 1, 1, 1, 1, 9, 13, 2, 0, 1, -1 };
static const int cmu_indic_fv_096[] = { 0, 0, 1, 1, 1, 1, 12, 11, 2, 0, 1, -1 };
static const int cmu_indic_fv_097[] = { 0, 2, 8, 4, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_098[] = { 0, 0, 1, 1, 1, 1, 14, 9, 2, 0, 1, -1 };
static const int cmu_indic_fv_099[] = { 0, 0, 1, 1, 1, 1, 10, 13, 0, 0, 1, -1 };
static const int cmu_indic_fv_100[] = { 0, 0, 1, 1, 1, 1, 3, 9, 0, 0, 1, -1 };
static const int cmu_indic_fv_101[] = { 0, 0, 1, 1, 1, 1, 10, 8, 0, 0, 1, -1 };
static const int cmu_indic_fv_102[] = { 0, 2, 3, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_103[] = { 0, 2, 5, 7, 6, 2, 1, 1, 1, 0, 1, -1 };
static const int cmu_indic_fv_104[] = { 0, 0, 1, 1, 1, 1, 14, 5, 2, 0, 1, -1 };
static const int cmu_indic_fv_105[] = { 0, 0, 1, 1, 1, 1, 14, 13, 2, 0, 1, -1 };
static const int cmu_indic_fv_106[] = { 0, 0, 1, 1, 1, 1, 10, 13, 2, 0, 1, -1 };
static const int cmu_indic_fv_107[] = { 0 };
static const int * const cmu_indic_fvtable[] = {
cmu_indic_fv_000,
cmu_indic_fv_001,
cmu_indic_fv_002,
cmu_indic_fv_003,
cmu_indic_fv_004,
cmu_indic_fv_005,
cmu_indic_fv_006,
cmu_indic_fv_007,
cmu_indic_fv_008,
cmu_indic_fv_009,
cmu_indic_fv_010,
cmu_indic_fv_011,
cmu_indic_fv_012,
cmu_indic_fv_013,
cmu_indic_fv_014,
cmu_indic_fv_015,
cmu_indic_fv_016,
cmu_indic_fv_017,
cmu_indic_fv_018,
cmu_indic_fv_019,
cmu_indic_fv_020,
cmu_indic_fv_021,
cmu_indic_fv_022,
cmu_indic_fv_023,
cmu_indic_fv_024,
cmu_indic_fv_025,
cmu_indic_fv_026,
cmu_indic_fv_027,
cmu_indic_fv_028,
cmu_indic_fv_029,
cmu_indic_fv_030,
cmu_indic_fv_031,
cmu_indic_fv_032,
cmu_indic_fv_033,
cmu_indic_fv_034,
cmu_indic_fv_035,
cmu_indic_fv_036,
cmu_indic_fv_037,
cmu_indic_fv_038,
cmu_indic_fv_039,
cmu_indic_fv_040,
cmu_indic_fv_041,
cmu_indic_fv_042,
cmu_indic_fv_043,
cmu_indic_fv_044,
cmu_indic_fv_045,
cmu_indic_fv_046,
cmu_indic_fv_047,
cmu_indic_fv_048,
cmu_indic_fv_049,
cmu_indic_fv_050,
cmu_indic_fv_051,
cmu_indic_fv_052,
cmu_indic_fv_053,
cmu_indic_fv_054,
cmu_indic_fv_055,
cmu_indic_fv_056,
cmu_indic_fv_057,
cmu_indic_fv_058,
cmu_indic_fv_059,
cmu_indic_fv_060,
cmu_indic_fv_061,
cmu_indic_fv_062,
cmu_indic_fv_063,
cmu_indic_fv_064,
cmu_indic_fv_065,
cmu_indic_fv_066,
cmu_indic_fv_067,
cmu_indic_fv_068,
cmu_indic_fv_069,
cmu_indic_fv_070,
cmu_indic_fv_071,
cmu_indic_fv_072,
cmu_indic_fv_073,
cmu_indic_fv_074,
cmu_indic_fv_075,
cmu_indic_fv_076,
cmu_indic_fv_077,
cmu_indic_fv_078,
cmu_indic_fv_079,
cmu_indic_fv_080,
cmu_indic_fv_081,
cmu_indic_fv_082,
cmu_indic_fv_083,
cmu_indic_fv_084,
cmu_indic_fv_085,
cmu_indic_fv_086,
cmu_indic_fv_087,
cmu_indic_fv_088,
cmu_indic_fv_089,
cmu_indic_fv_090,
cmu_indic_fv_091,
cmu_indic_fv_092,
cmu_indic_fv_093,
cmu_indic_fv_094,
cmu_indic_fv_095,
cmu_indic_fv_096,
cmu_indic_fv_097,
cmu_indic_fv_098,
cmu_indic_fv_099,
cmu_indic_fv_100,
cmu_indic_fv_101,
cmu_indic_fv_102,
cmu_indic_fv_103,
cmu_indic_fv_104,
cmu_indic_fv_105,
cmu_indic_fv_106,
cmu_indic_fv_107 };
DEF_STATIC_CONST_VAL_STRING(featval_0,"-");
DEF_STATIC_CONST_VAL_STRING(featval_1,"0");
DEF_STATIC_CONST_VAL_STRING(featval_2,"+");
DEF_STATIC_CONST_VAL_STRING(featval_3,"s");
DEF_STATIC_CONST_VAL_STRING(featval_4,"2");
DEF_STATIC_CONST_VAL_STRING(featval_5,"l");
DEF_STATIC_CONST_VAL_STRING(featval_6,"3");
DEF_STATIC_CONST_VAL_STRING(featval_7,"1");
DEF_STATIC_CONST_VAL_STRING(featval_8,"d");
DEF_STATIC_CONST_VAL_STRING(featval_9,"a");
DEF_STATIC_CONST_VAL_STRING(featval_10,"f");
DEF_STATIC_CONST_VAL_STRING(featval_11,"v");
DEF_STATIC_CONST_VAL_STRING(featval_12,"n");
DEF_STATIC_CONST_VAL_STRING(featval_13,"p");
DEF_STATIC_CONST_VAL_STRING(featval_14,"r");
DEF_STATIC_CONST_VAL_STRING(featval_15,"g");
DEF_STATIC_CONST_VAL_STRING(featval_16,"b");
static const cst_val * const cmu_indic_featvals[] = {
(cst_val *)&featval_0,
(cst_val *)&featval_1,
(cst_val *)&featval_2,
(cst_val *)&featval_3,
(cst_val *)&featval_4,
(cst_val *)&featval_5,
(cst_val *)&featval_6,
(cst_val *)&featval_7,
(cst_val *)&featval_8,
(cst_val *)&featval_9,
(cst_val *)&featval_10,
(cst_val *)&featval_11,
(cst_val *)&featval_12,
(cst_val *)&featval_13,
(cst_val *)&featval_14,
(cst_val *)&featval_15,
(cst_val *)&featval_16,
NULL };
const cst_phoneset cmu_indic_phoneset = {
"cmu_indic",
cmu_indic_featnames,
cmu_indic_featvals,
cmu_indic_phonenames,
"pau",
107,
cmu_indic_fvtable,
0 /* not freeable */
};

View File

@ -0,0 +1,44 @@
/*******************************************************/
/** Autogenerated cart trees for us_phrasing */
/*******************************************************/
#include "cst_string.h"
#include "cst_cart.h"
#include "cst_regex.h"
#include "cmu_indic_phrasing_cart.h"
extern const cst_cart cmu_indic_phrasing_cart;
static const cst_cart_node cmu_indic_phrasing_cart_nodes[] = {
{ 0, CST_CART_OP_IS, CTNODE_cmu_indic_phrasing_NO_0000, (cst_val *)&val_0000},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 1, CST_CART_OP_IS, CTNODE_cmu_indic_phrasing_NO_0002, (cst_val *)&val_0002},
{ 2, CST_CART_OP_IS, CTNODE_cmu_indic_phrasing_NO_0003, (cst_val *)&val_0003},
{ 3, CST_CART_OP_IS, CTNODE_cmu_indic_phrasing_NO_0004, (cst_val *)&val_0004},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 4, CST_CART_OP_IS, CTNODE_cmu_indic_phrasing_NO_0006, (cst_val *)&val_0004},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0005 },
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 5, CST_CART_OP_IS, CTNODE_cmu_indic_phrasing_NO_0010, (cst_val *)&val_0002},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 4, CST_CART_OP_IS, CTNODE_cmu_indic_phrasing_NO_0012, (cst_val *)&val_0004},
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0001 },
{ 255, CST_CART_OP_NONE, 0, (cst_val *)&val_0005 },
{ 255, CST_CART_OP_NONE, 0, 0}};
static const char * const cmu_indic_phrasing_feat_table[] = {
"R:Token.parent.n.name",
"R:Token.n.name",
"R:Token.parent.punc",
"R:Token.parent.break",
"break",
"n.name",
NULL };
const cst_cart cmu_indic_phrasing_cart = {
cmu_indic_phrasing_cart_nodes,
cmu_indic_phrasing_feat_table
};

View File

@ -0,0 +1,18 @@
/*******************************************************/
/** Autogenerated cart tree for cmu_indic_phrasing */
/** from . */
/*******************************************************/
DEF_STATIC_CONST_VAL_STRING(val_0000,"--");
DEF_STATIC_CONST_VAL_STRING(val_0001,"BB");
#define CTNODE_cmu_indic_phrasing_NO_0000 2
DEF_STATIC_CONST_VAL_STRING(val_0002,"0");
DEF_STATIC_CONST_VAL_STRING(val_0003,"");
DEF_STATIC_CONST_VAL_STRING(val_0004,"1");
#define CTNODE_cmu_indic_phrasing_NO_0004 6
#define CTNODE_cmu_indic_phrasing_NO_0006 8
DEF_STATIC_CONST_VAL_STRING(val_0005,"NB");
#define CTNODE_cmu_indic_phrasing_NO_0003 9
#define CTNODE_cmu_indic_phrasing_NO_0002 10
#define CTNODE_cmu_indic_phrasing_NO_0010 12
#define CTNODE_cmu_indic_phrasing_NO_0012 14

View File

@ -0,0 +1,180 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2015 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Number pronunciation for (English) Indic */
/*************************************************************************/
#ifndef _indic_eng_num_table_h_
#define _indic_eng_num_table_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "indic_num_table.h"
static const char * const indic_eng_digit[11][2] =
{
{ "0", "zero" },
{ "1", "one" },
{ "2", "two" },
{ "3", "three" },
{ "4", "four" },
{ "5", "five" },
{ "6", "six" },
{ "7", "seven" },
{ "8", "eight" },
{ "9", "nine" },
{ NULL, NULL },
};
static const char * const indic_eng_two_digit[101][4] =
{
{ "0", "0", NULL, NULL },
{ "0", "1", "and", "one" },
{ "0", "2", "and", "two" },
{ "0", "3", "and", "three" },
{ "0", "4", "and", "four" },
{ "0", "5", "and", "five" },
{ "0", "6", "and", "six" },
{ "0", "7", "and", "seven" },
{ "0", "8", "and", "eight" },
{ "0", "9", "and", "nine" },
{ "1", "0", "ten", NULL },
{ "1", "1", "eleven", NULL },
{ "1", "2", "twelve", NULL },
{ "1", "3", "thirteen", NULL },
{ "1", "4", "fourteen", NULL },
{ "1", "5", "fifteen", NULL },
{ "1", "6", "sixteen", NULL },
{ "1", "7", "seventeen", NULL },
{ "1", "8", "eighteen", NULL },
{ "1", "9", "nineteen", NULL },
{ "2", "0", "twenty", NULL },
{ "2", "1", "twenty", "one" },
{ "2", "2", "twenty", "two" },
{ "2", "3", "twenty", "three" },
{ "2", "4", "twenty", "four" },
{ "2", "5", "twenty", "five" },
{ "2", "6", "twenty", "six" },
{ "2", "7", "twenty", "seven" },
{ "2", "8", "twenty", "eight" },
{ "2", "9", "twenty", "nine" },
{ "3", "0", "thirty", NULL },
{ "3", "1", "thirty", "one" },
{ "3", "2", "thirty", "two" },
{ "3", "3", "thirty", "three" },
{ "3", "4", "thirty", "four" },
{ "3", "5", "thirty", "five" },
{ "3", "6", "thirty", "six" },
{ "3", "7", "thirty", "seven" },
{ "3", "8", "thirty", "eight" },
{ "3", "9", "thirty", "nine" },
{ "4", "0", "forty", NULL },
{ "4", "1", "forty", "one" },
{ "4", "2", "forty", "two" },
{ "4", "3", "forty", "three" },
{ "4", "4", "forty", "four" },
{ "4", "5", "forty", "five" },
{ "4", "6", "forty", "six" },
{ "4", "7", "forty", "seven" },
{ "4", "8", "forty", "eight" },
{ "4", "9", "forty", "nine" },
{ "5", "0", "fifty", NULL },
{ "5", "1", "fifty", "one" },
{ "5", "2", "fifty", "two" },
{ "5", "3", "fifty", "three" },
{ "5", "4", "fifty", "four" },
{ "5", "5", "fifty", "five" },
{ "5", "6", "fifty", "six" },
{ "5", "7", "fifty", "seven" },
{ "5", "8", "fifty", "eight" },
{ "5", "9", "fifty", "nine" },
{ "6", "0", "sixty", NULL },
{ "6", "1", "sixty", "one" },
{ "6", "2", "sixty", "two" },
{ "6", "3", "sixty", "three" },
{ "6", "4", "sixty", "four" },
{ "6", "5", "sixty", "five" },
{ "6", "6", "sixty", "six" },
{ "6", "7", "sixty", "seven" },
{ "6", "8", "sixty", "eight" },
{ "6", "9", "sixty", "nine" },
{ "7", "0", "twenty", NULL },
{ "7", "1", "seventy", "one" },
{ "7", "2", "seventy", "two" },
{ "7", "3", "seventy", "three" },
{ "7", "4", "seventy", "four" },
{ "7", "5", "seventy", "five" },
{ "7", "6", "seventy", "six" },
{ "7", "7", "seventy", "seven" },
{ "7", "8", "seventy", "eight" },
{ "7", "9", "seventy", "nine" },
{ "8", "0", "eighty", NULL },
{ "8", "1", "eighty", "one" },
{ "8", "2", "eighty", "two" },
{ "8", "3", "eighty", "three" },
{ "8", "4", "eighty", "four" },
{ "8", "5", "eighty", "five" },
{ "8", "6", "eighty", "six" },
{ "8", "7", "eighty", "seven" },
{ "8", "8", "eighty", "eight" },
{ "8", "9", "eighty", "nine" },
{ "9", "0", "ninety", NULL },
{ "9", "1", "ninety", "one" },
{ "9", "2", "ninety", "two" },
{ "9", "3", "ninety", "three" },
{ "9", "4", "ninety", "four" },
{ "9", "5", "ninety", "five" },
{ "9", "6", "ninety", "six" },
{ "9", "7", "ninety", "seven" },
{ "9", "8", "ninety", "eight" },
{ "9", "9", "ninety", "nine" },
{ NULL, NULL },
};
const static indic_num_table eng_num_table = {
"eng",
&indic_eng_digit,
&indic_eng_two_digit,
"hundred",
"thousand",
"lakh",
"crore"
};
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,172 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2015 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Number pronunciation for (Gujarati) Indic */
/*************************************************************************/
#ifndef _indic_guj_num_table_h_
#define _indic_guj_num_table_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "indic_num_table.h"
static const char * const indic_guj_digit[11][2] =
{
{ "", "શૂન્ય" },
{ "", "એક" },
{ "", "બે" },
{ "", "ત્રણ" },
{ "", "ચાર" },
{ "", "પાંચ" },
{ "", "" },
{ "", "સાત" },
{ "", "આઠ" },
{ "", "નવ" },
{ NULL, NULL },
};
static const char * const indic_guj_two_digit[101][4] =
{
{ "", "", "દસ", NULL },
{ "", "", "અગિયાર", NULL },
{ "", "", "બાર", NULL },
{ "", "", "તેર", NULL },
{ "", "", "ચૌદ", NULL },
{ "", "", "પંદર", NULL },
{ "", "", "સોળ", NULL },
{ "", "", "સત્તર", NULL },
{ "", "", "અઢાર", NULL },
{ "", "", "ઓગણીસ", NULL },
{ "", "", "વીસ", NULL },
{ "", "", "એકવીસ", NULL },
{ "", "", "બાવીસ", NULL },
{ "", "", "ત્રેવીસ", NULL },
{ "", "", "ચોવીસ", NULL },
{ "", "", "પચ્ચીસ", NULL },
{ "", "", "છવ્વીસ", NULL },
{ "", "", "સત્તાવીસ", NULL },
{ "", "", "અઠ્ઠાવીસ", NULL },
{ "", "", "ઓગણત્રીસ", NULL },
{ "", "", "ત્રીસ", NULL },
{ "", "", "એકત્રીસ", NULL },
{ "", "", "બત્રીસ", NULL },
{ "", "", "તેત્રીસ", NULL },
{ "", "", "ચોત્રીસ", NULL },
{ "", "", "પાંત્રીસ", NULL },
{ "", "", "છત્રીસ", NULL },
{ "", "", "સાડત્રીસ", NULL },
{ "", "", "આડત્રીસ", NULL },
{ "", "", "ઓગણચાલીસ", NULL },
{ "", "", "ચાળીસ", NULL },
{ "", "", "એકતાળીસ", NULL },
{ "", "", "બેતાળીસ", NULL },
{ "", "", "તેતાળીસ", NULL },
{ "", "", "ચુંમાળીસ", NULL },
{ "", "", "પિસ્તાળીસ", NULL },
{ "", "", "છેતાળીસ", NULL },
{ "", "", "સુડતાળીસ", NULL },
{ "", "", "અડતાળીસ", NULL },
{ "", "", "ઓગણપચાસ", NULL },
{ "", "", "પચાસ", NULL },
{ "", "", "એકાવન", NULL },
{ "", "", "બાવન", NULL },
{ "", "", "ત્રેપન", NULL },
{ "", "", "ચોપન", NULL },
{ "", "", "પંચાવન", NULL },
{ "", "", "છપ્પન", NULL },
{ "", "", "સત્તાવન", NULL },
{ "", "", "અઠ્ઠાવન", NULL },
{ "", "", "ઓગણસાઠ", NULL },
{ "", "", "સાઠ", NULL },
{ "", "", "એકસઠ", NULL },
{ "", "", "બાસઠ", NULL },
{ "", "", "ત્રેસઠ", NULL },
{ "", "", "ચોસઠ", NULL },
{ "", "", "પાંસઠ", NULL },
{ "", "", "છાસઠ", NULL },
{ "", "", "સડસઠ", NULL },
{ "", "", "અડસઠ", NULL },
{ "", "", "ઓગણોતેર", NULL },
{ "", "", "સિત્તેર", NULL },
{ "", "", "એકોતેર", NULL },
{ "", "", "બોતેર", NULL },
{ "", "", "તોતેર", NULL },
{ "", "", "ચુંમોતેર", NULL },
{ "", "", "પંચોતેર", NULL },
{ "", "", "છોંતેર", NULL },
{ "", "", "સિત્યોતેર", NULL },
{ "", "", "ઇઠયોતેર", NULL },
{ "", "", "ઓગણ્યાએંશી", NULL },
{ "", "", "એંશી", NULL },
{ "", "", "એક્યાશી", NULL },
{ "", "", "બ્યાશી", NULL },
{ "", "", "ત્યાશી", NULL },
{ "", "", "ચોરાશી", NULL },
{ "", "", "પંચાશી", NULL },
{ "", "", "છ્યાશી", NULL },
{ "", "", "સત્યાશી", NULL },
{ "", "", "ઇઠયાશી", NULL },
{ "", "", "નેવ્યાશી", NULL },
{ "", "", "નેવું", NULL },
{ "", "", "એકાણું", NULL },
{ "", "", "બાણું", NULL },
{ "", "", "ત્રાણું", NULL },
{ "", "", "ચોરાણું", NULL },
{ "", "", "પંચાણું", NULL },
{ "", "", "છન્નું", NULL },
{ "", "", "સત્તાણું", NULL },
{ "", "", "અઠ્ઠાણું", NULL },
{ "", "", "નવ્વાણું", NULL },
{ NULL, NULL },
};
const static indic_num_table guj_num_table = {
"guj",
&indic_guj_digit,
&indic_guj_two_digit,
"સો", /* hundred */
"હજાર", /* thousand */
"લાખ", /* lakh */
"કરોડ઼", /* crore */
};
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,172 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2015 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Number pronunciation for (Hindi) Indic */
/*************************************************************************/
#ifndef _indic_hin_num_table_h_
#define _indic_hin_num_table_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "indic_num_table.h"
static const char * const indic_hin_digit[11][2] =
{
{ "", "शून्य" },
{ "", "एक" },
{ "", "दो" },
{ "", "तीन" },
{ "", "चार" },
{ "", "पांच" },
{ "", "छः" },
{ "", "सात" },
{ "", "आठ" },
{ "", "नौ" },
{ NULL, NULL },
};
static const char * const indic_hin_two_digit[101][4] =
{
{ "", "", "दस", NULL },
{ "", "", "ग्यारह", NULL },
{ "", "", "बारह", NULL },
{ "", "", "तेरह", NULL },
{ "", "", "चौदह", NULL },
{ "", "", "पंद्रह", NULL },
{ "", "", "सोलह", NULL },
{ "", "", "सत्रह", NULL },
{ "", "", "अट्ठारह", NULL },
{ "", "", "उन्निस", NULL },
{ "", "", "बीस", NULL },
{ "", "", "इक्कीस", NULL },
{ "", "", "बाईस", NULL },
{ "", "", "तेईस", NULL },
{ "", "", "चौबिस", NULL },
{ "", "", "पच्चीस", NULL },
{ "", "", "छब्बीस", NULL },
{ "", "", "सत्ताईस", NULL },
{ "", "", "अट्ठाईस ", NULL },
{ "", "", "उनतीस", NULL },
{ "", "", "तीस", NULL },
{ "", "", "इकतीस", NULL },
{ "", "", "बत्तीस", NULL },
{ "", "", "तैंतीस", NULL },
{ "", "", "चौंतीस", NULL },
{ "", "", "पैंतीस", NULL },
{ "", "", "छ्त्तीस", NULL },
{ "", "", "सैंतीस", NULL },
{ "", "", "अड़तीस ", NULL },
{ "", "", "उनतालीस", NULL },
{ "", "", "चालीस", NULL },
{ "", "", "इकतालीस", NULL },
{ "", "", "बयालीस", NULL },
{ "", "", "तैंतालीस", NULL },
{ "", "", "चौवालीस", NULL },
{ "", "", "पैंतालीस", NULL },
{ "", "", "छियालीस", NULL },
{ "", "", "सैंतालीस", NULL },
{ "", "", "अड़तालीस", NULL },
{ "", "", "उन्चास", NULL },
{ "", "", "पचास", NULL },
{ "", "", "इक्यावन", NULL },
{ "", "", "बावन", NULL },
{ "", "", "तिरपन", NULL },
{ "", "", "चौवन", NULL },
{ "", "", "पचपन", NULL },
{ "", "", "छप्पन", NULL },
{ "", "", "सत्तावन", NULL },
{ "", "", "अट्ठावन", NULL },
{ "", "", "उनसठ", NULL },
{ "", "", "साठ", NULL },
{ "", "", "इकसठ", NULL },
{ "", "", "बासठ", NULL },
{ "", "", "तिरसठ", NULL },
{ "", "", "चौंसठ", NULL },
{ "", "", "पैंसठ", NULL },
{ "", "", "छियासठ", NULL },
{ "", "", "सड़सठ", NULL },
{ "", "", "अड़सठ", NULL },
{ "", "", "उनहत्तर", NULL },
{ "", "", "सत्तर", NULL },
{ "", "", "इकहत्तर", NULL },
{ "", "", "बहत्तर", NULL },
{ "", "", "तिहत्तर", NULL },
{ "", "", "चौहत्तर", NULL },
{ "", "", "पचहत्तर", NULL },
{ "", "", "छिहत्तर", NULL },
{ "", "", "सतहत्तर", NULL },
{ "", "", "अठहत्तर", NULL },
{ "", "", "उनासी", NULL },
{ "", "", "अस्सी", NULL },
{ "", "", "इक्यासी", NULL },
{ "", "", "बयासी", NULL },
{ "", "", "तिरासी", NULL },
{ "", "", "चौरासी", NULL },
{ "", "", "पचासी", NULL },
{ "", "", "छियासी", NULL },
{ "", "", "सतासी", NULL },
{ "", "", "अट्ठासी", NULL },
{ "", "", "नवासी", NULL },
{ "", "", "नब्बे", NULL },
{ "", "", "इक्यानबे", NULL },
{ "", "", "बानबे", NULL },
{ "", "", "तिरानबे", NULL },
{ "", "", "चौरानबे", NULL },
{ "", "", "पचांनबे", NULL },
{ "", "", "छियानबे", NULL },
{ "", "", "सत्तानबे", NULL },
{ "", "", "अट्ठानबे", NULL },
{ "", "", "निन्यानबे", NULL },
{ NULL, NULL },
};
const static indic_num_table hin_num_table = {
"hin",
&indic_hin_digit,
&indic_hin_two_digit,
"सौ", /* hundred */
"हज़ार", /* thousand */
"लाख", /* lakh */
"करोड़", /* crore */
};
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,172 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2015 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Number pronunciation for (Kannada) Indic */
/*************************************************************************/
#ifndef _indic_kan_reg_num_table_h_
#define _indic_kan_reg_num_table_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "indic_num_table.h"
static const char * const indic_kan_digit[11][2] =
{
{ "", "ಸೊನ್ನೆ" },
{ "", "ಒಂದು" },
{ "", "ಎರಡು" },
{ "", "ಮೂರು" },
{ "", "ನಾಲಕ್ಕು" },
{ "", "ಐದು" },
{ "", "ಆರು" },
{ "", "ಏಳು" },
{ "", "ಎಂಟು" },
{ "", "ಒಂಬತ್ತು" },
{ NULL, NULL },
};
static const char * const indic_kan_two_digit[101][4] =
{
{ "", "", "ಹತ್ತು", NULL },
{ "", "", "ಹನ್ನೊಂದು", NULL },
{ "", "", "ಹನ್ನೆರಡು", NULL },
{ "", "", "ಹದಿಮೂರು", NULL },
{ "", "", "ಹದಿನಾಲ್ಕು", NULL },
{ "", "", "ಹದಿನೈದು", NULL },
{ "", "", "ಹದಿನಾರು", NULL },
{ "", "", "ಹದಿನೇಳು", NULL },
{ "", "", "ಹದಿನೆಂಟು", NULL },
{ "", "", "ಹತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ಇಪ್ಪತ್ತು", NULL },
{ "", "", "ಇಪ್ಪತ್ತೊಂದು", NULL },
{ "", "", "ಇಪ್ಪತ್ತೆರಡು", NULL },
{ "", "", "ಇಪ್ಪತ್ತಮೂರು", NULL },
{ "", "", "ಇಪ್ಪತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ಇಪ್ಪತ್ತೈದು", NULL },
{ "", "", "ಇಪ್ಪತ್ತಾರು", NULL },
{ "", "", "ಇಪ್ಪತ್ತೇಳು", NULL },
{ "", "", "ಇಪ್ಪತ್ತೆಂಟು", NULL },
{ "", "", "ಇಪ್ಪತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ಮೂವತ್ತು", NULL },
{ "", "", "ಮೂವತ್ತೊಂದು", NULL },
{ "", "", "ಮೂವತ್ತೆರಡು", NULL },
{ "", "", "ಮೂವತ್ತಮೂರು", NULL },
{ "", "", "ಮೂವತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ಮೂವತ್ತೈದು", NULL },
{ "", "", "ಮೂವತ್ತಾರು", NULL },
{ "", "", "ಮೂವತ್ತೇಳು", NULL },
{ "", "", "ಮೂವತ್ತೆಂಟು", NULL },
{ "", "", "ಮೂವತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ನಲವತ್ತು", NULL },
{ "", "", "ನಲವತ್ತೊಂದು", NULL },
{ "", "", "ನಲವತ್ತೆರಡು", NULL },
{ "", "", "ನಲವತ್ತಮೂರು", NULL },
{ "", "", "ನಲವತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ನಲವತ್ತೈದು", NULL },
{ "", "", "ನಲವತ್ತಾರು", NULL },
{ "", "", "ನಲವತ್ತೇಳು", NULL },
{ "", "", "ನಲವತ್ತೆಂಟು", NULL },
{ "", "", "ನಲವತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ಐವತ್ತು", NULL },
{ "", "", "ಐವತ್ತೊಂದು", NULL },
{ "", "", "ಐವತ್ತೆರಡು", NULL },
{ "", "", "ಐವತ್ತಮೂರು", NULL },
{ "", "", "ಐವತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ಐವತ್ತೈದು", NULL },
{ "", "", "ಐವತ್ತಾರು", NULL },
{ "", "", "ಐವತ್ತೇಳು", NULL },
{ "", "", "ಐವತ್ತೆಂಟು", NULL },
{ "", "", "ಐವತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ಅರವತ್ತು", NULL },
{ "", "", "ಅರವತ್ತೊಂದು", NULL },
{ "", "", "ಅರವತ್ತೆರಡು", NULL },
{ "", "", "ಅರವತ್ತಮೂರು", NULL },
{ "", "", "ಅರವತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ಅರವತ್ತೈದು", NULL },
{ "", "", "ಅರವತ್ತಾರು", NULL },
{ "", "", "ಅರವತ್ತೇಳು", NULL },
{ "", "", "ಅರವತ್ತೆಂಟು", NULL },
{ "", "", "ಅರವತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ಎಪ್ಪತ್ತು", NULL },
{ "", "", "ಎಪ್ಪತ್ತೊಂದು", NULL },
{ "", "", "ಎಪ್ಪತ್ತೆರಡು", NULL },
{ "", "", "ಎಪ್ಪತ್ತಮೂರು", NULL },
{ "", "", "ಎಪ್ಪತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ಎಪ್ಪತ್ತೈದು", NULL },
{ "", "", "ಎಪ್ಪತ್ತಾರು", NULL },
{ "", "", "ಎಪ್ಪತ್ತೇಳು", NULL },
{ "", "", "ಎಪ್ಪತ್ತೆಂಟು", NULL },
{ "", "", "ಎಪ್ಪತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ಎಂಬತ್ತು", NULL },
{ "", "", "ಎಂಬತ್ತೊಂದು", NULL },
{ "", "", "ಎಂಬತ್ತೆರಡು", NULL },
{ "", "", "ಎಂಬತ್ತಮೂರು", NULL },
{ "", "", "ಎಂಬತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ಎಂಬತ್ತೈದು", NULL },
{ "", "", "ಎಂಬತ್ತಾರು", NULL },
{ "", "", "ಎಂಬತ್ತೇಳು", NULL },
{ "", "", "ಎಂಬತ್ತೆಂಟು", NULL },
{ "", "", "ಎಂಬತ್ತೊಂಬತ್ತು", NULL },
{ "", "", "ತೊಂಬತ್ತು", NULL },
{ "", "", "ತೊಂಬತ್ತೊಂದು", NULL },
{ "", "", "ತೊಂಬತ್ತೆರಡು", NULL },
{ "", "", "ತೊಂಬತ್ತಮೂರು", NULL },
{ "", "", "ತೊಂಬತ್ತನಾಲ್ಕು", NULL },
{ "", "", "ತೊಂಬತ್ತೈದು", NULL },
{ "", "", "ತೊಂಬತ್ತಾರು", NULL },
{ "", "", "ತೊಂಬತ್ತೇಳು", NULL },
{ "", "", "ತೊಂಬತ್ತೆಂಟು", NULL },
{ "", "", "ತೊಂಬತ್ತೊಂಬತ್ತು", NULL },
{ NULL, NULL },
};
const static indic_num_table kan_num_table = {
"kan",
&indic_kan_digit,
&indic_kan_two_digit,
"ನೂರು", /* hundred */
"ಸಾವಿರ", /* thousand */
"ಲಕ್ಷ", /* lakh */
"ಕೋಟಿ", /* crore */
};
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,172 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2015 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Number pronunciation for (Marathi) Indic */
/*************************************************************************/
#ifndef _indic_mar_num_table_h_
#define _indic_mar_num_table_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "indic_num_table.h"
static const char * const indic_mar_digit[11][2] =
{
{ "", "शून्य" },
{ "", "एक" },
{ "", "दोन" },
{ "", "तीन" },
{ "", "चार" },
{ "", "पाच" },
{ "", "सहा" },
{ "", "सात" },
{ "", "आठ" },
{ "", "नऊ" },
{ NULL, NULL },
};
static const char * const indic_mar_two_digit[101][4] =
{
{ "", "", "दहा", NULL },
{ "", "", "अकरा", NULL },
{ "", "", "बारा", NULL },
{ "", "", "तेरा", NULL },
{ "", "", "चौदा", NULL },
{ "", "", "पंधरा", NULL },
{ "", "", "सोळा", NULL },
{ "", "", "सतरा", NULL },
{ "", "", "अठरा", NULL },
{ "", "", "एकोणीस", NULL },
{ "", "", "वीस", NULL },
{ "", "", "एकवीस", NULL },
{ "", "", "बावीस", NULL },
{ "", "", "तेवीस", NULL },
{ "", "", "चोवीस", NULL },
{ "", "", "पंचवीस", NULL },
{ "", "", "सव्वीस", NULL },
{ "", "", "सत्तावीस", NULL },
{ "", "", "अठ्ठावीस", NULL },
{ "", "", "एकोणतीस", NULL },
{ "", "", "तीस", NULL },
{ "", "", "एकतीस", NULL },
{ "", "", "बत्तीस", NULL },
{ "", "", "तेहेतीस", NULL },
{ "", "", "चौतीस", NULL },
{ "", "", "पस्तीस", NULL },
{ "", "", "छत्तीस", NULL },
{ "", "", "सदतीस", NULL },
{ "", "", "अडतीस", NULL },
{ "", "", "एकोणचाळीस", NULL },
{ "", "", "चाळीस", NULL },
{ "", "", "एक्केचाळीस", NULL },
{ "", "", "बेचाळीस", NULL },
{ "", "", "त्रेचाळीस", NULL },
{ "", "", "चव्वेचाळीस", NULL },
{ "", "", "पंचेचाळीस", NULL },
{ "", "", "सेहेचाळीस", NULL },
{ "", "", "सत्तेचाळीस", NULL },
{ "", "", "अठ्ठेचाळीस", NULL },
{ "", "", "एकोणपन्नास", NULL },
{ "", "", "पन्नास", NULL },
{ "", "", "एक्कावन्न", NULL },
{ "", "", "बावन्न", NULL },
{ "", "", "त्रेपन्न", NULL },
{ "", "", "चोपन्न", NULL },
{ "", "", "पंचावन्न", NULL },
{ "", "", "छप्पन्न", NULL },
{ "", "", "सत्तावन्न", NULL },
{ "", "", "अठ्ठावन्न", NULL },
{ "", "", "एकोणसाठ", NULL },
{ "", "", "साठ", NULL },
{ "", "", "एकसष्ठ", NULL },
{ "", "", "बासष्ठ", NULL },
{ "", "", "त्रेसष्ठ", NULL },
{ "", "", "चौसष्ठ", NULL },
{ "", "", "पासष्ठ", NULL },
{ "", "", "सहासष्ठ", NULL },
{ "", "", "सदुसष्ठ", NULL },
{ "", "", "अडुसष्ठ", NULL },
{ "", "", "एकोणसत्तर", NULL },
{ "", "", "सत्तर", NULL },
{ "", "", "एक्काहत्तर", NULL },
{ "", "", "बाहत्तर", NULL },
{ "", "", "त्र्याहत्तर", NULL },
{ "", "", "चौर्‍याहत्तर", NULL },
{ "", "", "पंच्याहत्तर", NULL },
{ "", "", "शहात्तर", NULL },
{ "", "", "सत्याहत्तर", NULL },
{ "", "", "अठ्ठ्याहत्तर", NULL },
{ "", "", "एकोणऐंशी", NULL },
{ "", "", "ऐंशी", NULL },
{ "", "", "एक्क्याऐंशी", NULL },
{ "", "", "ब्याऐंशी", NULL },
{ "", "", "त्र्याऐंशी", NULL },
{ "", "", "चौऱ्याऐंशी", NULL },
{ "", "", "पंच्याऐंशी", NULL },
{ "", "", "शहाऐंशी", NULL },
{ "", "", "सत्त्याऐंशी", NULL },
{ "", "", "अठ्ठ्याऐंशी", NULL },
{ "", "", "एकोणनव्वद", NULL },
{ "", "", "नव्वद", NULL },
{ "", "", "एक्क्याण्णव", NULL },
{ "", "", "ब्याण्णव", NULL },
{ "", "", "त्र्याण्णव", NULL },
{ "", "", "चौऱ्याण्णव", NULL },
{ "", "", "पंच्याण्णव", NULL },
{ "", "", "शहाण्णव", NULL },
{ "", "", "सत्त्याण्णव", NULL },
{ "", "", "अठ्ठ्याण्णव", NULL },
{ "", "", "नव्व्याण्णव", NULL },
{ NULL, NULL },
};
const static indic_num_table mar_num_table = {
"mar",
&indic_mar_digit,
&indic_mar_two_digit,
"शंभर", /* hundred */
"हजार", /* thousand */
"लाख", /* lakh */
"कोटी", /* crore */
};
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,63 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2015 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Number pronunciation for (English) Indic */
/*************************************************************************/
#ifndef _indic_num_table_h_
#define _indic_num_table_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef const char * const digit_table[11][2];
typedef const char * const two_digit_table[101][4];
typedef struct cst_indic_num_table_struct {
const char *lang;
digit_table *digit;
two_digit_table *two_digit;
const char *hundred;
const char *thousand;
const char *lakh;
const char *crore;
} indic_num_table;
#define num_table_digit(TABLE,I,J) ((*(TABLE->digit))[I][J])
#define num_table_two_digit(TABLE,I,J) ((*(TABLE->two_digit))[I][J])
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,173 @@
/*************************************************************************/
/* */
/* Language Technologies Institute */
/* Carnegie Mellon University */
/* Copyright (c) 2015 */
/* All Rights Reserved. */
/* */
/* Permission is hereby granted, free of charge, to use and distribute */
/* this software and its documentation without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of this work, and to */
/* permit persons to whom this work is furnished to do so, subject to */
/* the following conditions: */
/* 1. The code must retain the above copyright notice, this list of */
/* conditions and the following disclaimer. */
/* 2. Any modifications must be clearly marked as such. */
/* 3. Original authors' names are not deleted. */
/* 4. The authors' names are not used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK */
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
/* SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE */
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
/* THIS SOFTWARE. */
/* */
/*************************************************************************/
/* Number pronunciation for (pannada) Indic */
/*************************************************************************/
#ifndef _indic_pan_reg_num_table_h_
#define _indic_pan_reg_num_table_h_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "indic_num_table.h"
static const char * const indic_pan_digit[11][2] =
{
{ "", "ਸਿਫਰ" },
{ "", "ਇੱਕ" },
{ "", "ਦੋ" },
{ "", "ਤਿੱਨ" },
{ "", "ਚਾਰ" },
{ "", "ਪੰਜ" },
{ "", "ਛੇ" },
{ "", "ਸੱਤ" },
{ "", "ਅੱਠ" },
{ "", "ਨੌਂ " },
{ NULL, NULL },
};
static const char * const indic_pan_two_digit[101][4] =
{
{ "", "", "ਦਸ", NULL },
{ "", "", "ਗਿਆਰਾਂ", NULL },
{ "", "", "ਬਾਰਾਂ", NULL },
{ "", "", "ਤੇਰਾਂ", NULL },
{ "", "", "ਚੌਦਾਂ", NULL },
{ "", "", "ਪੰਦਰਾਂ", NULL },
{ "", "", "ਸੋਲਾਂ", NULL },
{ "", "", "ਸਤਾਰਾਂ", NULL },
{ "", "", "ਅਠਾਰਾਂ", NULL },
{ "", "", "ਉੱਨੀ", NULL },
{ "", "", "ਵੀਹ", NULL },
{ "", "", "ਇੱਕੀ", NULL },
{ "", "", "ਬਾਈ", NULL },
{ "", "", "ਤੇਈ", NULL },
{ "", "", "ਚੌਬੀ", NULL },
{ "", "", "ਪੱਚੀ", NULL },
{ "", "", "ਛੱਬੀ", NULL },
{ "", "", "ਸਤਾਈ", NULL },
{ "", "", "ਅਠਾਈ", NULL },
{ "", "", "ਉਨੱਤੀ", NULL },
{ "", "", "ਤੀਹ", NULL },
{ "", "", "ਇਕੱਤੀ", NULL },
{ "", "", "ਬੱਤੀ", NULL },
{ "", "", "ਤੇਤੀ", NULL },
{ "", "", "ਚੌਂਤੀ", NULL },
{ "", "", "ਪੈਂਤੀ", NULL },
{ "", "", "ਛੱਤੀ", NULL },
{ "", "", "ਸੈਂਤੀ", NULL },
{ "", "", "ਅਠੱਤੀ", NULL },
{ "", "", "ਉਨਤਾਲੀ", NULL },
{ "", "", "ਚਾਲੀ", NULL },
{ "", "", "ਇਕਤਾਲੀ", NULL },
{ "", "", "ਬਿਆਲੀ", NULL },
{ "", "", "ਤਰਤਾਈ", NULL },
{ "", "", "ਚਤਾਲੀ", NULL },
{ "", "", "ਪਨਤਾਲੀ", NULL },
{ "", "", "ਛਿਆਲੀ", NULL },
{ "", "", "ਸਨਤਾਲੀ", NULL },
{ "", "", "ਅੜਤਾਲੀ", NULL },
{ "", "", "ਉਨੰਜਾ", NULL },
{ "", "", "ਪੰਜਾਹ", NULL },
{ "", "", "ਇਕਵੰਜਾ", NULL },
{ "", "", "ਬਵੰਜਾ", NULL },
{ "", "", "ਤਰਵੰਜਾ", NULL },
{ "", "", "ਚਰਵੰਜਾ", NULL },
{ "", "", "ਪਚਵੰਜਾ", NULL },
{ "", "", "ਛਪੰਜਾ", NULL },
{ "", "", "ਸਤਵੰਜਾ", NULL },
{ "", "", "ਅਠਵੰਜਾ", NULL },
{ "", "", "ਉਣਾਠ", NULL },
{ "", "", "ਸੱਠ", NULL },
{ "", "", "ਇਕਾਹਠ", NULL },
{ "", "", "ਬਾਹਠ", NULL },
{ "", "", "ਤਰੇਂਹਠ", NULL },
{ "", "", "ਚੌਂਹਠ", NULL },
{ "", "", "ਪੈਂਹਠ", NULL },
{ "", "", "ਛਿਆਹਠ", NULL },
{ "", "", "ਸਤਾਹਠ", NULL },
{ "", "", "ਅਠਾਹਠ", NULL },
{ "", "", "ਉਣੱਤਰ", NULL },
{ "", "", "ਸੱਤਰ", NULL },
{ "", "", "ਇਕਹੱਤਰ", NULL },
{ "", "", "ਬਹੱਤਰ", NULL },
{ "", "", "ਤਹੇਤਰ", NULL },
{ "", "", "ਚੌਹੱਤਰ", NULL },
{ "", "", "ਪੰਜੱਤਰ", NULL },
{ "", "", "ਛਿਅੱਤਰ", NULL },
{ "", "", "ਸਤੱਤਰ", NULL },
{ "", "", "ਅਠੱਤਰ", NULL },
{ "", "", "ਉਣਾਸੀ", NULL },
{ "", "", "ਅੱਸੀ", NULL },
{ "", "", "ਇਕਆਸੀ", NULL },
{ "", "", "ਬਿਆਸੀ", NULL },
{ "", "", "ਤਿਰਾਸੀ", NULL },
{ "", "", "ਚੌਰਾਸੀ", NULL },
{ "", "", "ਪਚਾਸੀ", NULL },
{ "", "", "ਛਿਆਸੀ", NULL },
{ "", "", "ਸਤਾਸੀ", NULL },
{ "", "", "ਅਠਾਸੀ", NULL },
{ "", "", "ਉਨੱਨਵੇਂ", NULL },
{ "", "", "ਨੱਬੇ", NULL },
{ "", "", "ਇਕੱਨਵੇ", NULL },
{ "", "", "ਬੱਨਵੇ", NULL },
{ "", "", "ਤਰੱਨਵੇ", NULL },
{ "", "", "ਚਰੱਨਵੇ", NULL },
{ "", "", "ਪਚੱਨਵੇ", NULL },
{ "", "", "ਛਿਅੱਨਵੇ", NULL },
{ "", "", "ਸਤੱਨਵੇ", NULL },
{ "", "", "ਅਠੱਨਵੇ", NULL },
{ "", "", "ਨੜਿੱਨਵੇ", NULL },
{ NULL, NULL },
};
const static indic_num_table pan_num_table = {
"pan",
&indic_pan_digit,
&indic_pan_two_digit,
"ਸੌ", /* hundred */
"ਹਜਾਰ", /* thousand */
"ਲੱਖ", /* lakh */
"ਕਰੋੜ", /* crore */
};
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif

Some files were not shown because too many files have changed in this diff Show More