зеркало из https://github.com/mozilla/marytts.git
Merge branch 'reformat-code'
This commit is contained in:
Коммит
f88b49ae33
148
LICENSE.txt
148
LICENSE.txt
|
@ -1,74 +1,74 @@
|
||||||
MARY Software User Agreement
|
MARY Software User Agreement
|
||||||
11 April 2011
|
11 April 2011
|
||||||
|
|
||||||
MARY is licensed under the following terms.
|
MARY is licensed under the following terms.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
the Free Software Foundation, version 3 of the License.
|
the Free Software Foundation, version 3 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Applicable Licenses
|
Applicable Licenses
|
||||||
|
|
||||||
MARY is built upon a number of other open source technologies and products.
|
MARY is built upon a number of other open source technologies and products.
|
||||||
Here is a list of those products with links to their licenses.
|
Here is a list of those products with links to their licenses.
|
||||||
|
|
||||||
hts_engine: the HMM-based speech synthesis code in MARY TTS is based on HTS, ported to Java by DFKI. The original HTS can be obtained from
|
hts_engine: the HMM-based speech synthesis code in MARY TTS is based on HTS, ported to Java by DFKI. The original HTS can be obtained from
|
||||||
http://hts-engine.sourceforge.net/ -- it is released under the New and
|
http://hts-engine.sourceforge.net/ -- it is released under the New and
|
||||||
Simplified BSD License.
|
Simplified BSD License.
|
||||||
|
|
||||||
freetts: MARY uses code from FreeTTS (http://freetts.sf.net) for various
|
freetts: MARY uses code from FreeTTS (http://freetts.sf.net) for various
|
||||||
processing modules and as the source of one method for waveform synthesis.
|
processing modules and as the source of one method for waveform synthesis.
|
||||||
FreeTTS is licensed under the (BSD-style) FreeTTS license, see
|
FreeTTS is licensed under the (BSD-style) FreeTTS license, see
|
||||||
doc/licenses/freetts-license.txt.
|
doc/licenses/freetts-license.txt.
|
||||||
|
|
||||||
JTok: The JTok tokenizer from http://heartofgold.dfki.de is distributed
|
JTok: The JTok tokenizer from http://heartofgold.dfki.de is distributed
|
||||||
under the GNU Lesser General Public License, see http://www.gnu.org or
|
under the GNU Lesser General Public License, see http://www.gnu.org or
|
||||||
doc/licenses/LGPL.txt.
|
doc/licenses/LGPL.txt.
|
||||||
|
|
||||||
jsresources.jar: A few utility classes from http://www.jsresources.org
|
jsresources.jar: A few utility classes from http://www.jsresources.org
|
||||||
are distributed under the terms of the jsresources license, see
|
are distributed under the terms of the jsresources license, see
|
||||||
doc/licenses/jsresources-license.txt.
|
doc/licenses/jsresources-license.txt.
|
||||||
|
|
||||||
log4j: MARY uses log4j (http://logging.apache.org/log4j) as a logging
|
log4j: MARY uses log4j (http://logging.apache.org/log4j) as a logging
|
||||||
mechanism. log4j is distributed under the Apache Software License, see
|
mechanism. log4j is distributed under the Apache Software License, see
|
||||||
http://www.apache.org or doc/licenses/apache-software-license.txt
|
http://www.apache.org or doc/licenses/apache-software-license.txt
|
||||||
|
|
||||||
JUnit: For unit testing of the java source, mary uses JUnit
|
JUnit: For unit testing of the java source, mary uses JUnit
|
||||||
(http://junit.org). JUnit is licensed under the Common Public License, see
|
(http://junit.org). JUnit is licensed under the Common Public License, see
|
||||||
http://junit.org or doc/licenses/CPL.txt.
|
http://junit.org or doc/licenses/CPL.txt.
|
||||||
|
|
||||||
java-diff: A java diff implementation from http://www.incava.org/projects/java-diff for input-output-comparisons in the
|
java-diff: A java diff implementation from http://www.incava.org/projects/java-diff for input-output-comparisons in the
|
||||||
Mary Expert Interface. java-diff is licensed under the GNU Lesser General
|
Mary Expert Interface. java-diff is licensed under the GNU Lesser General
|
||||||
Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
|
Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
|
||||||
|
|
||||||
fast-md5: A fast md5 checksum implementation from http://www.twmacinta.com/myjava/fast_md5.php
|
fast-md5: A fast md5 checksum implementation from http://www.twmacinta.com/myjava/fast_md5.php
|
||||||
used for computing checksums after downloading voices. fast-md5 is licensed under
|
used for computing checksums after downloading voices. fast-md5 is licensed under
|
||||||
the GNU Lesser General Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
|
the GNU Lesser General Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
|
||||||
|
|
||||||
JavaOpenAIR: MARY can optionally be used as an OpenAIR component,
|
JavaOpenAIR: MARY can optionally be used as an OpenAIR component,
|
||||||
building on the JavaOpenAIR reference implementation from
|
building on the JavaOpenAIR reference implementation from
|
||||||
http://www.mindmakers.org, which is licensed under the
|
http://www.mindmakers.org, which is licensed under the
|
||||||
(BSD-style) JavaOpenAIR license, see doc/licenses/JavaOpenAIR-license.txt
|
(BSD-style) JavaOpenAIR license, see doc/licenses/JavaOpenAIR-license.txt
|
||||||
(files concerned: JavaOpenAIR.jar)
|
(files concerned: JavaOpenAIR.jar)
|
||||||
|
|
||||||
mwdumper: A tool for extracting sets of pages from a MediaWiki dump file.
|
mwdumper: A tool for extracting sets of pages from a MediaWiki dump file.
|
||||||
mwdumper is MIT-style like licensed, see http://www.mediawiki.org/wiki/Mwdumper
|
mwdumper is MIT-style like licensed, see http://www.mediawiki.org/wiki/Mwdumper
|
||||||
and for the license http://en.wikipedia.org/wiki/MIT_License.
|
and for the license http://en.wikipedia.org/wiki/MIT_License.
|
||||||
(files concerned: mwdumper-2008-04-13.jar)
|
(files concerned: mwdumper-2008-04-13.jar)
|
||||||
|
|
||||||
|
|
||||||
sgt: The Scientific Graphics Toolkit (sgt) is provided by the NOAA/PMEL/EPIC group (see http://www.epic.noaa.gov/java/sgt/) under the BSD-style EPIC license, see doc/licenses/epic-license.txt.
|
sgt: The Scientific Graphics Toolkit (sgt) is provided by the NOAA/PMEL/EPIC group (see http://www.epic.noaa.gov/java/sgt/) under the BSD-style EPIC license, see doc/licenses/epic-license.txt.
|
||||||
|
|
||||||
IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS
|
IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS
|
||||||
AND CONDITIONS PRIOR TO USE OF THIS CONTENT.
|
AND CONDITIONS PRIOR TO USE OF THIS CONTENT.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
@echo off
|
@echo off
|
||||||
set BINDIR=%~dp0
|
set BINDIR=%~dp0
|
||||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||||
java -showversion -ea "%*" -cp ".;%MARY_BASE%/lib/*" marytts.tools.redstart.Redstart
|
java -showversion -ea "%*" -cp ".;%MARY_BASE%/lib/*" marytts.tools.redstart.Redstart
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
:RESOLVE
|
:RESOLVE
|
||||||
set %2=%~f1
|
set %2=%~f1
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
@echo off
|
@echo off
|
||||||
set BINDIR=%~dp0
|
set BINDIR=%~dp0
|
||||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||||
java -showversion -ea "%*" -cp ".;%MARY_BASE%\lib\*" marytts.tools.transcription.TranscriptionGUI
|
java -showversion -ea "%*" -cp ".;%MARY_BASE%\lib\*" marytts.tools.transcription.TranscriptionGUI
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
:RESOLVE
|
:RESOLVE
|
||||||
set %2=%~f1
|
set %2=%~f1
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
@echo off
|
@echo off
|
||||||
set BINDIR=%~dp0
|
set BINDIR=%~dp0
|
||||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||||
|
|
||||||
java -showversion -ea -Dserver.host=localhost -Dserver.port=59125 -jar "%MARY_BASE%\lib\marytts-client-${project.version}-jar-with-dependencies.jar"
|
java -showversion -ea -Dserver.host=localhost -Dserver.port=59125 -jar "%MARY_BASE%\lib\marytts-client-${project.version}-jar-with-dependencies.jar"
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
:RESOLVE
|
:RESOLVE
|
||||||
set %2=%~f1
|
set %2=%~f1
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
@echo off
|
@echo off
|
||||||
set BINDIR=%~dp0
|
set BINDIR=%~dp0
|
||||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||||
java -showversion -ea -Dmary.base="%MARY_BASE%" -cp ".;%MARY_BASE%\lib\*" marytts.tools.install.InstallerGUI
|
java -showversion -ea -Dmary.base="%MARY_BASE%" -cp ".;%MARY_BASE%\lib\*" marytts.tools.install.InstallerGUI
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
:RESOLVE
|
:RESOLVE
|
||||||
set %2=%~f1
|
set %2=%~f1
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
rem Set the Mary base installation directory in an environment variable:
|
rem Set the Mary base installation directory in an environment variable:
|
||||||
set BINDIR=%~dp0
|
set BINDIR=%~dp0
|
||||||
|
|
||||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||||
|
|
||||||
set CLASSPATH=".;%MARY_BASE%\lib\*"
|
set CLASSPATH=".;%MARY_BASE%\lib\*"
|
||||||
java -showversion -ea -Xms40m -Xmx1g -cp %CLASSPATH% "-Dmary.base=%MARY_BASE%" marytts.server.Mary
|
java -showversion -ea -Xms40m -Xmx1g -cp %CLASSPATH% "-Dmary.base=%MARY_BASE%" marytts.server.Mary
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
:RESOLVE
|
:RESOLVE
|
||||||
set %2=%~f1
|
set %2=%~f1
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
|
@ -1,367 +1,367 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import socket, sys, types, getopt
|
import socket, sys, types, getopt
|
||||||
|
|
||||||
|
|
||||||
languageNames = {'de':'German',
|
languageNames = {'de':'German',
|
||||||
'en':'English',
|
'en':'English',
|
||||||
'en_US':'US English',
|
'en_US':'US English',
|
||||||
'tib':'Tibetan'}
|
'tib':'Tibetan'}
|
||||||
|
|
||||||
class MaryClient:
|
class MaryClient:
|
||||||
specificationVersion = "0.1"
|
specificationVersion = "0.1"
|
||||||
|
|
||||||
"""Python implementation of a MARY TTS client"""
|
"""Python implementation of a MARY TTS client"""
|
||||||
def __init__( self, host="cling.dfki.uni-sb.de", port=59125, profile=False, quiet=False ):
|
def __init__( self, host="cling.dfki.uni-sb.de", port=59125, profile=False, quiet=False ):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
self.quiet = quiet
|
self.quiet = quiet
|
||||||
self.allVoices = None # array of Voice objects
|
self.allVoices = None # array of Voice objects
|
||||||
self.voicesByLocaleMap = {} # Map locale strings to arrays of Voice objects
|
self.voicesByLocaleMap = {} # Map locale strings to arrays of Voice objects
|
||||||
self.allDataTypes = None # array of DataType objects
|
self.allDataTypes = None # array of DataType objects
|
||||||
self.inputDataTypes = None # array of DataType objects
|
self.inputDataTypes = None # array of DataType objects
|
||||||
self.outputDataTypes = None # array of DataType objects
|
self.outputDataTypes = None # array of DataType objects
|
||||||
self.serverExampleTexts = {}
|
self.serverExampleTexts = {}
|
||||||
self.voiceExampleTexts = {}
|
self.voiceExampleTexts = {}
|
||||||
self.serverVersionInfo = u''
|
self.serverVersionInfo = u''
|
||||||
|
|
||||||
if not self.quiet:
|
if not self.quiet:
|
||||||
sys.stderr.write( "MARY TTS Python Client %s\n" % ( self.specificationVersion ) )
|
sys.stderr.write( "MARY TTS Python Client %s\n" % ( self.specificationVersion ) )
|
||||||
try:
|
try:
|
||||||
info = self.getServerVersionInfo()
|
info = self.getServerVersionInfo()
|
||||||
except:
|
except:
|
||||||
sys.stderr.write( "Problem connecting to mary server at %s:%i\n" % ( self.host, self.port ) )
|
sys.stderr.write( "Problem connecting to mary server at %s:%i\n" % ( self.host, self.port ) )
|
||||||
raise
|
raise
|
||||||
sys.stderr.write( "Connected to %s:%i, " % ( self.host, self.port ) )
|
sys.stderr.write( "Connected to %s:%i, " % ( self.host, self.port ) )
|
||||||
sys.stderr.write( info )
|
sys.stderr.write( info )
|
||||||
sys.stderr.write( '\n' )
|
sys.stderr.write( '\n' )
|
||||||
|
|
||||||
def __getServerInfo( self, request="", marySocket=None ):
|
def __getServerInfo( self, request="", marySocket=None ):
|
||||||
"""Get answer to request from mary server. Returns a list of unicode strings,
|
"""Get answer to request from mary server. Returns a list of unicode strings,
|
||||||
each representing a line without the line break.
|
each representing a line without the line break.
|
||||||
"""
|
"""
|
||||||
closeSocket = False
|
closeSocket = False
|
||||||
if marySocket is None:
|
if marySocket is None:
|
||||||
closeSocket = True
|
closeSocket = True
|
||||||
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||||
marySocket.connect( ( self.host, self.port ) )
|
marySocket.connect( ( self.host, self.port ) )
|
||||||
assert isinstance(marySocket, socket.SocketType)
|
assert isinstance(marySocket, socket.SocketType)
|
||||||
maryFile = marySocket.makefile( 'rwb', 1 ) # read-write, line-buffered
|
maryFile = marySocket.makefile( 'rwb', 1 ) # read-write, line-buffered
|
||||||
maryFile.write( unicode( request+"\n" ).encode( 'utf-8' ) )
|
maryFile.write( unicode( request+"\n" ).encode( 'utf-8' ) )
|
||||||
result = []
|
result = []
|
||||||
while True:
|
while True:
|
||||||
got = unicode( maryFile.readline().strip(), 'utf-8' )
|
got = unicode( maryFile.readline().strip(), 'utf-8' )
|
||||||
# read until end of file or an empty line is read:
|
# read until end of file or an empty line is read:
|
||||||
if not got: break
|
if not got: break
|
||||||
result.append(got)
|
result.append(got)
|
||||||
if closeSocket:
|
if closeSocket:
|
||||||
marySocket.close()
|
marySocket.close()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def getServerVersionInfo( self ):
|
def getServerVersionInfo( self ):
|
||||||
"Get version info from server. Returns a unicode string"
|
"Get version info from server. Returns a unicode string"
|
||||||
if self.serverVersionInfo == u'':
|
if self.serverVersionInfo == u'':
|
||||||
# need to get it from server
|
# need to get it from server
|
||||||
self.serverVersionInfo = u'\n'.join(self.__getServerInfo("MARY VERSION"))
|
self.serverVersionInfo = u'\n'.join(self.__getServerInfo("MARY VERSION"))
|
||||||
return self.serverVersionInfo
|
return self.serverVersionInfo
|
||||||
|
|
||||||
def getAllDataTypes(self, locale=None):
|
def getAllDataTypes(self, locale=None):
|
||||||
"""Obtain a list of all data types known to the server. If the information is not
|
"""Obtain a list of all data types known to the server. If the information is not
|
||||||
yet available, the server is queried. This is optional information
|
yet available, the server is queried. This is optional information
|
||||||
which is not required for the normal operation of the client, but
|
which is not required for the normal operation of the client, but
|
||||||
may help to avoid incompatibilities.
|
may help to avoid incompatibilities.
|
||||||
Returns an array of DataType objects
|
Returns an array of DataType objects
|
||||||
"""
|
"""
|
||||||
if self.allDataTypes is None:
|
if self.allDataTypes is None:
|
||||||
self.__fillDataTypes()
|
self.__fillDataTypes()
|
||||||
assert self.allDataTypes is not None and len( self.allDataTypes ) > 0
|
assert self.allDataTypes is not None and len( self.allDataTypes ) > 0
|
||||||
if locale is None:
|
if locale is None:
|
||||||
return self.allDataTypes
|
return self.allDataTypes
|
||||||
else:
|
else:
|
||||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||||
return [d for d in self.allDataTypes if d.locale is None or d.locale == locale]
|
return [d for d in self.allDataTypes if d.locale is None or d.locale == locale]
|
||||||
|
|
||||||
def getInputDataTypes(self,locale=None):
|
def getInputDataTypes(self,locale=None):
|
||||||
"""Obtain a list of input data types known to the server. If the information is not
|
"""Obtain a list of input data types known to the server. If the information is not
|
||||||
yet available, the server is queried. This is optional information
|
yet available, the server is queried. This is optional information
|
||||||
which is not required for the normal operation of the client, but
|
which is not required for the normal operation of the client, but
|
||||||
may help to avoid incompatibilities.
|
may help to avoid incompatibilities.
|
||||||
Returns an arry of DataType objects
|
Returns an arry of DataType objects
|
||||||
"""
|
"""
|
||||||
if self.inputDataTypes is None:
|
if self.inputDataTypes is None:
|
||||||
self.__fillDataTypes()
|
self.__fillDataTypes()
|
||||||
assert self.inputDataTypes is not None and len( self.inputDataTypes ) > 0
|
assert self.inputDataTypes is not None and len( self.inputDataTypes ) > 0
|
||||||
if locale is None:
|
if locale is None:
|
||||||
return self.inputDataTypes
|
return self.inputDataTypes
|
||||||
else:
|
else:
|
||||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||||
return [d for d in self.inputDataTypes if d.locale is None or d.locale == locale]
|
return [d for d in self.inputDataTypes if d.locale is None or d.locale == locale]
|
||||||
|
|
||||||
def getOutputDataTypes(self, locale=None):
|
def getOutputDataTypes(self, locale=None):
|
||||||
"""Obtain a list of output data types known to the server. If the information is not
|
"""Obtain a list of output data types known to the server. If the information is not
|
||||||
yet available, the server is queried. This is optional information
|
yet available, the server is queried. This is optional information
|
||||||
which is not required for the normal operation of the client, but
|
which is not required for the normal operation of the client, but
|
||||||
may help to avoid incompatibilities.
|
may help to avoid incompatibilities.
|
||||||
Returns an arry of DataType objects
|
Returns an arry of DataType objects
|
||||||
"""
|
"""
|
||||||
if self.outputDataTypes is None:
|
if self.outputDataTypes is None:
|
||||||
self.__fillDataTypes()
|
self.__fillDataTypes()
|
||||||
assert self.outputDataTypes is not None and len( self.outputDataTypes ) > 0
|
assert self.outputDataTypes is not None and len( self.outputDataTypes ) > 0
|
||||||
if locale is None:
|
if locale is None:
|
||||||
return self.outputDataTypes
|
return self.outputDataTypes
|
||||||
else:
|
else:
|
||||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||||
return [d for d in self.outputDataTypes if d.locale is None or d.locale == locale]
|
return [d for d in self.outputDataTypes if d.locale is None or d.locale == locale]
|
||||||
|
|
||||||
|
|
||||||
def __fillDataTypes( self ):
|
def __fillDataTypes( self ):
|
||||||
self.allDataTypes = []
|
self.allDataTypes = []
|
||||||
self.inputDataTypes = []
|
self.inputDataTypes = []
|
||||||
self.outputDataTypes = []
|
self.outputDataTypes = []
|
||||||
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||||
marySocket.connect( ( self.host, self.port ) )
|
marySocket.connect( ( self.host, self.port ) )
|
||||||
# Expect a variable number of lines of the kind
|
# Expect a variable number of lines of the kind
|
||||||
# RAWMARYXML INPUT OUTPUT
|
# RAWMARYXML INPUT OUTPUT
|
||||||
# TEXT_DE LOCALE=de INPUT
|
# TEXT_DE LOCALE=de INPUT
|
||||||
# AUDIO OUTPUT
|
# AUDIO OUTPUT
|
||||||
typeStrings = self.__getServerInfo( "MARY LIST DATATYPES", marySocket )
|
typeStrings = self.__getServerInfo( "MARY LIST DATATYPES", marySocket )
|
||||||
if not typeStrings or len(typeStrings) == 0:
|
if not typeStrings or len(typeStrings) == 0:
|
||||||
raise IOError( "Could not get list of data types from Mary server" )
|
raise IOError( "Could not get list of data types from Mary server" )
|
||||||
marySocket.close()
|
marySocket.close()
|
||||||
for typeString in typeStrings:
|
for typeString in typeStrings:
|
||||||
parts = typeString.split()
|
parts = typeString.split()
|
||||||
if len( parts ) == 0:
|
if len( parts ) == 0:
|
||||||
continue
|
continue
|
||||||
name = parts[0]
|
name = parts[0]
|
||||||
isInputType = False
|
isInputType = False
|
||||||
isOutputType = False
|
isOutputType = False
|
||||||
locale = None
|
locale = None
|
||||||
for part in parts[1:]:
|
for part in parts[1:]:
|
||||||
if part[:7] == "LOCALE=":
|
if part[:7] == "LOCALE=":
|
||||||
locale = part[7:]
|
locale = part[7:]
|
||||||
elif part == "INPUT":
|
elif part == "INPUT":
|
||||||
isInputType = True
|
isInputType = True
|
||||||
elif part == "OUTPUT":
|
elif part == "OUTPUT":
|
||||||
isOutputType = True
|
isOutputType = True
|
||||||
dt = DataType( name, locale, isInputType, isOutputType )
|
dt = DataType( name, locale, isInputType, isOutputType )
|
||||||
self.allDataTypes.append( dt )
|
self.allDataTypes.append( dt )
|
||||||
if dt.isInputType:
|
if dt.isInputType:
|
||||||
self.inputDataTypes.append( dt )
|
self.inputDataTypes.append( dt )
|
||||||
if dt.isOutputType:
|
if dt.isOutputType:
|
||||||
self.outputDataTypes.append( dt )
|
self.outputDataTypes.append( dt )
|
||||||
|
|
||||||
def getVoices( self, locale=None ):
|
def getVoices( self, locale=None ):
|
||||||
"""Obtain a list of voices known to the server. If the information is not
|
"""Obtain a list of voices known to the server. If the information is not
|
||||||
yet available, the server is queried. This is optional information
|
yet available, the server is queried. This is optional information
|
||||||
which is not required for the normal operation of the client, but
|
which is not required for the normal operation of the client, but
|
||||||
may help to avoid incompatibilities.
|
may help to avoid incompatibilities.
|
||||||
Returns an array of Voice objects
|
Returns an array of Voice objects
|
||||||
"""
|
"""
|
||||||
if self.allVoices is None:
|
if self.allVoices is None:
|
||||||
self.__fillVoices()
|
self.__fillVoices()
|
||||||
assert self.allVoices is not None and len( self.allVoices ) > 0
|
assert self.allVoices is not None and len( self.allVoices ) > 0
|
||||||
if locale is None:
|
if locale is None:
|
||||||
return self.allVoices
|
return self.allVoices
|
||||||
else:
|
else:
|
||||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||||
if self.voicesByLocaleMap.has_key(locale):
|
if self.voicesByLocaleMap.has_key(locale):
|
||||||
return self.voicesByLocaleMap[locale]
|
return self.voicesByLocaleMap[locale]
|
||||||
else:
|
else:
|
||||||
raise Exception("No voices for locale '%s'" % (locale))
|
raise Exception("No voices for locale '%s'" % (locale))
|
||||||
|
|
||||||
def __fillVoices( self ):
|
def __fillVoices( self ):
|
||||||
self.allVoices = []
|
self.allVoices = []
|
||||||
self.voicesByLocaleMap = {}
|
self.voicesByLocaleMap = {}
|
||||||
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||||
marySocket.connect( ( self.host, self.port ) )
|
marySocket.connect( ( self.host, self.port ) )
|
||||||
# Expect a variable number of lines of the kind
|
# Expect a variable number of lines of the kind
|
||||||
# de7 de female
|
# de7 de female
|
||||||
# us2 en male
|
# us2 en male
|
||||||
# dfki-stadium-emo de male limited
|
# dfki-stadium-emo de male limited
|
||||||
voiceStrings = self.__getServerInfo( "MARY LIST VOICES", marySocket )
|
voiceStrings = self.__getServerInfo( "MARY LIST VOICES", marySocket )
|
||||||
if not voiceStrings or len(voiceStrings) == 0:
|
if not voiceStrings or len(voiceStrings) == 0:
|
||||||
raise IOError( "Could not get list of voices from Mary server" )
|
raise IOError( "Could not get list of voices from Mary server" )
|
||||||
marySocket.close()
|
marySocket.close()
|
||||||
for voiceString in voiceStrings:
|
for voiceString in voiceStrings:
|
||||||
parts = voiceString.split()
|
parts = voiceString.split()
|
||||||
if len( parts ) < 3:
|
if len( parts ) < 3:
|
||||||
continue
|
continue
|
||||||
name = parts[0]
|
name = parts[0]
|
||||||
locale = parts[1]
|
locale = parts[1]
|
||||||
gender = parts[2]
|
gender = parts[2]
|
||||||
domain = None
|
domain = None
|
||||||
if len( parts ) > 3:
|
if len( parts ) > 3:
|
||||||
domain = parts[3]
|
domain = parts[3]
|
||||||
voice = Voice( name, locale, gender, domain )
|
voice = Voice( name, locale, gender, domain )
|
||||||
self.allVoices.append( voice )
|
self.allVoices.append( voice )
|
||||||
localeVoices = None
|
localeVoices = None
|
||||||
if self.voicesByLocaleMap.has_key( locale ):
|
if self.voicesByLocaleMap.has_key( locale ):
|
||||||
localeVoices = self.voicesByLocaleMap[locale]
|
localeVoices = self.voicesByLocaleMap[locale]
|
||||||
else:
|
else:
|
||||||
localeVoices = []
|
localeVoices = []
|
||||||
self.voicesByLocaleMap[locale] = localeVoices
|
self.voicesByLocaleMap[locale] = localeVoices
|
||||||
localeVoices.append( voice )
|
localeVoices.append( voice )
|
||||||
|
|
||||||
def getGeneralDomainVoices( self, locale=None ):
|
def getGeneralDomainVoices( self, locale=None ):
|
||||||
"""Obtain a list of general domain voices known to the server. If the information is not
|
"""Obtain a list of general domain voices known to the server. If the information is not
|
||||||
yet available, the server is queried. This is optional information
|
yet available, the server is queried. This is optional information
|
||||||
which is not required for the normal operation of the client, but
|
which is not required for the normal operation of the client, but
|
||||||
may help to avoid incompatibilities.
|
may help to avoid incompatibilities.
|
||||||
Returns an array of Voice objects
|
Returns an array of Voice objects
|
||||||
"""
|
"""
|
||||||
return [v for v in self.getVoices( locale ) if not v.isLimitedDomain]
|
return [v for v in self.getVoices( locale ) if not v.isLimitedDomain]
|
||||||
|
|
||||||
def getLimitedDomainVoices( self, locale=None ):
|
def getLimitedDomainVoices( self, locale=None ):
|
||||||
"""Obtain a list of limited domain voices known to the server. If the information is not
|
"""Obtain a list of limited domain voices known to the server. If the information is not
|
||||||
yet available, the server is queried. This is optional information
|
yet available, the server is queried. This is optional information
|
||||||
which is not required for the normal operation of the client, but
|
which is not required for the normal operation of the client, but
|
||||||
may help to avoid incompatibilities.
|
may help to avoid incompatibilities.
|
||||||
Returns an array of Voice objects
|
Returns an array of Voice objects
|
||||||
"""
|
"""
|
||||||
return [v for v in self.getVoices( locale ) if v.isLimitedDomain]
|
return [v for v in self.getVoices( locale ) if v.isLimitedDomain]
|
||||||
|
|
||||||
def getAvailableLanguages(self):
|
def getAvailableLanguages(self):
|
||||||
""" Check available voices and return a list of tuples (abbrev, name)
|
""" Check available voices and return a list of tuples (abbrev, name)
|
||||||
representing the available languages -- e.g. [('en', 'English'),('de', 'German')].
|
representing the available languages -- e.g. [('en', 'English'),('de', 'German')].
|
||||||
"""
|
"""
|
||||||
if self.allVoices is None:
|
if self.allVoices is None:
|
||||||
self.__fillVoices()
|
self.__fillVoices()
|
||||||
assert self.allVoices is not None and len( self.allVoices ) > 0
|
assert self.allVoices is not None and len( self.allVoices ) > 0
|
||||||
languages = []
|
languages = []
|
||||||
for l in self.voicesByLocaleMap.keys():
|
for l in self.voicesByLocaleMap.keys():
|
||||||
if languageNames.has_key(l):
|
if languageNames.has_key(l):
|
||||||
languages.append((l,languageNames[l]))
|
languages.append((l,languageNames[l]))
|
||||||
else:
|
else:
|
||||||
languages.append((l, l))
|
languages.append((l, l))
|
||||||
return languages
|
return languages
|
||||||
|
|
||||||
def getServerExampleText( self, dataType ):
|
def getServerExampleText( self, dataType ):
|
||||||
"""Request an example text for a given data type from the server.
|
"""Request an example text for a given data type from the server.
|
||||||
dataType the string representation of the data type,
|
dataType the string representation of the data type,
|
||||||
e.g. "RAWMARYXML". This is optional information
|
e.g. "RAWMARYXML". This is optional information
|
||||||
which is not required for the normal operation of the client, but
|
which is not required for the normal operation of the client, but
|
||||||
may help to avoid incompatibilities."""
|
may help to avoid incompatibilities."""
|
||||||
if not self.serverExampleTexts.has_key( dataType ):
|
if not self.serverExampleTexts.has_key( dataType ):
|
||||||
exampleTexts = self.__getServerInfo( "MARY EXAMPLETEXT %s" % ( dataType ) )
|
exampleTexts = self.__getServerInfo( "MARY EXAMPLETEXT %s" % ( dataType ) )
|
||||||
if not exampleTexts or len(exampleTexts) == 0:
|
if not exampleTexts or len(exampleTexts) == 0:
|
||||||
raise IOError( "Could not get example text for type '%s' from Mary server" % (dataType))
|
raise IOError( "Could not get example text for type '%s' from Mary server" % (dataType))
|
||||||
exampleText = u'\n'.join(exampleTexts)
|
exampleText = u'\n'.join(exampleTexts)
|
||||||
self.serverExampleTexts[dataType] = exampleText
|
self.serverExampleTexts[dataType] = exampleText
|
||||||
return self.serverExampleTexts[dataType]
|
return self.serverExampleTexts[dataType]
|
||||||
|
|
||||||
def process( self, input, inputType, outputType, audioType=None, defaultVoiceName=None, output=sys.stdout ):
|
def process( self, input, inputType, outputType, audioType=None, defaultVoiceName=None, output=sys.stdout ):
|
||||||
assert type( input ) in types.StringTypes
|
assert type( input ) in types.StringTypes
|
||||||
assert type( inputType ) in types.StringTypes
|
assert type( inputType ) in types.StringTypes
|
||||||
assert type( outputType ) in types.StringTypes
|
assert type( outputType ) in types.StringTypes
|
||||||
assert audioType is None or type( audioType ) in types.StringTypes
|
assert audioType is None or type( audioType ) in types.StringTypes
|
||||||
assert defaultVoiceName is None or type( defaultVoiceName ) in types.StringTypes
|
assert defaultVoiceName is None or type( defaultVoiceName ) in types.StringTypes
|
||||||
assert callable( getattr( output, 'write' ) )
|
assert callable( getattr( output, 'write' ) )
|
||||||
if type( input ) != types.UnicodeType:
|
if type( input ) != types.UnicodeType:
|
||||||
input = unicode( input, 'utf-8' )
|
input = unicode( input, 'utf-8' )
|
||||||
maryInfoSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
maryInfoSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||||
maryInfoSocket.connect( ( self.host, self.port ) )
|
maryInfoSocket.connect( ( self.host, self.port ) )
|
||||||
assert type( maryInfoSocket ) is socket.SocketType
|
assert type( maryInfoSocket ) is socket.SocketType
|
||||||
maryInfo = maryInfoSocket.makefile( 'rwb', 1 ) # read-write, line-buffered
|
maryInfo = maryInfoSocket.makefile( 'rwb', 1 ) # read-write, line-buffered
|
||||||
maryInfo.write( unicode( "MARY IN=%s OUT=%s" % ( inputType, outputType ), 'utf-8' ) )
|
maryInfo.write( unicode( "MARY IN=%s OUT=%s" % ( inputType, outputType ), 'utf-8' ) )
|
||||||
if audioType:
|
if audioType:
|
||||||
maryInfo.write( unicode( " AUDIO=%s" % ( audioType ), 'utf-8' ) )
|
maryInfo.write( unicode( " AUDIO=%s" % ( audioType ), 'utf-8' ) )
|
||||||
if defaultVoiceName:
|
if defaultVoiceName:
|
||||||
maryInfo.write( unicode( " VOICE=%s" % ( defaultVoiceName ), 'utf-8' ) )
|
maryInfo.write( unicode( " VOICE=%s" % ( defaultVoiceName ), 'utf-8' ) )
|
||||||
maryInfo.write( "\r\n" )
|
maryInfo.write( "\r\n" )
|
||||||
# Receive a request ID:
|
# Receive a request ID:
|
||||||
id = maryInfo.readline()
|
id = maryInfo.readline()
|
||||||
maryDataSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
maryDataSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||||
maryDataSocket.connect( ( self.host, self.port ) )
|
maryDataSocket.connect( ( self.host, self.port ) )
|
||||||
assert type( maryDataSocket ) is socket.SocketType
|
assert type( maryDataSocket ) is socket.SocketType
|
||||||
maryDataSocket.sendall( id ) # includes newline
|
maryDataSocket.sendall( id ) # includes newline
|
||||||
maryDataSocket.sendall( input.encode( 'utf-8' ) )
|
maryDataSocket.sendall( input.encode( 'utf-8' ) )
|
||||||
maryDataSocket.shutdown( 1 ) # shutdown writing
|
maryDataSocket.shutdown( 1 ) # shutdown writing
|
||||||
# Set mary info socket to non-blocking, so we only read somthing
|
# Set mary info socket to non-blocking, so we only read somthing
|
||||||
# if there is something to read:
|
# if there is something to read:
|
||||||
maryInfoSocket.setblocking( 0 )
|
maryInfoSocket.setblocking( 0 )
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
err = maryInfoSocket.recv( 8192 )
|
err = maryInfoSocket.recv( 8192 )
|
||||||
if err: sys.stderr.write( err )
|
if err: sys.stderr.write( err )
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
got = maryDataSocket.recv( 8192 )
|
got = maryDataSocket.recv( 8192 )
|
||||||
if not got: break
|
if not got: break
|
||||||
output.write( got )
|
output.write( got )
|
||||||
maryInfoSocket.setblocking( 1 )
|
maryInfoSocket.setblocking( 1 )
|
||||||
while True:
|
while True:
|
||||||
err = maryInfoSocket.recv( 8192 )
|
err = maryInfoSocket.recv( 8192 )
|
||||||
if not err: break
|
if not err: break
|
||||||
sys.stderr.write( err )
|
sys.stderr.write( err )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################ data representation classes ##################
|
################ data representation classes ##################
|
||||||
|
|
||||||
class DataType:
|
class DataType:
|
||||||
def __init__( self, name, locale=None, isInputType=False, isOutputType=False ):
|
def __init__( self, name, locale=None, isInputType=False, isOutputType=False ):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.locale = locale
|
self.locale = locale
|
||||||
self.isInputType = isInputType
|
self.isInputType = isInputType
|
||||||
self.isOutputType = isOutputType
|
self.isOutputType = isOutputType
|
||||||
|
|
||||||
def isTextType( self ):
|
def isTextType( self ):
|
||||||
return self.name != "AUDIO"
|
return self.name != "AUDIO"
|
||||||
|
|
||||||
class Voice:
|
class Voice:
|
||||||
|
|
||||||
def __init__( self, name, locale, gender, domain="general" ):
|
def __init__( self, name, locale, gender, domain="general" ):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.locale = locale
|
self.locale = locale
|
||||||
self.gender = gender
|
self.gender = gender
|
||||||
self.domain = domain
|
self.domain = domain
|
||||||
if not domain or domain == "general":
|
if not domain or domain == "general":
|
||||||
self.isLimitedDomain = False
|
self.isLimitedDomain = False
|
||||||
else:
|
else:
|
||||||
self.isLimitedDomain = True
|
self.isLimitedDomain = True
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if languageNames.has_key(self.locale):
|
if languageNames.has_key(self.locale):
|
||||||
langName = languageNames[self.locale]
|
langName = languageNames[self.locale]
|
||||||
else:
|
else:
|
||||||
langName = self.locale
|
langName = self.locale
|
||||||
if self.isLimitedDomain:
|
if self.isLimitedDomain:
|
||||||
return "%s (%s, %s %s)" % (self.name, self.domain, langName, self.gender)
|
return "%s (%s, %s %s)" % (self.name, self.domain, langName, self.gender)
|
||||||
else:
|
else:
|
||||||
return "%s (%s %s)" % (self.name, langName, self.gender)
|
return "%s (%s %s)" % (self.name, langName, self.gender)
|
||||||
|
|
||||||
##################### Main #########################
|
##################### Main #########################
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
serverHost = "cling.dfki.uni-sb.de"
|
serverHost = "cling.dfki.uni-sb.de"
|
||||||
serverPort = 59125
|
serverPort = 59125
|
||||||
inputType = "TEXT"
|
inputType = "TEXT"
|
||||||
outputType = "AUDIO"
|
outputType = "AUDIO"
|
||||||
audioType = "WAVE"
|
audioType = "WAVE"
|
||||||
defaultVoice = None
|
defaultVoice = None
|
||||||
inputEncoding = 'utf-8'
|
inputEncoding = 'utf-8'
|
||||||
( options, rest ) = getopt.getopt( sys.argv[1:], '', \
|
( options, rest ) = getopt.getopt( sys.argv[1:], '', \
|
||||||
['server.host=', 'server.port=', 'input.type=', 'output.type=', \
|
['server.host=', 'server.port=', 'input.type=', 'output.type=', \
|
||||||
'audio.type=', 'voice.default=', 'input.encoding='] )
|
'audio.type=', 'voice.default=', 'input.encoding='] )
|
||||||
for ( option, value ) in options:
|
for ( option, value ) in options:
|
||||||
if option == '--server.host': serverHost = value
|
if option == '--server.host': serverHost = value
|
||||||
elif option == '--server.port': serverPort = int( value )
|
elif option == '--server.port': serverPort = int( value )
|
||||||
elif option == '--input.type': inputType = value
|
elif option == '--input.type': inputType = value
|
||||||
elif option == '--output.type': outputType = value
|
elif option == '--output.type': outputType = value
|
||||||
elif option == '--audio.type': audioType = value
|
elif option == '--audio.type': audioType = value
|
||||||
elif option == '--voice.default': defaultVoice = value
|
elif option == '--voice.default': defaultVoice = value
|
||||||
elif option == '--input.encoding': inputEncoding = value
|
elif option == '--input.encoding': inputEncoding = value
|
||||||
if len( rest )>0: # have input file
|
if len( rest )>0: # have input file
|
||||||
inputFile = file( rest[0] )
|
inputFile = file( rest[0] )
|
||||||
else:
|
else:
|
||||||
inputFile = sys.stdin
|
inputFile = sys.stdin
|
||||||
input = unicode( ''.join( inputFile.readlines() ), inputEncoding )
|
input = unicode( ''.join( inputFile.readlines() ), inputEncoding )
|
||||||
if len( rest )>1: # also have output file
|
if len( rest )>1: # also have output file
|
||||||
outputFile = file( rest[1] )
|
outputFile = file( rest[1] )
|
||||||
else:
|
else:
|
||||||
outputFile = sys.stdout
|
outputFile = sys.stdout
|
||||||
|
|
||||||
maryClient = MaryClient( serverHost, serverPort )
|
maryClient = MaryClient( serverHost, serverPort )
|
||||||
maryClient.process( input, inputType, outputType, audioType, defaultVoice, outputFile )
|
maryClient.process( input, inputType, outputType, audioType, defaultVoice, outputFile )
|
||||||
|
|
|
@ -1,102 +1,102 @@
|
||||||
/**
|
/**
|
||||||
* Copyright 2000-2006 DFKI GmbH.
|
* Copyright 2000-2006 DFKI GmbH.
|
||||||
* All Rights Reserved. Use is subject to license terms.
|
* All Rights Reserved. Use is subject to license terms.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to use and distribute
|
* Permission is hereby granted, free of charge, to use and distribute
|
||||||
* this software and its documentation without restriction, including
|
* this software and its documentation without restriction, including
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
* distribute, sublicense, and/or sell copies of this work, and to
|
* distribute, sublicense, and/or sell copies of this work, and to
|
||||||
* permit persons to whom this work is furnished to do so, subject to
|
* permit persons to whom this work is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* 1. The code must retain the above copyright notice, this list of
|
* 1. The code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
* 2. Any modifications must be clearly marked as such.
|
* 2. Any modifications must be clearly marked as such.
|
||||||
* 3. Original authors' names are not deleted.
|
* 3. Original authors' names are not deleted.
|
||||||
* 4. The authors' names are not used to endorse or promote products
|
* 4. The authors' names are not used to endorse or promote products
|
||||||
* derived from this software without specific prior written
|
* derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
* THIS SOFTWARE.
|
* THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioInputStream;
|
import javax.sound.sampled.AudioInputStream;
|
||||||
import javax.sound.sampled.AudioSystem;
|
import javax.sound.sampled.AudioSystem;
|
||||||
import javax.sound.sampled.LineEvent;
|
import javax.sound.sampled.LineEvent;
|
||||||
import javax.sound.sampled.LineListener;
|
import javax.sound.sampled.LineListener;
|
||||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||||
|
|
||||||
import marytts.util.data.audio.AudioPlayer;
|
import marytts.util.data.audio.AudioPlayer;
|
||||||
import marytts.client.MaryClient;
|
import marytts.client.MaryClient;
|
||||||
import marytts.util.http.Address;
|
import marytts.util.http.Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A demo class illustrating how to use the MaryClient class.
|
* A demo class illustrating how to use the MaryClient class.
|
||||||
* This will connect to a MARY server, version 4.x.
|
* This will connect to a MARY server, version 4.x.
|
||||||
* It requires maryclient.jar from MARY 4.0.
|
* It requires maryclient.jar from MARY 4.0.
|
||||||
* This works transparently with MARY servers in both http and socket server mode.
|
* This works transparently with MARY servers in both http and socket server mode.
|
||||||
*
|
*
|
||||||
* Compile this as follows:
|
* Compile this as follows:
|
||||||
* <code>javac -cp maryclient.jar MaryClientUser.java</code>
|
* <code>javac -cp maryclient.jar MaryClientUser.java</code>
|
||||||
*
|
*
|
||||||
* And run as:
|
* And run as:
|
||||||
* <code>java -cp .:maryclient.jar MaryClientUser</code>
|
* <code>java -cp .:maryclient.jar MaryClientUser</code>
|
||||||
*
|
*
|
||||||
* @author marc
|
* @author marc
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MaryClientUser {
|
public class MaryClientUser {
|
||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
throws IOException, UnknownHostException, UnsupportedAudioFileException,
|
throws IOException, UnknownHostException, UnsupportedAudioFileException,
|
||||||
InterruptedException
|
InterruptedException
|
||||||
{
|
{
|
||||||
String serverHost = System.getProperty("server.host", "cling.dfki.uni-sb.de");
|
String serverHost = System.getProperty("server.host", "cling.dfki.uni-sb.de");
|
||||||
int serverPort = Integer.getInteger("server.port", 59125).intValue();
|
int serverPort = Integer.getInteger("server.port", 59125).intValue();
|
||||||
MaryClient mary = MaryClient.getMaryClient(new Address(serverHost, serverPort));
|
MaryClient mary = MaryClient.getMaryClient(new Address(serverHost, serverPort));
|
||||||
String text = "Willkommen in der Welt der Sprachsynthese!";
|
String text = "Willkommen in der Welt der Sprachsynthese!";
|
||||||
// If the given locale is not supported by the server, it returns
|
// If the given locale is not supported by the server, it returns
|
||||||
// an ambigous exception: "Problem processing the data."
|
// an ambigous exception: "Problem processing the data."
|
||||||
String locale = "de"; // or US English (en-US), Telugu (te), Turkish (tr), ...
|
String locale = "de"; // or US English (en-US), Telugu (te), Turkish (tr), ...
|
||||||
String inputType = "TEXT";
|
String inputType = "TEXT";
|
||||||
String outputType = "AUDIO";
|
String outputType = "AUDIO";
|
||||||
String audioType = "WAVE";
|
String audioType = "WAVE";
|
||||||
String defaultVoiceName = null;
|
String defaultVoiceName = null;
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
mary.process(text, inputType, outputType, locale, audioType, defaultVoiceName, baos);
|
mary.process(text, inputType, outputType, locale, audioType, defaultVoiceName, baos);
|
||||||
// The byte array constitutes a full wave file, including the headers.
|
// The byte array constitutes a full wave file, including the headers.
|
||||||
// And now, play the audio data:
|
// And now, play the audio data:
|
||||||
AudioInputStream ais = AudioSystem.getAudioInputStream(
|
AudioInputStream ais = AudioSystem.getAudioInputStream(
|
||||||
new ByteArrayInputStream(baos.toByteArray()));
|
new ByteArrayInputStream(baos.toByteArray()));
|
||||||
LineListener lineListener = new LineListener() {
|
LineListener lineListener = new LineListener() {
|
||||||
public void update(LineEvent event) {
|
public void update(LineEvent event) {
|
||||||
if (event.getType() == LineEvent.Type.START) {
|
if (event.getType() == LineEvent.Type.START) {
|
||||||
System.err.println("Audio started playing.");
|
System.err.println("Audio started playing.");
|
||||||
} else if (event.getType() == LineEvent.Type.STOP) {
|
} else if (event.getType() == LineEvent.Type.STOP) {
|
||||||
System.err.println("Audio stopped playing.");
|
System.err.println("Audio stopped playing.");
|
||||||
} else if (event.getType() == LineEvent.Type.OPEN) {
|
} else if (event.getType() == LineEvent.Type.OPEN) {
|
||||||
System.err.println("Audio line opened.");
|
System.err.println("Audio line opened.");
|
||||||
} else if (event.getType() == LineEvent.Type.CLOSE) {
|
} else if (event.getType() == LineEvent.Type.CLOSE) {
|
||||||
System.err.println("Audio line closed.");
|
System.err.println("Audio line closed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioPlayer ap = new AudioPlayer(ais, lineListener);
|
AudioPlayer ap = new AudioPlayer(ais, lineListener);
|
||||||
ap.start();
|
ap.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,185 +1,185 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import httplib, urllib
|
import httplib, urllib
|
||||||
|
|
||||||
# A basic mary client in Python,
|
# A basic mary client in Python,
|
||||||
# kindly donated to the MARY TTS project
|
# kindly donated to the MARY TTS project
|
||||||
# by Hugh Sasse. Thanks Hugh!
|
# by Hugh Sasse. Thanks Hugh!
|
||||||
|
|
||||||
# A very basic Python class for accessing
|
# A very basic Python class for accessing
|
||||||
# the MARY TTS system using the modern
|
# the MARY TTS system using the modern
|
||||||
# HTTP server.
|
# HTTP server.
|
||||||
# Warning, this is probably ghastly Python,
|
# Warning, this is probably ghastly Python,
|
||||||
# most of my time of late has been with
|
# most of my time of late has been with
|
||||||
# other languages, so I'm not up to date
|
# other languages, so I'm not up to date
|
||||||
# with all the stylistic conventions of
|
# with all the stylistic conventions of
|
||||||
# modern Python.
|
# modern Python.
|
||||||
# This does seem to work OK though.
|
# This does seem to work OK though.
|
||||||
|
|
||||||
class maryclient:
|
class maryclient:
|
||||||
"""A basic handler for MARY-TTS HTTP clients
|
"""A basic handler for MARY-TTS HTTP clients
|
||||||
|
|
||||||
At present, there is no checking for
|
At present, there is no checking for
|
||||||
allowed voices, locales, and so on.
|
allowed voices, locales, and so on.
|
||||||
Most of the useful parameters can be
|
Most of the useful parameters can be
|
||||||
accessed by get_ and set_ methods.
|
accessed by get_ and set_ methods.
|
||||||
Relying on winsound, this is Windows
|
Relying on winsound, this is Windows
|
||||||
specific.
|
specific.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Set up useful defaults (for
|
"""Set up useful defaults (for
|
||||||
people in England, anyway)"""
|
people in England, anyway)"""
|
||||||
self.host = "127.0.0.1"
|
self.host = "127.0.0.1"
|
||||||
self.port = 59125
|
self.port = 59125
|
||||||
self.input_type = "TEXT"
|
self.input_type = "TEXT"
|
||||||
self.output_type = "AUDIO"
|
self.output_type = "AUDIO"
|
||||||
self.audio = "WAVE_FILE"
|
self.audio = "WAVE_FILE"
|
||||||
self.locale = "en_GB"
|
self.locale = "en_GB"
|
||||||
self.voice = "dfki-prudence-hsmm"
|
self.voice = "dfki-prudence-hsmm"
|
||||||
|
|
||||||
def set_host(self, a_host):
|
def set_host(self, a_host):
|
||||||
"""Set the host for the TTS server."""
|
"""Set the host for the TTS server."""
|
||||||
self.host = a_host
|
self.host = a_host
|
||||||
|
|
||||||
def get_host(self):
|
def get_host(self):
|
||||||
"""Get the host for the TTS server."""
|
"""Get the host for the TTS server."""
|
||||||
self.host
|
self.host
|
||||||
|
|
||||||
def set_port(self, a_port):
|
def set_port(self, a_port):
|
||||||
"""Set the port for the TTS server."""
|
"""Set the port for the TTS server."""
|
||||||
self.port = a_port
|
self.port = a_port
|
||||||
|
|
||||||
def get_port(self):
|
def get_port(self):
|
||||||
"""Get the port for the TTS server."""
|
"""Get the port for the TTS server."""
|
||||||
self.port
|
self.port
|
||||||
|
|
||||||
def set_input_type(self, type):
|
def set_input_type(self, type):
|
||||||
"""Set the type of input being
|
"""Set the type of input being
|
||||||
supplied to the TTS server
|
supplied to the TTS server
|
||||||
(such as 'TEXT')."""
|
(such as 'TEXT')."""
|
||||||
self.input_type = type
|
self.input_type = type
|
||||||
|
|
||||||
def get_input_type(self):
|
def get_input_type(self):
|
||||||
"""Get the type of input being
|
"""Get the type of input being
|
||||||
supplied to the TTS server
|
supplied to the TTS server
|
||||||
(such as 'TEXT')."""
|
(such as 'TEXT')."""
|
||||||
self.input_type
|
self.input_type
|
||||||
|
|
||||||
def set_output_type(self, type):
|
def set_output_type(self, type):
|
||||||
"""Set the type of input being
|
"""Set the type of input being
|
||||||
supplied to the TTS server
|
supplied to the TTS server
|
||||||
(such as 'AUDIO')."""
|
(such as 'AUDIO')."""
|
||||||
self.output_type = type
|
self.output_type = type
|
||||||
|
|
||||||
def get_output_type(self):
|
def get_output_type(self):
|
||||||
"""Get the type of input being
|
"""Get the type of input being
|
||||||
supplied to the TTS server
|
supplied to the TTS server
|
||||||
(such as "AUDIO")."""
|
(such as "AUDIO")."""
|
||||||
self.output_type
|
self.output_type
|
||||||
|
|
||||||
def set_locale(self, a_locale):
|
def set_locale(self, a_locale):
|
||||||
"""Set the locale
|
"""Set the locale
|
||||||
(such as "en_GB")."""
|
(such as "en_GB")."""
|
||||||
self.locale = a_locale
|
self.locale = a_locale
|
||||||
|
|
||||||
def get_locale(self):
|
def get_locale(self):
|
||||||
"""Get the locale
|
"""Get the locale
|
||||||
(such as "en_GB")."""
|
(such as "en_GB")."""
|
||||||
self.locale
|
self.locale
|
||||||
|
|
||||||
def set_audio(self, audio_type):
|
def set_audio(self, audio_type):
|
||||||
"""Set the audio type for playback
|
"""Set the audio type for playback
|
||||||
(such as "WAVE_FILE")."""
|
(such as "WAVE_FILE")."""
|
||||||
self.audio = audio_type
|
self.audio = audio_type
|
||||||
|
|
||||||
def get_audio(self):
|
def get_audio(self):
|
||||||
"""Get the audio type for playback
|
"""Get the audio type for playback
|
||||||
(such as "WAVE_FILE")."""
|
(such as "WAVE_FILE")."""
|
||||||
self.audio
|
self.audio
|
||||||
|
|
||||||
def set_voice(self, a_voice):
|
def set_voice(self, a_voice):
|
||||||
"""Set the voice to speak with
|
"""Set the voice to speak with
|
||||||
(such as "dfki-prudence-hsmm")."""
|
(such as "dfki-prudence-hsmm")."""
|
||||||
self.voice = a_voice
|
self.voice = a_voice
|
||||||
|
|
||||||
def get_voice(self):
|
def get_voice(self):
|
||||||
"""Get the voice to speak with
|
"""Get the voice to speak with
|
||||||
(such as "dfki-prudence-hsmm")."""
|
(such as "dfki-prudence-hsmm")."""
|
||||||
self.voice
|
self.voice
|
||||||
|
|
||||||
def generate(self, message):
|
def generate(self, message):
|
||||||
"""Given a message in message,
|
"""Given a message in message,
|
||||||
return a response in the appropriate
|
return a response in the appropriate
|
||||||
format."""
|
format."""
|
||||||
raw_params = {"INPUT_TEXT": message,
|
raw_params = {"INPUT_TEXT": message,
|
||||||
"INPUT_TYPE": self.input_type,
|
"INPUT_TYPE": self.input_type,
|
||||||
"OUTPUT_TYPE": self.output_type,
|
"OUTPUT_TYPE": self.output_type,
|
||||||
"LOCALE": self.locale,
|
"LOCALE": self.locale,
|
||||||
"AUDIO": self.audio,
|
"AUDIO": self.audio,
|
||||||
"VOICE": self.voice,
|
"VOICE": self.voice,
|
||||||
}
|
}
|
||||||
params = urllib.urlencode(raw_params)
|
params = urllib.urlencode(raw_params)
|
||||||
headers = {}
|
headers = {}
|
||||||
|
|
||||||
# Open connection to self.host, self.port.
|
# Open connection to self.host, self.port.
|
||||||
conn = httplib.HTTPConnection(self.host, self.port)
|
conn = httplib.HTTPConnection(self.host, self.port)
|
||||||
|
|
||||||
# conn.set_debuglevel(5)
|
# conn.set_debuglevel(5)
|
||||||
|
|
||||||
conn.request("POST", "/process", params, headers)
|
conn.request("POST", "/process", params, headers)
|
||||||
response = conn.getresponse()
|
response = conn.getresponse()
|
||||||
if response.status != 200:
|
if response.status != 200:
|
||||||
print response.getheaders()
|
print response.getheaders()
|
||||||
raise RuntimeError("{0}: {1}".format(response.status,
|
raise RuntimeError("{0}: {1}".format(response.status,
|
||||||
response.reason))
|
response.reason))
|
||||||
return response.read()
|
return response.read()
|
||||||
|
|
||||||
# If this is invoked as a program, just give
|
# If this is invoked as a program, just give
|
||||||
# a greeting to show it is working.
|
# a greeting to show it is working.
|
||||||
# The platform specific code is moved to this
|
# The platform specific code is moved to this
|
||||||
# part so that this file may be imported without
|
# part so that this file may be imported without
|
||||||
# bringing platform specific code in.
|
# bringing platform specific code in.
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# For handling command line arguments:
|
# For handling command line arguments:
|
||||||
import sys
|
import sys
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
# check we are on Windows:
|
# check we are on Windows:
|
||||||
system = platform.system().lower()
|
system = platform.system().lower()
|
||||||
if (system == "windows"):
|
if (system == "windows"):
|
||||||
|
|
||||||
import winsound
|
import winsound
|
||||||
|
|
||||||
class Player:
|
class Player:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def play(self, a_sound):
|
def play(self, a_sound):
|
||||||
winsound.PlaySound(a_sound, winsound.SND_MEMORY)
|
winsound.PlaySound(a_sound, winsound.SND_MEMORY)
|
||||||
|
|
||||||
#if ("cygwin" in system):
|
#if ("cygwin" in system):
|
||||||
else:
|
else:
|
||||||
# Not sure how to do audio on cygwin,
|
# Not sure how to do audio on cygwin,
|
||||||
# portably for python. So have a sound
|
# portably for python. So have a sound
|
||||||
# player class that doesn't play sounds.
|
# player class that doesn't play sounds.
|
||||||
# A null object, if you like.
|
# A null object, if you like.
|
||||||
class Player:
|
class Player:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def play(self, a_sound):
|
def play(self, a_sound):
|
||||||
print("Here I would play a sound if I knew how")
|
print("Here I would play a sound if I knew how")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Probably want to parse arguments to
|
# Probably want to parse arguments to
|
||||||
# set the voice, etc., here
|
# set the voice, etc., here
|
||||||
|
|
||||||
client = maryclient()
|
client = maryclient()
|
||||||
client.set_audio("WAVE_FILE") # for example
|
client.set_audio("WAVE_FILE") # for example
|
||||||
|
|
||||||
player = Player()
|
player = Player()
|
||||||
the_sound = client.generate("hello from Mary Text to Speech, with Python.")
|
the_sound = client.generate("hello from Mary Text to Speech, with Python.")
|
||||||
if client.output_type == "AUDIO":
|
if client.output_type == "AUDIO":
|
||||||
player.play(the_sound)
|
player.play(the_sound)
|
||||||
|
|
||||||
# vi:set sw=4 et:
|
# vi:set sw=4 et:
|
||||||
|
|
|
@ -1,261 +1,261 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
#
|
#
|
||||||
# A basic mary client in Ruby,
|
# A basic mary client in Ruby,
|
||||||
# kindly donated to the MARY TTS project
|
# kindly donated to the MARY TTS project
|
||||||
# by Hugh Sasse. Thanks Hugh!
|
# by Hugh Sasse. Thanks Hugh!
|
||||||
|
|
||||||
|
|
||||||
# Ruby client for the MARY TTS HTTP server.
|
# Ruby client for the MARY TTS HTTP server.
|
||||||
# This is for Windows only, and relies on
|
# This is for Windows only, and relies on
|
||||||
# the Win32-Sound gem to access the audio.
|
# the Win32-Sound gem to access the audio.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'net/http'
|
require 'net/http'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
|
|
||||||
# A fairly minimal client class for the
|
# A fairly minimal client class for the
|
||||||
# MARY TTS system. This uses the modern
|
# MARY TTS system. This uses the modern
|
||||||
# HTTP interface to access the server.
|
# HTTP interface to access the server.
|
||||||
# At present, this doesn't wrap the methods
|
# At present, this doesn't wrap the methods
|
||||||
# which provide documentation or lists of
|
# which provide documentation or lists of
|
||||||
# voices or features.
|
# voices or features.
|
||||||
class MaryClient
|
class MaryClient
|
||||||
attr_accessor :host, :port
|
attr_accessor :host, :port
|
||||||
attr_accessor :input_type, :output_type
|
attr_accessor :input_type, :output_type
|
||||||
attr_accessor :locale, :audio, :voice
|
attr_accessor :locale, :audio, :voice
|
||||||
|
|
||||||
# Set up the defaults for the MARY TTS
|
# Set up the defaults for the MARY TTS
|
||||||
# server, which is assumed to be running
|
# server, which is assumed to be running
|
||||||
# on the local host, with British voices
|
# on the local host, with British voices
|
||||||
# installed. These may be modified with
|
# installed. These may be modified with
|
||||||
# the appropriate methods.
|
# the appropriate methods.
|
||||||
# host = 127.0.0.1)
|
# host = 127.0.0.1)
|
||||||
# port = 59125
|
# port = 59125
|
||||||
# input_type = "TEXT"
|
# input_type = "TEXT"
|
||||||
# output_type = "AUDIO"
|
# output_type = "AUDIO"
|
||||||
# audio = "WAVE_FILE"
|
# audio = "WAVE_FILE"
|
||||||
# locale = "en_GB"
|
# locale = "en_GB"
|
||||||
# voice = "dfki-prudence-hsmm"
|
# voice = "dfki-prudence-hsmm"
|
||||||
def initialize
|
def initialize
|
||||||
@host = "127.0.0.1" # The local machine
|
@host = "127.0.0.1" # The local machine
|
||||||
@port = 59125
|
@port = 59125
|
||||||
@input_type = "TEXT"
|
@input_type = "TEXT"
|
||||||
@output_type = "AUDIO"
|
@output_type = "AUDIO"
|
||||||
@locale = "en_GB"
|
@locale = "en_GB"
|
||||||
@audio = "WAVE_FILE"
|
@audio = "WAVE_FILE"
|
||||||
@voice = "dfki-prudence-hsmm"
|
@voice = "dfki-prudence-hsmm"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Process a text message, which with a
|
# Process a text message, which with a
|
||||||
# new client, will return the audio.
|
# new client, will return the audio.
|
||||||
# This is so that platform dependent parts
|
# This is so that platform dependent parts
|
||||||
# are kept separate.
|
# are kept separate.
|
||||||
def generate(message)
|
def generate(message)
|
||||||
raw_params = {"INPUT_TEXT" => message,
|
raw_params = {"INPUT_TEXT" => message,
|
||||||
"INPUT_TYPE" => @input_type,
|
"INPUT_TYPE" => @input_type,
|
||||||
"OUTPUT_TYPE" => @output_type,
|
"OUTPUT_TYPE" => @output_type,
|
||||||
"LOCALE" => @locale,
|
"LOCALE" => @locale,
|
||||||
"AUDIO" => @audio,
|
"AUDIO" => @audio,
|
||||||
"VOICE" => @voice,
|
"VOICE" => @voice,
|
||||||
}
|
}
|
||||||
res = Net::HTTP.post_form(URI.parse("http://#{@host}:#{@port}/process"), raw_params)
|
res = Net::HTTP.post_form(URI.parse("http://#{@host}:#{@port}/process"), raw_params)
|
||||||
res.value # Throw an exception on failure
|
res.value # Throw an exception on failure
|
||||||
#puts res.body
|
#puts res.body
|
||||||
return res.body
|
return res.body
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# If this invoked as a program with no
|
# If this invoked as a program with no
|
||||||
# argumens, just give a greeting to show
|
# argumens, just give a greeting to show
|
||||||
# that it is working. If arguments are
|
# that it is working. If arguments are
|
||||||
# supplied, process options to work out
|
# supplied, process options to work out
|
||||||
# what to do with the arguments.
|
# what to do with the arguments.
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
|
|
||||||
# These files are only loaded when this is
|
# These files are only loaded when this is
|
||||||
# invoked as a program.
|
# invoked as a program.
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
require 'getoptlong'
|
require 'getoptlong'
|
||||||
|
|
||||||
# PLATFORM SPECIFIC CODE.
|
# PLATFORM SPECIFIC CODE.
|
||||||
# Needs more work [!]
|
# Needs more work [!]
|
||||||
case Config::CONFIG['host_os']
|
case Config::CONFIG['host_os']
|
||||||
when /darwin/i
|
when /darwin/i
|
||||||
raise NotImplementedError.new("Don't know how to play audio on a Mac")
|
raise NotImplementedError.new("Don't know how to play audio on a Mac")
|
||||||
when /linux/i
|
when /linux/i
|
||||||
raise NotImplementedError.new("Far too many ways to play audio on Linux, you'll need to choose something")
|
raise NotImplementedError.new("Far too many ways to play audio on Linux, you'll need to choose something")
|
||||||
when /sunos|solaris/i
|
when /sunos|solaris/i
|
||||||
raise NotImplementedError.new("Have not played audio on Suns for too long to implement this.")
|
raise NotImplementedError.new("Have not played audio on Suns for too long to implement this.")
|
||||||
when /java/i
|
when /java/i
|
||||||
raise NotImplementedError.new("Don't know how to play audio from Java ")
|
raise NotImplementedError.new("Don't know how to play audio from Java ")
|
||||||
when /win32|cygwin|mingw32/i
|
when /win32|cygwin|mingw32/i
|
||||||
# The various things that can use the Win32
|
# The various things that can use the Win32
|
||||||
# sound gem
|
# sound gem
|
||||||
require 'win32/sound'
|
require 'win32/sound'
|
||||||
# Create a player class that will play the
|
# Create a player class that will play the
|
||||||
# sound that the Mary TTS system returns
|
# sound that the Mary TTS system returns
|
||||||
class Player
|
class Player
|
||||||
|
|
||||||
# Play the audio passed in.
|
# Play the audio passed in.
|
||||||
# Possibly this should receive the audio
|
# Possibly this should receive the audio
|
||||||
# type so we can check that we can play it,
|
# type so we can check that we can play it,
|
||||||
# but at the moment that is the
|
# but at the moment that is the
|
||||||
# responsibility of the user.
|
# responsibility of the user.
|
||||||
def self.play(sound)
|
def self.play(sound)
|
||||||
Win32::Sound.play(sound, Win32::Sound::MEMORY)
|
Win32::Sound.play(sound, Win32::Sound::MEMORY)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise NotImplementedError.new("Haven't thought how to support this OS yet")
|
raise NotImplementedError.new("Haven't thought how to support this OS yet")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
client = nil
|
client = nil
|
||||||
split = ""
|
split = ""
|
||||||
|
|
||||||
if ARGV.size.zero?
|
if ARGV.size.zero?
|
||||||
client = MaryClient.new()
|
client = MaryClient.new()
|
||||||
sound = client.generate("Hello from Mary Text to Speech with Ruby.")
|
sound = client.generate("Hello from Mary Text to Speech with Ruby.")
|
||||||
Player.play(sound)
|
Player.play(sound)
|
||||||
else
|
else
|
||||||
args_mode = :words
|
args_mode = :words
|
||||||
stdout_mode = :absorb
|
stdout_mode = :absorb
|
||||||
opts = GetoptLong::new(
|
opts = GetoptLong::new(
|
||||||
["--audio", "-a", GetoptLong::REQUIRED_ARGUMENT],
|
["--audio", "-a", GetoptLong::REQUIRED_ARGUMENT],
|
||||||
["--echo", "-e", GetoptLong::NO_ARGUMENT],
|
["--echo", "-e", GetoptLong::NO_ARGUMENT],
|
||||||
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
||||||
["--host", "-H", GetoptLong::REQUIRED_ARGUMENT],
|
["--host", "-H", GetoptLong::REQUIRED_ARGUMENT],
|
||||||
["--input-type", "-i", GetoptLong::REQUIRED_ARGUMENT],
|
["--input-type", "-i", GetoptLong::REQUIRED_ARGUMENT],
|
||||||
["--locale", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
["--locale", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
||||||
["--read", "-r", GetoptLong::NO_ARGUMENT],
|
["--read", "-r", GetoptLong::NO_ARGUMENT],
|
||||||
|
|
||||||
["--split", "-s", GetoptLong::REQUIRED_ARGUMENT],
|
["--split", "-s", GetoptLong::REQUIRED_ARGUMENT],
|
||||||
["--output-type", "-o", GetoptLong::REQUIRED_ARGUMENT],
|
["--output-type", "-o", GetoptLong::REQUIRED_ARGUMENT],
|
||||||
["--port", "-P", GetoptLong::REQUIRED_ARGUMENT],
|
["--port", "-P", GetoptLong::REQUIRED_ARGUMENT],
|
||||||
["--tee", "-t", GetoptLong::NO_ARGUMENT],
|
["--tee", "-t", GetoptLong::NO_ARGUMENT],
|
||||||
["--voice", "-v", GetoptLong::REQUIRED_ARGUMENT]
|
["--voice", "-v", GetoptLong::REQUIRED_ARGUMENT]
|
||||||
)
|
)
|
||||||
|
|
||||||
opts.each do |opt, arg|
|
opts.each do |opt, arg|
|
||||||
unless ["--help", "-h"].include?(opt)
|
unless ["--help", "-h"].include?(opt)
|
||||||
# skip if we are only getting help
|
# skip if we are only getting help
|
||||||
client ||= MaryClient.new()
|
client ||= MaryClient.new()
|
||||||
end
|
end
|
||||||
case opt
|
case opt
|
||||||
when "--help", "-h"
|
when "--help", "-h"
|
||||||
puts <<-EOHELP
|
puts <<-EOHELP
|
||||||
Usage: #{$0} [options] [arguments]
|
Usage: #{$0} [options] [arguments]
|
||||||
--audio -a
|
--audio -a
|
||||||
Audio format. Defualt: WAVE_FILE
|
Audio format. Defualt: WAVE_FILE
|
||||||
--echo -e
|
--echo -e
|
||||||
Act as an echo command and send output
|
Act as an echo command and send output
|
||||||
arguments to the synthesizer only (not
|
arguments to the synthesizer only (not
|
||||||
to standard output.
|
to standard output.
|
||||||
Turns off --read|-r
|
Turns off --read|-r
|
||||||
--help -h
|
--help -h
|
||||||
Print this help, then exit.
|
Print this help, then exit.
|
||||||
--host -H
|
--host -H
|
||||||
The host which is the server.
|
The host which is the server.
|
||||||
Default: 127.0.0.1
|
Default: 127.0.0.1
|
||||||
--input-type -i
|
--input-type -i
|
||||||
The type of the input supplied to the
|
The type of the input supplied to the
|
||||||
TTS system. Default: TEXT
|
TTS system. Default: TEXT
|
||||||
--locale -l
|
--locale -l
|
||||||
The locale of the input. Default: en_GB
|
The locale of the input. Default: en_GB
|
||||||
--output-type -o
|
--output-type -o
|
||||||
The output type from the TTS system.
|
The output type from the TTS system.
|
||||||
Default: AUDIO
|
Default: AUDIO
|
||||||
--port -P
|
--port -P
|
||||||
The port for the TTS server
|
The port for the TTS server
|
||||||
Default: 59125
|
Default: 59125
|
||||||
--read -r
|
--read -r
|
||||||
Read the files passed as arguments.
|
Read the files passed as arguments.
|
||||||
Turns off --echo|-e
|
Turns off --echo|-e
|
||||||
--split -s (lines|paragraphs)
|
--split -s (lines|paragraphs)
|
||||||
When reading files, split the input
|
When reading files, split the input
|
||||||
into lines or paragraphs. Paragraphs
|
into lines or paragraphs. Paragraphs
|
||||||
mean reading up to the next double
|
mean reading up to the next double
|
||||||
newline. Note, the argument is literally
|
newline. Note, the argument is literally
|
||||||
"lines" or "paragraphs" (or some
|
"lines" or "paragraphs" (or some
|
||||||
abbreviation of those) without the
|
abbreviation of those) without the
|
||||||
quotes.
|
quotes.
|
||||||
Default is paragraphs.
|
Default is paragraphs.
|
||||||
--tee -t
|
--tee -t
|
||||||
Act as tee: send the output to the TTS
|
Act as tee: send the output to the TTS
|
||||||
system, and to standard output.
|
system, and to standard output.
|
||||||
--voice -v
|
--voice -v
|
||||||
The voice to use.
|
The voice to use.
|
||||||
Default: dfki-prudence-hsmm
|
Default: dfki-prudence-hsmm
|
||||||
EOHELP
|
EOHELP
|
||||||
exit(0)
|
exit(0)
|
||||||
when "--audio", "-a"
|
when "--audio", "-a"
|
||||||
client.audio = arg
|
client.audio = arg
|
||||||
when "--echo", "-e"
|
when "--echo", "-e"
|
||||||
args_mode = :words
|
args_mode = :words
|
||||||
when "--host", "-H"
|
when "--host", "-H"
|
||||||
client.host = arg
|
client.host = arg
|
||||||
when "--input-type", "-i"
|
when "--input-type", "-i"
|
||||||
client.input_type = arg
|
client.input_type = arg
|
||||||
when "--locale", "-l"
|
when "--locale", "-l"
|
||||||
client.locale = arg
|
client.locale = arg
|
||||||
when "--output-type", "-o"
|
when "--output-type", "-o"
|
||||||
client.output_type = arg
|
client.output_type = arg
|
||||||
when "--port", "-P"
|
when "--port", "-P"
|
||||||
client.port = arg.to_i
|
client.port = arg.to_i
|
||||||
when "--read", "-r"
|
when "--read", "-r"
|
||||||
args_mode = :files
|
args_mode = :files
|
||||||
when "--split", "-s"
|
when "--split", "-s"
|
||||||
case arg
|
case arg
|
||||||
when /^p/i
|
when /^p/i
|
||||||
split = ""
|
split = ""
|
||||||
when /^l/i
|
when /^l/i
|
||||||
split = $/
|
split = $/
|
||||||
end
|
end
|
||||||
when "--tee", "-t"
|
when "--tee", "-t"
|
||||||
stdout_mode = :emit
|
stdout_mode = :emit
|
||||||
when "--voice", "-v"
|
when "--voice", "-v"
|
||||||
client.voice = arg
|
client.voice = arg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
client ||= MaryClient.new()
|
client ||= MaryClient.new()
|
||||||
case args_mode
|
case args_mode
|
||||||
when :words
|
when :words
|
||||||
input_text = ARGV.join(" ")
|
input_text = ARGV.join(" ")
|
||||||
unless input_text =~ /\A\s*\Z/m
|
unless input_text =~ /\A\s*\Z/m
|
||||||
sound = client.generate(input_text)
|
sound = client.generate(input_text)
|
||||||
if client.output_type == "AUDIO"
|
if client.output_type == "AUDIO"
|
||||||
Player.play(sound)
|
Player.play(sound)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if stdout_mode == :emit
|
if stdout_mode == :emit
|
||||||
puts input_text
|
puts input_text
|
||||||
end
|
end
|
||||||
when :files
|
when :files
|
||||||
# Slurp in paragraphs so sentences
|
# Slurp in paragraphs so sentences
|
||||||
# don't get broken in stupid places.
|
# don't get broken in stupid places.
|
||||||
$/ = split # paragraph mode
|
$/ = split # paragraph mode
|
||||||
ARGF.each do |paragraph|
|
ARGF.each do |paragraph|
|
||||||
begin
|
begin
|
||||||
unless paragraph =~ /\A\s*\Z/m
|
unless paragraph =~ /\A\s*\Z/m
|
||||||
sound = client.generate(paragraph)
|
sound = client.generate(paragraph)
|
||||||
if client.output_type == "AUDIO"
|
if client.output_type == "AUDIO"
|
||||||
# and client.audio == "WAVE_FILE"
|
# and client.audio == "WAVE_FILE"
|
||||||
Player.play(sound)
|
Player.play(sound)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "got error #{e} while trying to say #{paragraph.inspect}"
|
puts "got error #{e} while trying to say #{paragraph.inspect}"
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
if stdout_mode == :emit
|
if stdout_mode == :emit
|
||||||
puts paragraph
|
puts paragraph
|
||||||
end # end if
|
end # end if
|
||||||
end # end ARGF.each
|
end # end ARGF.each
|
||||||
end # end case
|
end # end case
|
||||||
end # if ARGV.size.zero?
|
end # if ARGV.size.zero?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,83 +1,83 @@
|
||||||
# Config file for DatabaseImportMain
|
# Config file for DatabaseImportMain
|
||||||
# Determines which voice import components are loaded
|
# Determines which voice import components are loaded
|
||||||
|
|
||||||
group raw_acoustics Raw Acoustics
|
group raw_acoustics Raw Acoustics
|
||||||
|
|
||||||
marytts.tools.voiceimport.PraatPitchmarker raw_acoustics
|
marytts.tools.voiceimport.PraatPitchmarker raw_acoustics
|
||||||
#marytts.tools.voiceimport.SnackPitchmarker raw_acoustics
|
#marytts.tools.voiceimport.SnackPitchmarker raw_acoustics
|
||||||
#marytts.tools.voiceimport.SnackVoiceQualityProcessor raw_acoustics
|
#marytts.tools.voiceimport.SnackVoiceQualityProcessor raw_acoustics
|
||||||
#marytts.tools.voiceimport.AutocorrelationPitchmarker raw_acoustics
|
#marytts.tools.voiceimport.AutocorrelationPitchmarker raw_acoustics
|
||||||
marytts.tools.voiceimport.MCEPMaker raw_acoustics
|
marytts.tools.voiceimport.MCEPMaker raw_acoustics
|
||||||
|
|
||||||
group transcripts Transcripts Conversion
|
group transcripts Transcripts Conversion
|
||||||
|
|
||||||
#marytts.tools.voiceimport.Mary2FestvoxTranscripts transcripts
|
#marytts.tools.voiceimport.Mary2FestvoxTranscripts transcripts
|
||||||
marytts.tools.voiceimport.Festvox2MaryTranscripts transcripts
|
marytts.tools.voiceimport.Festvox2MaryTranscripts transcripts
|
||||||
|
|
||||||
group labeling Automatic Labeling
|
group labeling Automatic Labeling
|
||||||
|
|
||||||
#marytts.tools.voiceimport.EndpointDetector labeling
|
#marytts.tools.voiceimport.EndpointDetector labeling
|
||||||
marytts.tools.voiceimport.AllophonesExtractor labeling
|
marytts.tools.voiceimport.AllophonesExtractor labeling
|
||||||
marytts.tools.voiceimport.EHMMLabeler labeling
|
marytts.tools.voiceimport.EHMMLabeler labeling
|
||||||
marytts.tools.voiceimport.HTKLabeler labeling
|
marytts.tools.voiceimport.HTKLabeler labeling
|
||||||
marytts.tools.voiceimport.LabelPauseDeleter labeling
|
marytts.tools.voiceimport.LabelPauseDeleter labeling
|
||||||
marytts.tools.voiceimport.LabelledFilesInspector labeling
|
marytts.tools.voiceimport.LabelledFilesInspector labeling
|
||||||
|
|
||||||
group labels_align Label-Transcript Alignment
|
group labels_align Label-Transcript Alignment
|
||||||
|
|
||||||
marytts.tools.voiceimport.PhoneUnitLabelComputer labels_align
|
marytts.tools.voiceimport.PhoneUnitLabelComputer labels_align
|
||||||
marytts.tools.voiceimport.HalfPhoneUnitLabelComputer labels_align
|
marytts.tools.voiceimport.HalfPhoneUnitLabelComputer labels_align
|
||||||
marytts.tools.voiceimport.TranscriptionAligner labels_align
|
marytts.tools.voiceimport.TranscriptionAligner labels_align
|
||||||
|
|
||||||
group text_features Feature Extraction
|
group text_features Feature Extraction
|
||||||
|
|
||||||
marytts.tools.voiceimport.FeatureSelection text_features
|
marytts.tools.voiceimport.FeatureSelection text_features
|
||||||
marytts.tools.voiceimport.PhoneUnitFeatureComputer text_features
|
marytts.tools.voiceimport.PhoneUnitFeatureComputer text_features
|
||||||
marytts.tools.voiceimport.HalfPhoneUnitFeatureComputer text_features
|
marytts.tools.voiceimport.HalfPhoneUnitFeatureComputer text_features
|
||||||
|
|
||||||
group labels_features Verify Alignment
|
group labels_features Verify Alignment
|
||||||
|
|
||||||
marytts.tools.voiceimport.PhoneLabelFeatureAligner labels_features
|
marytts.tools.voiceimport.PhoneLabelFeatureAligner labels_features
|
||||||
marytts.tools.voiceimport.HalfPhoneLabelFeatureAligner labels_features
|
marytts.tools.voiceimport.HalfPhoneLabelFeatureAligner labels_features
|
||||||
#marytts.tools.voiceimport.QualityControl labels_features
|
#marytts.tools.voiceimport.QualityControl labels_features
|
||||||
|
|
||||||
group basic_data Basic Data Files
|
group basic_data Basic Data Files
|
||||||
|
|
||||||
marytts.tools.voiceimport.WaveTimelineMaker basic_data
|
marytts.tools.voiceimport.WaveTimelineMaker basic_data
|
||||||
marytts.tools.voiceimport.BasenameTimelineMaker basic_data
|
marytts.tools.voiceimport.BasenameTimelineMaker basic_data
|
||||||
marytts.tools.voiceimport.MCepTimelineMaker basic_data
|
marytts.tools.voiceimport.MCepTimelineMaker basic_data
|
||||||
#marytts.tools.voiceimport.HnmTimelineMaker basic_data
|
#marytts.tools.voiceimport.HnmTimelineMaker basic_data
|
||||||
|
|
||||||
group acoustic_models Acoustic Models
|
group acoustic_models Acoustic Models
|
||||||
|
|
||||||
marytts.tools.voiceimport.PhoneUnitfileWriter acoustic_models
|
marytts.tools.voiceimport.PhoneUnitfileWriter acoustic_models
|
||||||
marytts.tools.voiceimport.PhoneFeatureFileWriter acoustic_models
|
marytts.tools.voiceimport.PhoneFeatureFileWriter acoustic_models
|
||||||
marytts.tools.voiceimport.DurationCARTTrainer acoustic_models
|
marytts.tools.voiceimport.DurationCARTTrainer acoustic_models
|
||||||
#marytts.tools.voiceimport.DurationTreeTrainer acoustic_models
|
#marytts.tools.voiceimport.DurationTreeTrainer acoustic_models
|
||||||
marytts.tools.voiceimport.F0CARTTrainer acoustic_models
|
marytts.tools.voiceimport.F0CARTTrainer acoustic_models
|
||||||
|
|
||||||
group us_files Unit Selection Files
|
group us_files Unit Selection Files
|
||||||
|
|
||||||
marytts.tools.voiceimport.HalfPhoneUnitfileWriter us_files
|
marytts.tools.voiceimport.HalfPhoneUnitfileWriter us_files
|
||||||
marytts.tools.voiceimport.HalfPhoneFeatureFileWriter us_files
|
marytts.tools.voiceimport.HalfPhoneFeatureFileWriter us_files
|
||||||
marytts.tools.voiceimport.F0PolynomialFeatureFileWriter us_files
|
marytts.tools.voiceimport.F0PolynomialFeatureFileWriter us_files
|
||||||
marytts.tools.voiceimport.AcousticFeatureFileWriter us_files
|
marytts.tools.voiceimport.AcousticFeatureFileWriter us_files
|
||||||
#marytts.tools.voiceimport.F0PolynomialTreeTrainer us_files
|
#marytts.tools.voiceimport.F0PolynomialTreeTrainer us_files
|
||||||
#marytts.tools.voiceimport.F0PolynomialInspector us_files
|
#marytts.tools.voiceimport.F0PolynomialInspector us_files
|
||||||
marytts.tools.voiceimport.JoinCostFileMaker us_files
|
marytts.tools.voiceimport.JoinCostFileMaker us_files
|
||||||
#marytts.tools.voiceimport.JoinModeller us_files
|
#marytts.tools.voiceimport.JoinModeller us_files
|
||||||
marytts.tools.voiceimport.CARTBuilder us_files
|
marytts.tools.voiceimport.CARTBuilder us_files
|
||||||
|
|
||||||
group hts_trainer HMM Voice Trainer
|
group hts_trainer HMM Voice Trainer
|
||||||
|
|
||||||
marytts.tools.voiceimport.HMMVoiceDataPreparation hts_trainer
|
marytts.tools.voiceimport.HMMVoiceDataPreparation hts_trainer
|
||||||
marytts.tools.voiceimport.HMMVoiceConfigure hts_trainer
|
marytts.tools.voiceimport.HMMVoiceConfigure hts_trainer
|
||||||
#marytts.tools.voiceimport.HMMVoiceConfigureAdapt hts_trainer
|
#marytts.tools.voiceimport.HMMVoiceConfigureAdapt hts_trainer
|
||||||
marytts.tools.voiceimport.HMMVoiceFeatureSelection hts_trainer
|
marytts.tools.voiceimport.HMMVoiceFeatureSelection hts_trainer
|
||||||
marytts.tools.voiceimport.HMMVoiceMakeData hts_trainer
|
marytts.tools.voiceimport.HMMVoiceMakeData hts_trainer
|
||||||
marytts.tools.voiceimport.HMMVoiceMakeVoice hts_trainer
|
marytts.tools.voiceimport.HMMVoiceMakeVoice hts_trainer
|
||||||
|
|
||||||
group install Install Voice
|
group install Install Voice
|
||||||
|
|
||||||
marytts.tools.voiceimport.VoiceCompiler install
|
marytts.tools.voiceimport.VoiceCompiler install
|
||||||
marytts.tools.voiceimport.HMMVoiceCompiler install
|
marytts.tools.voiceimport.HMMVoiceCompiler install
|
||||||
|
|
|
@ -1,109 +1,109 @@
|
||||||
#Auto-generated config file for voice ${VOICENAME}
|
#Auto-generated config file for voice ${VOICENAME}
|
||||||
|
|
||||||
name = ${VOICENAME}
|
name = ${VOICENAME}
|
||||||
locale = ${LOCALE}
|
locale = ${LOCALE}
|
||||||
|
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
####################### Module settings ###########################
|
####################### Module settings ###########################
|
||||||
####################################################################
|
####################################################################
|
||||||
# For keys ending in ".list", values will be appended across config files,
|
# For keys ending in ".list", values will be appended across config files,
|
||||||
# so that .list keys can occur in several config files.
|
# so that .list keys can occur in several config files.
|
||||||
# For all other keys, values will be copied to the global config, so
|
# For all other keys, values will be copied to the global config, so
|
||||||
# keys should be unique across config files.
|
# keys should be unique across config files.
|
||||||
|
|
||||||
hmm.voices.list = \
|
hmm.voices.list = \
|
||||||
${VOICENAME}
|
${VOICENAME}
|
||||||
|
|
||||||
# If this setting is not present, a default value of 0 is assumed.
|
# If this setting is not present, a default value of 0 is assumed.
|
||||||
voice.${VOICENAME}.wants.to.be.default = 0
|
voice.${VOICENAME}.wants.to.be.default = 0
|
||||||
|
|
||||||
# Set your voice specifications
|
# Set your voice specifications
|
||||||
voice.${VOICENAME}.gender = ${GENDER}
|
voice.${VOICENAME}.gender = ${GENDER}
|
||||||
voice.${VOICENAME}.locale = ${LOCALE}
|
voice.${VOICENAME}.locale = ${LOCALE}
|
||||||
voice.${VOICENAME}.domain = ${DOMAIN}
|
voice.${VOICENAME}.domain = ${DOMAIN}
|
||||||
voice.${VOICENAME}.samplingRate = ${SAMPLINGRATE}
|
voice.${VOICENAME}.samplingRate = ${SAMPLINGRATE}
|
||||||
voice.${VOICENAME}.framePeriod = ${FRAMEPERIOD}
|
voice.${VOICENAME}.framePeriod = ${FRAMEPERIOD}
|
||||||
|
|
||||||
# HMM Voice-specific parameters
|
# HMM Voice-specific parameters
|
||||||
# parameters used during models training
|
# parameters used during models training
|
||||||
# MGC: stage=gamma=0 alpha=0.42 16KHz linear gain; alpha=0.55 48Khz log gain (default)
|
# MGC: stage=gamma=0 alpha=0.42 16KHz linear gain; alpha=0.55 48Khz log gain (default)
|
||||||
# LSP: gamma>0
|
# LSP: gamma>0
|
||||||
# LSP: gamma=1 alpha=0.0 linear gain/log gain
|
# LSP: gamma=1 alpha=0.0 linear gain/log gain
|
||||||
# Mel-LSP: gamma=1 alpha=0.42 log gain
|
# Mel-LSP: gamma=1 alpha=0.42 log gain
|
||||||
# MGC-LSP: gamma=3 alpha=0.42 log gain
|
# MGC-LSP: gamma=3 alpha=0.42 log gain
|
||||||
voice.${VOICENAME}.alpha = ${ALPHA}
|
voice.${VOICENAME}.alpha = ${ALPHA}
|
||||||
voice.${VOICENAME}.gamma = ${GAMMA}
|
voice.${VOICENAME}.gamma = ${GAMMA}
|
||||||
#voice.${VOICENAME}.logGain = ${LOGGAIN}
|
#voice.${VOICENAME}.logGain = ${LOGGAIN}
|
||||||
voice.${VOICENAME}.logGain = true
|
voice.${VOICENAME}.logGain = true
|
||||||
|
|
||||||
# Parameter beta for postfiltering (parameter for tuning)
|
# Parameter beta for postfiltering (parameter for tuning)
|
||||||
voice.${VOICENAME}.beta = 0.1
|
voice.${VOICENAME}.beta = 0.1
|
||||||
|
|
||||||
# HMM Voice-specific files
|
# HMM Voice-specific files
|
||||||
# Information about trees
|
# Information about trees
|
||||||
voice.${VOICENAME}.Ftd = jar:/marytts/voice/${PACKAGE}/tree-dur.inf
|
voice.${VOICENAME}.Ftd = jar:/marytts/voice/${PACKAGE}/tree-dur.inf
|
||||||
voice.${VOICENAME}.Ftf = jar:/marytts/voice/${PACKAGE}/tree-lf0.inf
|
voice.${VOICENAME}.Ftf = jar:/marytts/voice/${PACKAGE}/tree-lf0.inf
|
||||||
voice.${VOICENAME}.Ftm = jar:/marytts/voice/${PACKAGE}/tree-mgc.inf
|
voice.${VOICENAME}.Ftm = jar:/marytts/voice/${PACKAGE}/tree-mgc.inf
|
||||||
voice.${VOICENAME}.Fts = jar:/marytts/voice/${PACKAGE}/tree-str.inf
|
voice.${VOICENAME}.Fts = jar:/marytts/voice/${PACKAGE}/tree-str.inf
|
||||||
|
|
||||||
# Information about means and variances PDFs
|
# Information about means and variances PDFs
|
||||||
voice.${VOICENAME}.Fmd = jar:/marytts/voice/${PACKAGE}/dur.pdf
|
voice.${VOICENAME}.Fmd = jar:/marytts/voice/${PACKAGE}/dur.pdf
|
||||||
voice.${VOICENAME}.Fmf = jar:/marytts/voice/${PACKAGE}/lf0.pdf
|
voice.${VOICENAME}.Fmf = jar:/marytts/voice/${PACKAGE}/lf0.pdf
|
||||||
voice.${VOICENAME}.Fmm = jar:/marytts/voice/${PACKAGE}/mgc.pdf
|
voice.${VOICENAME}.Fmm = jar:/marytts/voice/${PACKAGE}/mgc.pdf
|
||||||
voice.${VOICENAME}.Fms = jar:/marytts/voice/${PACKAGE}/str.pdf
|
voice.${VOICENAME}.Fms = jar:/marytts/voice/${PACKAGE}/str.pdf
|
||||||
|
|
||||||
# Information about Global Mean and Variance PDFs
|
# Information about Global Mean and Variance PDFs
|
||||||
voice.${VOICENAME}.useGV = true
|
voice.${VOICENAME}.useGV = true
|
||||||
|
|
||||||
# Variable for allowing context-dependent GV (without sil)
|
# Variable for allowing context-dependent GV (without sil)
|
||||||
voice.${VOICENAME}.useContextDependentGV = true
|
voice.${VOICENAME}.useContextDependentGV = true
|
||||||
|
|
||||||
# GV method: gradient or derivative (default gradient)
|
# GV method: gradient or derivative (default gradient)
|
||||||
voice.${VOICENAME}.gvMethod = gradient
|
voice.${VOICENAME}.gvMethod = gradient
|
||||||
|
|
||||||
# Max number of GV iterations (parameters for tuning)
|
# Max number of GV iterations (parameters for tuning)
|
||||||
voice.${VOICENAME}.maxMgcGvIter = 100
|
voice.${VOICENAME}.maxMgcGvIter = 100
|
||||||
voice.${VOICENAME}.maxLf0GvIter = 100
|
voice.${VOICENAME}.maxLf0GvIter = 100
|
||||||
voice.${VOICENAME}.maxStrGvIter = 100
|
voice.${VOICENAME}.maxStrGvIter = 100
|
||||||
|
|
||||||
# GV weights for each parameter: between 0.0-2.0
|
# GV weights for each parameter: between 0.0-2.0
|
||||||
voice.${VOICENAME}.gvWeightMgc = 1.0
|
voice.${VOICENAME}.gvWeightMgc = 1.0
|
||||||
voice.${VOICENAME}.gvWeightLf0 = 1.0
|
voice.${VOICENAME}.gvWeightLf0 = 1.0
|
||||||
voice.${VOICENAME}.gvWeightStr = 1.0
|
voice.${VOICENAME}.gvWeightStr = 1.0
|
||||||
|
|
||||||
# Mean and variance files for GV
|
# Mean and variance files for GV
|
||||||
voice.${VOICENAME}.Fgvf = jar:/marytts/voice/${PACKAGE}/gv-lf0.pdf
|
voice.${VOICENAME}.Fgvf = jar:/marytts/voice/${PACKAGE}/gv-lf0.pdf
|
||||||
voice.${VOICENAME}.Fgvm = jar:/marytts/voice/${PACKAGE}/gv-mgc.pdf
|
voice.${VOICENAME}.Fgvm = jar:/marytts/voice/${PACKAGE}/gv-mgc.pdf
|
||||||
voice.${VOICENAME}.Fgvs = jar:/marytts/voice/${PACKAGE}/gv-str.pdf
|
voice.${VOICENAME}.Fgvs = jar:/marytts/voice/${PACKAGE}/gv-str.pdf
|
||||||
|
|
||||||
# A context features file example for start-up testing.
|
# A context features file example for start-up testing.
|
||||||
voice.${VOICENAME}.FeaFile = jar:/marytts/voice/${PACKAGE}/features_example.pfeats
|
voice.${VOICENAME}.FeaFile = jar:/marytts/voice/${PACKAGE}/features_example.pfeats
|
||||||
|
|
||||||
# Tricky phones file in case there were problematic phones during training, empty otherwise.
|
# Tricky phones file in case there were problematic phones during training, empty otherwise.
|
||||||
voice.${VOICENAME}.trickyPhonesFile = jar:/marytts/voice/${PACKAGE}/trickyPhones.txt
|
voice.${VOICENAME}.trickyPhonesFile = jar:/marytts/voice/${PACKAGE}/trickyPhones.txt
|
||||||
|
|
||||||
# Information about Mixed Excitation
|
# Information about Mixed Excitation
|
||||||
voice.${VOICENAME}.useMixExc = true
|
voice.${VOICENAME}.useMixExc = true
|
||||||
|
|
||||||
# Filters for mixed excitation
|
# Filters for mixed excitation
|
||||||
# File format: one column with all the taps, where the number of taps per filter = numTaps/numFilters
|
# File format: one column with all the taps, where the number of taps per filter = numTaps/numFilters
|
||||||
voice.${VOICENAME}.Fif = jar:/marytts/voice/${PACKAGE}/${MIXEXCFILTERFILE}
|
voice.${VOICENAME}.Fif = jar:/marytts/voice/${PACKAGE}/${MIXEXCFILTERFILE}
|
||||||
# Number of filters in bandpass bank
|
# Number of filters in bandpass bank
|
||||||
voice.${VOICENAME}.in = ${NUMMIXEXCFILTERS}
|
voice.${VOICENAME}.in = ${NUMMIXEXCFILTERS}
|
||||||
|
|
||||||
# Information about acousticModels (if true allows prosody modification specified in MARYXML input)
|
# Information about acousticModels (if true allows prosody modification specified in MARYXML input)
|
||||||
voice.${VOICENAME}.useAcousticModels = true
|
voice.${VOICENAME}.useAcousticModels = true
|
||||||
|
|
||||||
# acoustic models to use (HMM models or carts from other voices can be specified)
|
# acoustic models to use (HMM models or carts from other voices can be specified)
|
||||||
#(uncoment to allow prosody modification specified in MARYXML input)
|
#(uncoment to allow prosody modification specified in MARYXML input)
|
||||||
voice.${VOICENAME}.acousticModels = duration F0
|
voice.${VOICENAME}.acousticModels = duration F0
|
||||||
|
|
||||||
voice.${VOICENAME}.duration.model = hmm
|
voice.${VOICENAME}.duration.model = hmm
|
||||||
# voice.${VOICENAME}.duration.data not used for hmm models
|
# voice.${VOICENAME}.duration.data not used for hmm models
|
||||||
voice.${VOICENAME}.duration.attribute = d
|
voice.${VOICENAME}.duration.attribute = d
|
||||||
|
|
||||||
voice.${VOICENAME}.F0.model = hmm
|
voice.${VOICENAME}.F0.model = hmm
|
||||||
# voice.${VOICENAME}.F0.data not used for hmm models
|
# voice.${VOICENAME}.F0.data not used for hmm models
|
||||||
voice.${VOICENAME}.F0.attribute = f0
|
voice.${VOICENAME}.F0.attribute = f0
|
||||||
|
|
||||||
|
|
|
@ -1,82 +1,82 @@
|
||||||
# Auto-generated config file for voice ${VOICENAME}
|
# Auto-generated config file for voice ${VOICENAME}
|
||||||
|
|
||||||
name = ${VOICENAME}
|
name = ${VOICENAME}
|
||||||
locale = ${LOCALE}
|
locale = ${LOCALE}
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
####################### Module settings ###########################
|
####################### Module settings ###########################
|
||||||
####################################################################
|
####################################################################
|
||||||
# For keys ending in ".list", values will be appended across config files,
|
# For keys ending in ".list", values will be appended across config files,
|
||||||
# so that .list keys can occur in several config files.
|
# so that .list keys can occur in several config files.
|
||||||
# For all other keys, values will be copied to the global config, so
|
# For all other keys, values will be copied to the global config, so
|
||||||
# keys should be unique across config files.
|
# keys should be unique across config files.
|
||||||
|
|
||||||
unitselection.voices.list = \
|
unitselection.voices.list = \
|
||||||
${VOICENAME}
|
${VOICENAME}
|
||||||
|
|
||||||
# If this setting is not present, a default value of 0 is assumed.
|
# If this setting is not present, a default value of 0 is assumed.
|
||||||
# More means higher assumed quality.
|
# More means higher assumed quality.
|
||||||
voice.${VOICENAME}.wants.to.be.default = 0
|
voice.${VOICENAME}.wants.to.be.default = 0
|
||||||
|
|
||||||
|
|
||||||
# Set your voice specifications
|
# Set your voice specifications
|
||||||
voice.${VOICENAME}.gender = ${GENDER}
|
voice.${VOICENAME}.gender = ${GENDER}
|
||||||
voice.${VOICENAME}.locale = ${LOCALE}
|
voice.${VOICENAME}.locale = ${LOCALE}
|
||||||
voice.${VOICENAME}.domain = ${DOMAIN}
|
voice.${VOICENAME}.domain = ${DOMAIN}
|
||||||
voice.${VOICENAME}.samplingRate = ${SAMPLINGRATE}
|
voice.${VOICENAME}.samplingRate = ${SAMPLINGRATE}
|
||||||
|
|
||||||
# Relative weight of the target cost function vs. the join cost function
|
# Relative weight of the target cost function vs. the join cost function
|
||||||
voice.${VOICENAME}.viterbi.wTargetCosts = 0.7
|
voice.${VOICENAME}.viterbi.wTargetCosts = 0.7
|
||||||
|
|
||||||
# Beam size in dynamic programming: smaller => faster but worse quality.
|
# Beam size in dynamic programming: smaller => faster but worse quality.
|
||||||
# (set to -1 to disable beam search; very slow but best available quality)
|
# (set to -1 to disable beam search; very slow but best available quality)
|
||||||
voice.${VOICENAME}.viterbi.beamsize = 100
|
voice.${VOICENAME}.viterbi.beamsize = 100
|
||||||
|
|
||||||
# Java classes to use for the various unit selection components
|
# Java classes to use for the various unit selection components
|
||||||
voice.${VOICENAME}.databaseClass = marytts.unitselection.data.DiphoneUnitDatabase
|
voice.${VOICENAME}.databaseClass = marytts.unitselection.data.DiphoneUnitDatabase
|
||||||
voice.${VOICENAME}.selectorClass = marytts.unitselection.select.DiphoneUnitSelector
|
voice.${VOICENAME}.selectorClass = marytts.unitselection.select.DiphoneUnitSelector
|
||||||
voice.${VOICENAME}.concatenatorClass = marytts.unitselection.concat.OverlapUnitConcatenator
|
voice.${VOICENAME}.concatenatorClass = marytts.unitselection.concat.OverlapUnitConcatenator
|
||||||
voice.${VOICENAME}.targetCostClass = marytts.unitselection.select.DiphoneFFRTargetCostFunction
|
voice.${VOICENAME}.targetCostClass = marytts.unitselection.select.DiphoneFFRTargetCostFunction
|
||||||
voice.${VOICENAME}.joinCostClass = marytts.unitselection.select.JoinCostFeatures
|
voice.${VOICENAME}.joinCostClass = marytts.unitselection.select.JoinCostFeatures
|
||||||
voice.${VOICENAME}.unitReaderClass = marytts.unitselection.data.UnitFileReader
|
voice.${VOICENAME}.unitReaderClass = marytts.unitselection.data.UnitFileReader
|
||||||
voice.${VOICENAME}.cartReaderClass = marytts.cart.io.MARYCartReader
|
voice.${VOICENAME}.cartReaderClass = marytts.cart.io.MARYCartReader
|
||||||
voice.${VOICENAME}.audioTimelineReaderClass = marytts.unitselection.data.TimelineReader
|
voice.${VOICENAME}.audioTimelineReaderClass = marytts.unitselection.data.TimelineReader
|
||||||
|
|
||||||
# Voice-specific files
|
# Voice-specific files
|
||||||
voice.${VOICENAME}.featureFile = MARY_BASE/lib/voices/${VOICENAME}/halfphoneFeatures_ac.mry
|
voice.${VOICENAME}.featureFile = MARY_BASE/lib/voices/${VOICENAME}/halfphoneFeatures_ac.mry
|
||||||
voice.${VOICENAME}.targetCostWeights = jar:/marytts/voice/${PACKAGE}/halfphoneUnitFeatureDefinition_ac.txt
|
voice.${VOICENAME}.targetCostWeights = jar:/marytts/voice/${PACKAGE}/halfphoneUnitFeatureDefinition_ac.txt
|
||||||
voice.${VOICENAME}.joinCostFile = MARY_BASE/lib/voices/${VOICENAME}/joinCostFeatures.mry
|
voice.${VOICENAME}.joinCostFile = MARY_BASE/lib/voices/${VOICENAME}/joinCostFeatures.mry
|
||||||
voice.${VOICENAME}.joinCostWeights = jar:/marytts/voice/${PACKAGE}/joinCostWeights.txt
|
voice.${VOICENAME}.joinCostWeights = jar:/marytts/voice/${PACKAGE}/joinCostWeights.txt
|
||||||
voice.${VOICENAME}.unitsFile = MARY_BASE/lib/voices/${VOICENAME}/halfphoneUnits.mry
|
voice.${VOICENAME}.unitsFile = MARY_BASE/lib/voices/${VOICENAME}/halfphoneUnits.mry
|
||||||
voice.${VOICENAME}.cartFile = jar:/marytts/voice/${PACKAGE}/cart.mry
|
voice.${VOICENAME}.cartFile = jar:/marytts/voice/${PACKAGE}/cart.mry
|
||||||
voice.${VOICENAME}.audioTimelineFile = MARY_BASE/lib/voices/${VOICENAME}/timeline_waveforms.mry
|
voice.${VOICENAME}.audioTimelineFile = MARY_BASE/lib/voices/${VOICENAME}/timeline_waveforms.mry
|
||||||
voice.${VOICENAME}.basenameTimeline = MARY_BASE/lib/voices/${VOICENAME}/timeline_basenames.mry
|
voice.${VOICENAME}.basenameTimeline = MARY_BASE/lib/voices/${VOICENAME}/timeline_basenames.mry
|
||||||
|
|
||||||
# Modules to use for predicting acoustic target features for this voice:
|
# Modules to use for predicting acoustic target features for this voice:
|
||||||
|
|
||||||
voice.${VOICENAME}.acousticModels = duration F0 midF0 rightF0
|
voice.${VOICENAME}.acousticModels = duration F0 midF0 rightF0
|
||||||
|
|
||||||
voice.${VOICENAME}.duration.model = cart
|
voice.${VOICENAME}.duration.model = cart
|
||||||
voice.${VOICENAME}.duration.data = jar:/marytts/voice/${PACKAGE}/dur.tree
|
voice.${VOICENAME}.duration.data = jar:/marytts/voice/${PACKAGE}/dur.tree
|
||||||
voice.${VOICENAME}.duration.attribute = d
|
voice.${VOICENAME}.duration.attribute = d
|
||||||
|
|
||||||
voice.${VOICENAME}.F0.model = cart
|
voice.${VOICENAME}.F0.model = cart
|
||||||
voice.${VOICENAME}.F0.data = jar:/marytts/voice/${PACKAGE}/f0.left.tree
|
voice.${VOICENAME}.F0.data = jar:/marytts/voice/${PACKAGE}/f0.left.tree
|
||||||
voice.${VOICENAME}.F0.attribute = f0
|
voice.${VOICENAME}.F0.attribute = f0
|
||||||
voice.${VOICENAME}.F0.attribute.format = (0,%.0f)
|
voice.${VOICENAME}.F0.attribute.format = (0,%.0f)
|
||||||
voice.${VOICENAME}.F0.predictFrom = firstVowels
|
voice.${VOICENAME}.F0.predictFrom = firstVowels
|
||||||
voice.${VOICENAME}.F0.applyTo = firstVoicedSegments
|
voice.${VOICENAME}.F0.applyTo = firstVoicedSegments
|
||||||
|
|
||||||
voice.${VOICENAME}.midF0.model = cart
|
voice.${VOICENAME}.midF0.model = cart
|
||||||
voice.${VOICENAME}.midF0.data = jar:/marytts/voice/${PACKAGE}/f0.mid.tree
|
voice.${VOICENAME}.midF0.data = jar:/marytts/voice/${PACKAGE}/f0.mid.tree
|
||||||
voice.${VOICENAME}.midF0.attribute = f0
|
voice.${VOICENAME}.midF0.attribute = f0
|
||||||
voice.${VOICENAME}.midF0.attribute.format = (50,%.0f)
|
voice.${VOICENAME}.midF0.attribute.format = (50,%.0f)
|
||||||
voice.${VOICENAME}.midF0.predictFrom = firstVowels
|
voice.${VOICENAME}.midF0.predictFrom = firstVowels
|
||||||
voice.${VOICENAME}.midF0.applyTo = firstVowels
|
voice.${VOICENAME}.midF0.applyTo = firstVowels
|
||||||
|
|
||||||
voice.${VOICENAME}.rightF0.model = cart
|
voice.${VOICENAME}.rightF0.model = cart
|
||||||
voice.${VOICENAME}.rightF0.data = jar:/marytts/voice/${PACKAGE}/f0.right.tree
|
voice.${VOICENAME}.rightF0.data = jar:/marytts/voice/${PACKAGE}/f0.right.tree
|
||||||
voice.${VOICENAME}.rightF0.attribute = f0
|
voice.${VOICENAME}.rightF0.attribute = f0
|
||||||
voice.${VOICENAME}.rightF0.attribute.format = (100,%.0f)
|
voice.${VOICENAME}.rightF0.attribute.format = (100,%.0f)
|
||||||
voice.${VOICENAME}.rightF0.predictFrom = firstVowels
|
voice.${VOICENAME}.rightF0.predictFrom = firstVowels
|
||||||
voice.${VOICENAME}.rightF0.applyTo = lastVoicedSegments
|
voice.${VOICENAME}.rightF0.applyTo = lastVoicedSegments
|
||||||
|
|
|
@ -1,111 +1,111 @@
|
||||||
#Auto-generated config file for voice cmu-slt-hsmm
|
#Auto-generated config file for voice cmu-slt-hsmm
|
||||||
|
|
||||||
name = cmu-slt-hsmm
|
name = cmu-slt-hsmm
|
||||||
en_US-voice.version = 4.3.0
|
en_US-voice.version = 4.3.0
|
||||||
|
|
||||||
voice.version = 4.3.0
|
voice.version = 4.3.0
|
||||||
|
|
||||||
# Declare "group names" as component that other components can require.
|
# Declare "group names" as component that other components can require.
|
||||||
# These correspond to abstract "groups" of which this component is an instance.
|
# These correspond to abstract "groups" of which this component is an instance.
|
||||||
provides = \
|
provides = \
|
||||||
en_US-voice \
|
en_US-voice \
|
||||||
hmm-voice
|
hmm-voice
|
||||||
|
|
||||||
# List the dependencies, as a whitespace-separated list.
|
# List the dependencies, as a whitespace-separated list.
|
||||||
# For each required component, an optional minimum version and an optional
|
# For each required component, an optional minimum version and an optional
|
||||||
# download url can be given.
|
# download url can be given.
|
||||||
# We can require a component by name or by an abstract "group name"
|
# We can require a component by name or by an abstract "group name"
|
||||||
# as listed under the "provides" element.
|
# as listed under the "provides" element.
|
||||||
requires = \
|
requires = \
|
||||||
en_US \
|
en_US \
|
||||||
marybase
|
marybase
|
||||||
|
|
||||||
requires.marybase.version = 4.3.0
|
requires.marybase.version = 4.3.0
|
||||||
requires.en_US.version = 4.3.0
|
requires.en_US.version = 4.3.0
|
||||||
requires.en_US.download = http://mary.dfki.de/download/mary-install-4.x.x.jar
|
requires.en_US.download = http://mary.dfki.de/download/mary-install-4.x.x.jar
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
####################### Module settings ###########################
|
####################### Module settings ###########################
|
||||||
####################################################################
|
####################################################################
|
||||||
# For keys ending in ".list", values will be appended across config files,
|
# For keys ending in ".list", values will be appended across config files,
|
||||||
# so that .list keys can occur in several config files.
|
# so that .list keys can occur in several config files.
|
||||||
# For all other keys, values will be copied to the global config, so
|
# For all other keys, values will be copied to the global config, so
|
||||||
# keys should be unique across config files.
|
# keys should be unique across config files.
|
||||||
|
|
||||||
hmm.voices.list = \
|
hmm.voices.list = \
|
||||||
cmu-slt-hsmm
|
cmu-slt-hsmm
|
||||||
|
|
||||||
# If this setting is not present, a default value of 0 is assumed.
|
# If this setting is not present, a default value of 0 is assumed.
|
||||||
voice.cmu-slt-hsmm.wants.to.be.default = 0
|
voice.cmu-slt-hsmm.wants.to.be.default = 0
|
||||||
|
|
||||||
# Set your voice specifications
|
# Set your voice specifications
|
||||||
voice.cmu-slt-hsmm.gender = female
|
voice.cmu-slt-hsmm.gender = female
|
||||||
voice.cmu-slt-hsmm.locale = en_US
|
voice.cmu-slt-hsmm.locale = en_US
|
||||||
voice.cmu-slt-hsmm.domain = general
|
voice.cmu-slt-hsmm.domain = general
|
||||||
voice.cmu-slt-hsmm.samplingRate = 16000
|
voice.cmu-slt-hsmm.samplingRate = 16000
|
||||||
|
|
||||||
# HMM Voice-specific parameters
|
# HMM Voice-specific parameters
|
||||||
# parameters used during models training
|
# parameters used during models training
|
||||||
# MGC: stage=gamma=0 alpha=0.42 linear gain (default)
|
# MGC: stage=gamma=0 alpha=0.42 linear gain (default)
|
||||||
# LSP: gamma>0
|
# LSP: gamma>0
|
||||||
# LSP: gamma=1 alpha=0.0 linear gain/log gain
|
# LSP: gamma=1 alpha=0.0 linear gain/log gain
|
||||||
# Mel-LSP: gamma=1 alpha=0.42 log gain
|
# Mel-LSP: gamma=1 alpha=0.42 log gain
|
||||||
# MGC-LSP: gamma=3 alpha=0.42 log gain
|
# MGC-LSP: gamma=3 alpha=0.42 log gain
|
||||||
voice.cmu-slt-hsmm.alpha = 0.42
|
voice.cmu-slt-hsmm.alpha = 0.42
|
||||||
voice.cmu-slt-hsmm.gamma = 0
|
voice.cmu-slt-hsmm.gamma = 0
|
||||||
voice.cmu-slt-hsmm.logGain = false
|
voice.cmu-slt-hsmm.logGain = false
|
||||||
|
|
||||||
# Parameter beta for postfiltering
|
# Parameter beta for postfiltering
|
||||||
voice.cmu-slt-hsmm.beta = 0.1
|
voice.cmu-slt-hsmm.beta = 0.1
|
||||||
|
|
||||||
# HMM Voice-specific files
|
# HMM Voice-specific files
|
||||||
# Information about trees
|
# Information about trees
|
||||||
voice.cmu-slt-hsmm.Ftd = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-dur.inf
|
voice.cmu-slt-hsmm.Ftd = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-dur.inf
|
||||||
voice.cmu-slt-hsmm.Ftf = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-lf0.inf
|
voice.cmu-slt-hsmm.Ftf = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-lf0.inf
|
||||||
voice.cmu-slt-hsmm.Ftm = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-mgc.inf
|
voice.cmu-slt-hsmm.Ftm = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-mgc.inf
|
||||||
voice.cmu-slt-hsmm.Fts = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-str.inf
|
voice.cmu-slt-hsmm.Fts = MARY_BASE/lib/voices/cmu-slt-hsmm/tree-str.inf
|
||||||
|
|
||||||
# Information about means and variances PDFs
|
# Information about means and variances PDFs
|
||||||
voice.cmu-slt-hsmm.Fmd = MARY_BASE/lib/voices/cmu-slt-hsmm/dur.pdf
|
voice.cmu-slt-hsmm.Fmd = MARY_BASE/lib/voices/cmu-slt-hsmm/dur.pdf
|
||||||
voice.cmu-slt-hsmm.Fmf = MARY_BASE/lib/voices/cmu-slt-hsmm/lf0.pdf
|
voice.cmu-slt-hsmm.Fmf = MARY_BASE/lib/voices/cmu-slt-hsmm/lf0.pdf
|
||||||
voice.cmu-slt-hsmm.Fmm = MARY_BASE/lib/voices/cmu-slt-hsmm/mgc.pdf
|
voice.cmu-slt-hsmm.Fmm = MARY_BASE/lib/voices/cmu-slt-hsmm/mgc.pdf
|
||||||
voice.cmu-slt-hsmm.Fms = MARY_BASE/lib/voices/cmu-slt-hsmm/str.pdf
|
voice.cmu-slt-hsmm.Fms = MARY_BASE/lib/voices/cmu-slt-hsmm/str.pdf
|
||||||
|
|
||||||
# Information about Global Mean and Variance PDFs
|
# Information about Global Mean and Variance PDFs
|
||||||
voice.cmu-slt-hsmm.useGV = true
|
voice.cmu-slt-hsmm.useGV = true
|
||||||
voice.cmu-slt-hsmm.maxMgcGvIter = 200
|
voice.cmu-slt-hsmm.maxMgcGvIter = 200
|
||||||
voice.cmu-slt-hsmm.maxLf0GvIter = 200
|
voice.cmu-slt-hsmm.maxLf0GvIter = 200
|
||||||
voice.cmu-slt-hsmm.Fgvf = MARY_BASE/lib/voices/cmu-slt-hsmm/gv-lf0-littend.pdf
|
voice.cmu-slt-hsmm.Fgvf = MARY_BASE/lib/voices/cmu-slt-hsmm/gv-lf0-littend.pdf
|
||||||
voice.cmu-slt-hsmm.Fgvm = MARY_BASE/lib/voices/cmu-slt-hsmm/gv-mgc-littend.pdf
|
voice.cmu-slt-hsmm.Fgvm = MARY_BASE/lib/voices/cmu-slt-hsmm/gv-mgc-littend.pdf
|
||||||
voice.cmu-slt-hsmm.Fgvs = MARY_BASE/lib/voices/cmu-slt-hsmm/gv-str-littend.pdf
|
voice.cmu-slt-hsmm.Fgvs = MARY_BASE/lib/voices/cmu-slt-hsmm/gv-str-littend.pdf
|
||||||
|
|
||||||
# A context features file example for start-up testing.
|
# A context features file example for start-up testing.
|
||||||
voice.cmu-slt-hsmm.FeaFile = MARY_BASE/lib/voices/cmu-slt-hsmm/arctic_a0422.pfeats
|
voice.cmu-slt-hsmm.FeaFile = MARY_BASE/lib/voices/cmu-slt-hsmm/arctic_a0422.pfeats
|
||||||
|
|
||||||
# Tricky phones file in case there were problematic phones during training, empty otherwise.
|
# Tricky phones file in case there were problematic phones during training, empty otherwise.
|
||||||
voice.cmu-slt-hsmm.trickyPhonesFile = MARY_BASE/lib/voices/cmu-slt-hsmm/trickyPhones.txt
|
voice.cmu-slt-hsmm.trickyPhonesFile = MARY_BASE/lib/voices/cmu-slt-hsmm/trickyPhones.txt
|
||||||
|
|
||||||
# Information about Mixed Excitation
|
# Information about Mixed Excitation
|
||||||
voice.cmu-slt-hsmm.useMixExc = true
|
voice.cmu-slt-hsmm.useMixExc = true
|
||||||
|
|
||||||
# Filters for mixed excitation
|
# Filters for mixed excitation
|
||||||
# File format: one column with all the taps, where the number of taps per filter = numTaps/numFilters
|
# File format: one column with all the taps, where the number of taps per filter = numTaps/numFilters
|
||||||
voice.cmu-slt-hsmm.Fif = MARY_BASE/lib/voices/cmu-slt-hsmm/mix_excitation_filters.txt
|
voice.cmu-slt-hsmm.Fif = MARY_BASE/lib/voices/cmu-slt-hsmm/mix_excitation_filters.txt
|
||||||
# Number of filters in bandpass bank
|
# Number of filters in bandpass bank
|
||||||
voice.cmu-slt-hsmm.in = 5
|
voice.cmu-slt-hsmm.in = 5
|
||||||
|
|
||||||
# Information about acousticModels (if true allows prosody modification specified in MARYXML input)
|
# Information about acousticModels (if true allows prosody modification specified in MARYXML input)
|
||||||
voice.cmu-slt-hsmm.useAcousticModels = true
|
voice.cmu-slt-hsmm.useAcousticModels = true
|
||||||
|
|
||||||
# acoustic models to use (HMM models or carts from other voices can be specified)
|
# acoustic models to use (HMM models or carts from other voices can be specified)
|
||||||
#(uncoment to allow prosody modification specified in MARYXML input)
|
#(uncoment to allow prosody modification specified in MARYXML input)
|
||||||
voice.cmu-slt-hsmm.acousticModels = duration F0
|
voice.cmu-slt-hsmm.acousticModels = duration F0
|
||||||
|
|
||||||
voice.cmu-slt-hsmm.duration.model = hmm
|
voice.cmu-slt-hsmm.duration.model = hmm
|
||||||
voice.cmu-slt-hsmm.duration.data = MARY_BASE/conf/en_US-cmu-slt-hsmm.config
|
voice.cmu-slt-hsmm.duration.data = MARY_BASE/conf/en_US-cmu-slt-hsmm.config
|
||||||
voice.cmu-slt-hsmm.duration.attribute = d
|
voice.cmu-slt-hsmm.duration.attribute = d
|
||||||
|
|
||||||
voice.cmu-slt-hsmm.F0.model = hmm
|
voice.cmu-slt-hsmm.F0.model = hmm
|
||||||
voice.cmu-slt-hsmm.F0.data = MARY_BASE/conf/en_US-cmu-slt-hsmm.config
|
voice.cmu-slt-hsmm.F0.data = MARY_BASE/conf/en_US-cmu-slt-hsmm.config
|
||||||
voice.cmu-slt-hsmm.F0.attribute = f0
|
voice.cmu-slt-hsmm.F0.attribute = f0
|
||||||
|
|
||||||
|
|
|
@ -1,86 +1,86 @@
|
||||||
#Auto-generated config file for voice cmu-slt-hsmm
|
#Auto-generated config file for voice cmu-slt-hsmm
|
||||||
|
|
||||||
name = cmu-slt-hsmm
|
name = cmu-slt-hsmm
|
||||||
locale = en_US
|
locale = en_US
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
####################### Module settings ###########################
|
####################### Module settings ###########################
|
||||||
####################################################################
|
####################################################################
|
||||||
# For keys ending in ".list", values will be appended across config files,
|
# For keys ending in ".list", values will be appended across config files,
|
||||||
# so that .list keys can occur in several config files.
|
# so that .list keys can occur in several config files.
|
||||||
# For all other keys, values will be copied to the global config, so
|
# For all other keys, values will be copied to the global config, so
|
||||||
# keys should be unique across config files.
|
# keys should be unique across config files.
|
||||||
|
|
||||||
hmm.voices.list = cmu-slt-hsmm
|
hmm.voices.list = cmu-slt-hsmm
|
||||||
|
|
||||||
# If this setting is not present, a default value of 0 is assumed.
|
# If this setting is not present, a default value of 0 is assumed.
|
||||||
voice.cmu-slt-hsmm.wants.to.be.default = 0
|
voice.cmu-slt-hsmm.wants.to.be.default = 0
|
||||||
|
|
||||||
# Set your voice specifications
|
# Set your voice specifications
|
||||||
voice.cmu-slt-hsmm.gender = female
|
voice.cmu-slt-hsmm.gender = female
|
||||||
voice.cmu-slt-hsmm.locale = en_US
|
voice.cmu-slt-hsmm.locale = en_US
|
||||||
voice.cmu-slt-hsmm.domain = general
|
voice.cmu-slt-hsmm.domain = general
|
||||||
voice.cmu-slt-hsmm.samplingRate = 16000
|
voice.cmu-slt-hsmm.samplingRate = 16000
|
||||||
|
|
||||||
# HMM Voice-specific parameters
|
# HMM Voice-specific parameters
|
||||||
# parameters used during models training
|
# parameters used during models training
|
||||||
# MGC: stage=gamma=0 alpha=0.42 linear gain (default)
|
# MGC: stage=gamma=0 alpha=0.42 linear gain (default)
|
||||||
# LSP: gamma>0
|
# LSP: gamma>0
|
||||||
# LSP: gamma=1 alpha=0.0 linear gain/log gain
|
# LSP: gamma=1 alpha=0.0 linear gain/log gain
|
||||||
# Mel-LSP: gamma=1 alpha=0.42 log gain
|
# Mel-LSP: gamma=1 alpha=0.42 log gain
|
||||||
# MGC-LSP: gamma=3 alpha=0.42 log gain
|
# MGC-LSP: gamma=3 alpha=0.42 log gain
|
||||||
voice.cmu-slt-hsmm.alpha = 0.42
|
voice.cmu-slt-hsmm.alpha = 0.42
|
||||||
voice.cmu-slt-hsmm.gamma = 0
|
voice.cmu-slt-hsmm.gamma = 0
|
||||||
voice.cmu-slt-hsmm.logGain = false
|
voice.cmu-slt-hsmm.logGain = false
|
||||||
|
|
||||||
# Parameter beta for postfiltering
|
# Parameter beta for postfiltering
|
||||||
voice.cmu-slt-hsmm.beta = 0.1
|
voice.cmu-slt-hsmm.beta = 0.1
|
||||||
|
|
||||||
# HMM Voice-specific files
|
# HMM Voice-specific files
|
||||||
# Information about trees
|
# Information about trees
|
||||||
voice.cmu-slt-hsmm.Ftd = jar:/marytts/voice/CmuSltHsmm/tree-dur.inf
|
voice.cmu-slt-hsmm.Ftd = jar:/marytts/voice/CmuSltHsmm/tree-dur.inf
|
||||||
voice.cmu-slt-hsmm.Ftf = jar:/marytts/voice/CmuSltHsmm/tree-lf0.inf
|
voice.cmu-slt-hsmm.Ftf = jar:/marytts/voice/CmuSltHsmm/tree-lf0.inf
|
||||||
voice.cmu-slt-hsmm.Ftm = jar:/marytts/voice/CmuSltHsmm/tree-mgc.inf
|
voice.cmu-slt-hsmm.Ftm = jar:/marytts/voice/CmuSltHsmm/tree-mgc.inf
|
||||||
voice.cmu-slt-hsmm.Fts = jar:/marytts/voice/CmuSltHsmm/tree-str.inf
|
voice.cmu-slt-hsmm.Fts = jar:/marytts/voice/CmuSltHsmm/tree-str.inf
|
||||||
|
|
||||||
# Information about means and variances PDFs
|
# Information about means and variances PDFs
|
||||||
voice.cmu-slt-hsmm.Fmd = jar:/marytts/voice/CmuSltHsmm/dur.pdf
|
voice.cmu-slt-hsmm.Fmd = jar:/marytts/voice/CmuSltHsmm/dur.pdf
|
||||||
voice.cmu-slt-hsmm.Fmf = jar:/marytts/voice/CmuSltHsmm/lf0.pdf
|
voice.cmu-slt-hsmm.Fmf = jar:/marytts/voice/CmuSltHsmm/lf0.pdf
|
||||||
voice.cmu-slt-hsmm.Fmm = jar:/marytts/voice/CmuSltHsmm/mgc.pdf
|
voice.cmu-slt-hsmm.Fmm = jar:/marytts/voice/CmuSltHsmm/mgc.pdf
|
||||||
voice.cmu-slt-hsmm.Fms = jar:/marytts/voice/CmuSltHsmm/str.pdf
|
voice.cmu-slt-hsmm.Fms = jar:/marytts/voice/CmuSltHsmm/str.pdf
|
||||||
|
|
||||||
# Information about Global Mean and Variance PDFs
|
# Information about Global Mean and Variance PDFs
|
||||||
voice.cmu-slt-hsmm.useGV = true
|
voice.cmu-slt-hsmm.useGV = true
|
||||||
voice.cmu-slt-hsmm.maxMgcGvIter = 200
|
voice.cmu-slt-hsmm.maxMgcGvIter = 200
|
||||||
voice.cmu-slt-hsmm.maxLf0GvIter = 200
|
voice.cmu-slt-hsmm.maxLf0GvIter = 200
|
||||||
voice.cmu-slt-hsmm.Fgvf = jar:/marytts/voice/CmuSltHsmm/gv-lf0-littend.pdf
|
voice.cmu-slt-hsmm.Fgvf = jar:/marytts/voice/CmuSltHsmm/gv-lf0-littend.pdf
|
||||||
voice.cmu-slt-hsmm.Fgvm = jar:/marytts/voice/CmuSltHsmm/gv-mgc-littend.pdf
|
voice.cmu-slt-hsmm.Fgvm = jar:/marytts/voice/CmuSltHsmm/gv-mgc-littend.pdf
|
||||||
voice.cmu-slt-hsmm.Fgvs = jar:/marytts/voice/CmuSltHsmm/gv-str-littend.pdf
|
voice.cmu-slt-hsmm.Fgvs = jar:/marytts/voice/CmuSltHsmm/gv-str-littend.pdf
|
||||||
|
|
||||||
# A context features file example for start-up testing.
|
# A context features file example for start-up testing.
|
||||||
voice.cmu-slt-hsmm.FeaFile = jar:/marytts/voice/CmuSltHsmm/arctic_a0422.pfeats
|
voice.cmu-slt-hsmm.FeaFile = jar:/marytts/voice/CmuSltHsmm/arctic_a0422.pfeats
|
||||||
|
|
||||||
# Tricky phones file in case there were problematic phones during training, empty otherwise.
|
# Tricky phones file in case there were problematic phones during training, empty otherwise.
|
||||||
voice.cmu-slt-hsmm.trickyPhonesFile = jar:/marytts/voice/CmuSltHsmm/trickyPhones.txt
|
voice.cmu-slt-hsmm.trickyPhonesFile = jar:/marytts/voice/CmuSltHsmm/trickyPhones.txt
|
||||||
|
|
||||||
# Information about Mixed Excitation
|
# Information about Mixed Excitation
|
||||||
voice.cmu-slt-hsmm.useMixExc = true
|
voice.cmu-slt-hsmm.useMixExc = true
|
||||||
|
|
||||||
# Filters for mixed excitation
|
# Filters for mixed excitation
|
||||||
# File format: one column with all the taps, where the number of taps per filter = numTaps/numFilters
|
# File format: one column with all the taps, where the number of taps per filter = numTaps/numFilters
|
||||||
voice.cmu-slt-hsmm.Fif = jar:/marytts/voice/CmuSltHsmm/mix_excitation_filters.txt
|
voice.cmu-slt-hsmm.Fif = jar:/marytts/voice/CmuSltHsmm/mix_excitation_filters.txt
|
||||||
# Number of filters in bandpass bank
|
# Number of filters in bandpass bank
|
||||||
voice.cmu-slt-hsmm.in = 5
|
voice.cmu-slt-hsmm.in = 5
|
||||||
|
|
||||||
# Information about acousticModels (if true allows prosody modification specified in MARYXML input)
|
# Information about acousticModels (if true allows prosody modification specified in MARYXML input)
|
||||||
voice.cmu-slt-hsmm.useAcousticModels = true
|
voice.cmu-slt-hsmm.useAcousticModels = true
|
||||||
|
|
||||||
# acoustic models to use (HMM models or carts from other voices can be specified)
|
# acoustic models to use (HMM models or carts from other voices can be specified)
|
||||||
#(uncoment to allow prosody modification specified in MARYXML input)
|
#(uncoment to allow prosody modification specified in MARYXML input)
|
||||||
voice.cmu-slt-hsmm.acousticModels = duration F0
|
voice.cmu-slt-hsmm.acousticModels = duration F0
|
||||||
|
|
||||||
voice.cmu-slt-hsmm.duration.model = hmm
|
voice.cmu-slt-hsmm.duration.model = hmm
|
||||||
voice.cmu-slt-hsmm.duration.attribute = d
|
voice.cmu-slt-hsmm.duration.attribute = d
|
||||||
|
|
||||||
voice.cmu-slt-hsmm.F0.model = hmm
|
voice.cmu-slt-hsmm.F0.model = hmm
|
||||||
voice.cmu-slt-hsmm.F0.attribute = f0
|
voice.cmu-slt-hsmm.F0.attribute = f0
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
Das habe ich jetzt schon drei Mal gesagt!
|
Das habe ich jetzt schon drei Mal gesagt!
|
||||||
Ach bin ich aufgeregt! Ich kann's kaum erwarten!
|
Ach bin ich aufgeregt! Ich kann's kaum erwarten!
|
||||||
Hilfe, da hinten kommt ein Monster!
|
Hilfe, da hinten kommt ein Monster!
|
||||||
Hau endlich ab! Ich habe die Nase voll von dir!
|
Hau endlich ab! Ich habe die Nase voll von dir!
|
||||||
Mensch, jetzt lass mich halt in Ruhe!
|
Mensch, jetzt lass mich halt in Ruhe!
|
||||||
Ach Mensch, ich freue mich so für dich!
|
Ach Mensch, ich freue mich so für dich!
|
||||||
Heute ist wirklich ein schöner Tag!
|
Heute ist wirklich ein schöner Tag!
|
||||||
Und dann lebten sie glücklich und zufrieden, bis an ihr Lebensende.
|
Und dann lebten sie glücklich und zufrieden, bis an ihr Lebensende.
|
||||||
Ach lass mich doch in Frieden mit diesem Schwachsinn.
|
Ach lass mich doch in Frieden mit diesem Schwachsinn.
|
||||||
Jetzt ist alles zu spät. Ich gebe auf.
|
Jetzt ist alles zu spät. Ich gebe auf.
|
||||||
Mensch, ist das so langweilig hier!
|
Mensch, ist das so langweilig hier!
|
|
@ -1,11 +1,11 @@
|
||||||
I have said this for the third time now!
|
I have said this for the third time now!
|
||||||
Oh, I'm so excited! I can hardly await it!
|
Oh, I'm so excited! I can hardly await it!
|
||||||
Help, there's a monster coming behind me!
|
Help, there's a monster coming behind me!
|
||||||
Go away now! I am fed up with you!
|
Go away now! I am fed up with you!
|
||||||
Will you finally leave me alone!
|
Will you finally leave me alone!
|
||||||
Wow, I am delighted for you!
|
Wow, I am delighted for you!
|
||||||
Today is really a nice day.
|
Today is really a nice day.
|
||||||
And they lived happily ever after.
|
And they lived happily ever after.
|
||||||
Ah, stop bugging me with that nonsense.
|
Ah, stop bugging me with that nonsense.
|
||||||
It's all too late now. I give up.
|
It's all too late now. I give up.
|
||||||
Man, it's so boring here.
|
Man, it's so boring here.
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,124 +1,124 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2000-2006 DFKI GmbH.
|
Copyright 2000-2006 DFKI GmbH.
|
||||||
All Rights Reserved. Use is subject to license terms.
|
All Rights Reserved. Use is subject to license terms.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to use and distribute
|
Permission is hereby granted, free of charge, to use and distribute
|
||||||
this software and its documentation without restriction, including
|
this software and its documentation without restriction, including
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
distribute, sublicense, and/or sell copies of this work, and to
|
distribute, sublicense, and/or sell copies of this work, and to
|
||||||
permit persons to whom this work is furnished to do so, subject to
|
permit persons to whom this work is furnished to do so, subject to
|
||||||
the following conditions:
|
the following conditions:
|
||||||
|
|
||||||
1. The code must retain the above copyright notice, this list of
|
1. The code must retain the above copyright notice, this list of
|
||||||
conditions and the following disclaimer.
|
conditions and the following disclaimer.
|
||||||
2. Any modifications must be clearly marked as such.
|
2. Any modifications must be clearly marked as such.
|
||||||
3. Original authors' names are not deleted.
|
3. Original authors' names are not deleted.
|
||||||
4. The authors' names are not used to endorse or promote products
|
4. The authors' names are not used to endorse or promote products
|
||||||
derived from this software without specific prior written
|
derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
||||||
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||||
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
-->
|
-->
|
||||||
<!--
|
<!--
|
||||||
The following table serves as input to the CAP Module in the Mary project.
|
The following table serves as input to the CAP Module in the Mary project.
|
||||||
It contains a first estimation of phone symbols in Tibetan, duration
|
It contains a first estimation of phone symbols in Tibetan, duration
|
||||||
values are not used and unchanged from German.
|
values are not used and unchanged from German.
|
||||||
|
|
||||||
The phone symbols are given according to the SAMPA phonetic alphabet
|
The phone symbols are given according to the SAMPA phonetic alphabet
|
||||||
as used in the MARY system.
|
as used in the MARY system.
|
||||||
|
|
||||||
Some binary phonological features are given for each phone symbol.
|
Some binary phonological features are given for each phone symbol.
|
||||||
The phonological features are the following:
|
The phonological features are the following:
|
||||||
(V)owel, (S)yllabic, (v)oiced, (s)onorant,
|
(V)owel, (S)yllabic, (v)oiced, (s)onorant,
|
||||||
(l)iquid, (n)asal, (g)lide, (p)losive. p(a)use
|
(l)iquid, (n)asal, (g)lide, (p)losive. p(a)use
|
||||||
(only one segment is to be marked as a pause segment; it will be used to
|
(only one segment is to be marked as a pause segment; it will be used to
|
||||||
insert pauses)
|
insert pauses)
|
||||||
|
|
||||||
Authors: Marc Schroeder, Lars Jungjohann
|
Authors: Marc Schroeder, Lars Jungjohann
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<segment_list>
|
<segment_list>
|
||||||
|
|
||||||
<segment s="?" inh="52" min="20" phonology="-------++" sonority="1" ex="(glottal stop)"/>
|
<segment s="?" inh="52" min="20" phonology="-------++" sonority="1" ex="(glottal stop)"/>
|
||||||
|
|
||||||
<!-- Plosives -->
|
<!-- Plosives -->
|
||||||
<segment s="p" inh="68" min="30" phonology="-------+-" sonority="1" ex="Nr13,Bet"/>
|
<segment s="p" inh="68" min="30" phonology="-------+-" sonority="1" ex="Nr13,Bet"/>
|
||||||
<segment s="p_h" inh="98" min="40" phonology="-------+-" sonority="1" ex="Nr14,Pat"/>
|
<segment s="p_h" inh="98" min="40" phonology="-------+-" sonority="1" ex="Nr14,Pat"/>
|
||||||
<segment s="t" inh="57" min="30" phonology="-------+-" sonority="1" ex="Nr9,Dig"/>
|
<segment s="t" inh="57" min="30" phonology="-------+-" sonority="1" ex="Nr9,Dig"/>
|
||||||
<segment s="t_h" inh="81" min="30" phonology="-------+-" sonority="1" ex="Nr10,Tap"/>
|
<segment s="t_h" inh="81" min="30" phonology="-------+-" sonority="1" ex="Nr10,Tap"/>
|
||||||
<segment s="k" inh="70" min="30" phonology="-------+-" sonority="1" ex="Nr1,Gone"/>
|
<segment s="k" inh="70" min="30" phonology="-------+-" sonority="1" ex="Nr1,Gone"/>
|
||||||
<segment s="k_h" inh="108" min="40" phonology="-------+-" sonority="1" ex="Nr2,Kill"/>
|
<segment s="k_h" inh="108" min="40" phonology="-------+-" sonority="1" ex="Nr2,Kill"/>
|
||||||
|
|
||||||
<!-- Fricatives -->
|
<!-- Fricatives -->
|
||||||
<segment s="S" inh="104" min="50" phonology="---------" sonority="2" ex="Nr27,Ship"/>
|
<segment s="S" inh="104" min="50" phonology="---------" sonority="2" ex="Nr27,Ship"/>
|
||||||
<segment s="s" inh="97" min="50" phonology="---------" sonority="2" ex="Nr28,Sit"/>
|
<segment s="s" inh="97" min="50" phonology="---------" sonority="2" ex="Nr28,Sit"/>
|
||||||
<segment s="h" inh="61" min="30" phonology="------+--" sonority="2" ex="Nr29,Hit"/>
|
<segment s="h" inh="61" min="30" phonology="------+--" sonority="2" ex="Nr29,Hit"/>
|
||||||
|
|
||||||
<!-- Affricates -->
|
<!-- Affricates -->
|
||||||
<segment s="tS" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr5,Jar"/>
|
<segment s="tS" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr5,Jar"/>
|
||||||
<segment s="tS_h" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr6,CHamp"/>
|
<segment s="tS_h" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr6,CHamp"/>
|
||||||
<segment s="ts" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr17,aDDS"/>
|
<segment s="ts" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr17,aDDS"/>
|
||||||
<segment s="ts_h" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr18,paTSy"/>
|
<segment s="ts_h" inh="103" min="50" phonology="-------+-" sonority="2" ex="Nr18,paTSy"/>
|
||||||
|
|
||||||
<!-- Nasals -->
|
<!-- Nasals -->
|
||||||
<segment s="m" inh="70" min="30" phonology="--++-+---" sonority="3" ex="Nr16,Met"/>
|
<segment s="m" inh="70" min="30" phonology="--++-+---" sonority="3" ex="Nr16,Met"/>
|
||||||
<segment s="n" inh="62" min="30" phonology="--++-+---" sonority="3" ex="Nr12,Now"/>
|
<segment s="n" inh="62" min="30" phonology="--++-+---" sonority="3" ex="Nr12,Now"/>
|
||||||
<segment s="N" inh="73" min="30" phonology="--++-+---" sonority="3" ex="Nr4,sinG-A-long"/>
|
<segment s="N" inh="73" min="30" phonology="--++-+---" sonority="3" ex="Nr4,sinG-A-long"/>
|
||||||
<segment s="J" inh="78" min="40" phonology="--++--+--" sonority="3" ex="Nr8,canyon"/>
|
<segment s="J" inh="78" min="40" phonology="--++--+--" sonority="3" ex="Nr8,canyon"/>
|
||||||
|
|
||||||
<!-- Liquids ( Laterals, Rhotics ) -->
|
<!-- Liquids ( Laterals, Rhotics ) -->
|
||||||
<segment s="l" inh="60" min="30" phonology="--+++----" sonority="3" ex="Nr26,Let"/>
|
<segment s="l" inh="60" min="30" phonology="--+++----" sonority="3" ex="Nr26,Let"/>
|
||||||
<segment s="r" inh="60" min="30" phonology="--+++-+--" sonority="3" ex="Nr25,Red"/>
|
<segment s="r" inh="60" min="30" phonology="--+++-+--" sonority="3" ex="Nr25,Red"/>
|
||||||
|
|
||||||
<!-- Semivowels -->
|
<!-- Semivowels -->
|
||||||
<segment s="j" inh="78" min="40" phonology="--++--+--" sonority="3" ex="Nr24,yet"/>
|
<segment s="j" inh="78" min="40" phonology="--++--+--" sonority="3" ex="Nr24,yet"/>
|
||||||
<segment s="w" inh="78" min="40" phonology="--++--+--" sonority="3" ex="Nr20,War"/>
|
<segment s="w" inh="78" min="40" phonology="--++--+--" sonority="3" ex="Nr20,War"/>
|
||||||
|
|
||||||
<!-- Vowels -->
|
<!-- Vowels -->
|
||||||
<segment s="@" inh="62" min="50" phonology="++-------" sonority="4" ex="sehEn, bEsagt"/>
|
<segment s="@" inh="62" min="50" phonology="++-------" sonority="4" ex="sehEn, bEsagt"/>
|
||||||
<segment s="@:" inh="90" min="60" phonology="++-------" sonority="4" ex="werte_erfunden"/>
|
<segment s="@:" inh="90" min="60" phonology="++-------" sonority="4" ex="werte_erfunden"/>
|
||||||
<segment s="i" inh="67" min="30" phonology="++-------" sonority="5" ex="zIvil"/>
|
<segment s="i" inh="67" min="30" phonology="++-------" sonority="5" ex="zIvil"/>
|
||||||
<segment s="i:" inh="85" min="40" phonology="++-------" sonority="6" ex="Igel, bIEten"/>
|
<segment s="i:" inh="85" min="40" phonology="++-------" sonority="6" ex="Igel, bIEten"/>
|
||||||
<segment s="y" inh="83" min="40" phonology="++-------" sonority="5" ex="XYlophon"/>
|
<segment s="y" inh="83" min="40" phonology="++-------" sonority="5" ex="XYlophon"/>
|
||||||
<segment s="y:" inh="120" min="60" phonology="++-------" sonority="6" ex="<22>bung, h<>ten"/>
|
<segment s="y:" inh="120" min="60" phonology="++-------" sonority="6" ex="<22>bung, h<>ten"/>
|
||||||
<segment s="e" inh="91" min="40" phonology="++-------" sonority="5" ex="rEgEnerativ"/>
|
<segment s="e" inh="91" min="40" phonology="++-------" sonority="5" ex="rEgEnerativ"/>
|
||||||
<segment s="e:" inh="119" min="60" phonology="++-------" sonority="6" ex="bEten, schnEE"/>
|
<segment s="e:" inh="119" min="60" phonology="++-------" sonority="6" ex="bEten, schnEE"/>
|
||||||
<segment s="E" inh="91" min="40" phonology="++-------" sonority="5" ex="bEtten, g<>ste"/>
|
<segment s="E" inh="91" min="40" phonology="++-------" sonority="5" ex="bEtten, g<>ste"/>
|
||||||
<segment s="E:" inh="152" min="80" phonology="++-------" sonority="6" ex="<22>sen, gebl<62>se"/>
|
<segment s="E:" inh="152" min="80" phonology="++-------" sonority="6" ex="<22>sen, gebl<62>se"/>
|
||||||
<segment s="2" inh="104" min="50" phonology="++-------" sonority="5" ex=""/>
|
<segment s="2" inh="104" min="50" phonology="++-------" sonority="5" ex=""/>
|
||||||
<segment s="2:" inh="143" min="70" phonology="++-------" sonority="6" ex="<22>fen, m<>gen"/>
|
<segment s="2:" inh="143" min="70" phonology="++-------" sonority="6" ex="<22>fen, m<>gen"/>
|
||||||
<segment s="u" inh="81" min="40" phonology="++-------" sonority="5" ex="IlUsion"/>
|
<segment s="u" inh="81" min="40" phonology="++-------" sonority="5" ex="IlUsion"/>
|
||||||
<segment s="u:" inh="95" min="50" phonology="++-------" sonority="6" ex="bUHlen, gUt"/>
|
<segment s="u:" inh="95" min="50" phonology="++-------" sonority="6" ex="bUHlen, gUt"/>
|
||||||
<segment s="o" inh="86" min="40" phonology="++-------" sonority="5" ex="desillusiOnieren"/>
|
<segment s="o" inh="86" min="40" phonology="++-------" sonority="5" ex="desillusiOnieren"/>
|
||||||
<segment s="o:" inh="121" min="60" phonology="++-------" sonority="6" ex="Ofen, kOHl"/>
|
<segment s="o:" inh="121" min="60" phonology="++-------" sonority="6" ex="Ofen, kOHl"/>
|
||||||
<segment s="O" inh="86" min="40" phonology="++-------" sonority="5" ex="Offen, tOpf"/>
|
<segment s="O" inh="86" min="40" phonology="++-------" sonority="5" ex="Offen, tOpf"/>
|
||||||
<segment s="O:" inh="121" min="60" phonology="++-------" sonority="5" ex="Werte_erfunden"/>
|
<segment s="O:" inh="121" min="60" phonology="++-------" sonority="5" ex="Werte_erfunden"/>
|
||||||
<segment s="a" inh="92" min="40" phonology="++-------" sonority="5" ex="An, kAnn"/>
|
<segment s="a" inh="92" min="40" phonology="++-------" sonority="5" ex="An, kAnn"/>
|
||||||
<segment s="a:" inh="131" min="70" phonology="++-------" sonority="6" ex="wAr, wAHr"/>
|
<segment s="a:" inh="131" min="70" phonology="++-------" sonority="6" ex="wAr, wAHr"/>
|
||||||
|
|
||||||
<!-- Nasalised consonants -->
|
<!-- Nasalised consonants -->
|
||||||
<segment s="i~" inh="67" min="30" phonology="++---+---" sonority="5"/>
|
<segment s="i~" inh="67" min="30" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="y~" inh="83" min="40" phonology="++---+---" sonority="5"/>
|
<segment s="y~" inh="83" min="40" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="e~" inh="91" min="40" phonology="++---+---" sonority="5"/>
|
<segment s="e~" inh="91" min="40" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="E~" inh="91" min="40" phonology="++---+---" sonority="5"/>
|
<segment s="E~" inh="91" min="40" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="2~" inh="104" min="50" phonology="++---+---" sonority="5"/>
|
<segment s="2~" inh="104" min="50" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="u~" inh="81" min="40" phonology="++---+---" sonority="5"/>
|
<segment s="u~" inh="81" min="40" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="o~" inh="86" min="40" phonology="++---+---" sonority="5"/>
|
<segment s="o~" inh="86" min="40" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="O~" inh="86" min="40" phonology="++---+---" sonority="5"/>
|
<segment s="O~" inh="86" min="40" phonology="++---+---" sonority="5"/>
|
||||||
<segment s="a~" inh="92" min="40" phonology="++---+---" sonority="5"/>
|
<segment s="a~" inh="92" min="40" phonology="++---+---" sonority="5"/>
|
||||||
|
|
||||||
|
|
||||||
</segment_list>
|
</segment_list>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,117 +1,117 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2000-2006 DFKI GmbH.
|
Copyright 2000-2006 DFKI GmbH.
|
||||||
All Rights Reserved. Use is subject to license terms.
|
All Rights Reserved. Use is subject to license terms.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to use and distribute
|
Permission is hereby granted, free of charge, to use and distribute
|
||||||
this software and its documentation without restriction, including
|
this software and its documentation without restriction, including
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
distribute, sublicense, and/or sell copies of this work, and to
|
distribute, sublicense, and/or sell copies of this work, and to
|
||||||
permit persons to whom this work is furnished to do so, subject to
|
permit persons to whom this work is furnished to do so, subject to
|
||||||
the following conditions:
|
the following conditions:
|
||||||
|
|
||||||
1. The code must retain the above copyright notice, this list of
|
1. The code must retain the above copyright notice, this list of
|
||||||
conditions and the following disclaimer.
|
conditions and the following disclaimer.
|
||||||
2. Any modifications must be clearly marked as such.
|
2. Any modifications must be clearly marked as such.
|
||||||
3. Original authors' names are not deleted.
|
3. Original authors' names are not deleted.
|
||||||
4. The authors' names are not used to endorse or promote products
|
4. The authors' names are not used to endorse or promote products
|
||||||
derived from this software without specific prior written
|
derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
||||||
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||||
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
-->
|
-->
|
||||||
<!-- This file contains the parameters to the rules for the realisation of
|
<!-- This file contains the parameters to the rules for the realisation of
|
||||||
ToBI accent and boundary tones, as used in
|
ToBI accent and boundary tones, as used in
|
||||||
the CAP module of the Mary Text-to-Speech Synthesis system.
|
the CAP module of the Mary Text-to-Speech Synthesis system.
|
||||||
|
|
||||||
Author: Marc Schröder.
|
Author: Marc Schröder.
|
||||||
|
|
||||||
The parameters are read at program start. Their meaning is described in
|
The parameters are read at program start. Their meaning is described in
|
||||||
the accompanying comments.
|
the accompanying comments.
|
||||||
For a description of the tobi rules, see
|
For a description of the tobi rules, see
|
||||||
mary/doc/ToBItone-rules.txt
|
mary/doc/ToBItone-rules.txt
|
||||||
|
|
||||||
Syntax of this file:
|
Syntax of this file:
|
||||||
This is an XML file.
|
This is an XML file.
|
||||||
Accents and boundaries are defined as a set of target points,
|
Accents and boundaries are defined as a set of target points,
|
||||||
some of which are conditional.
|
some of which are conditional.
|
||||||
Each target point is defined by its type, an f0 specification,
|
Each target point is defined by its type, an f0 specification,
|
||||||
and a code specifying the position of the time axis.
|
and a code specifying the position of the time axis.
|
||||||
|
|
||||||
a) Types of targetpoints:
|
a) Types of targetpoints:
|
||||||
begin the very first, default target in a declination phrase
|
begin the very first, default target in a declination phrase
|
||||||
interpol relatively unimportant target needed for interpolation
|
interpol relatively unimportant target needed for interpolation
|
||||||
plus the weaker part of a composed accent (the l in l+h*)
|
plus the weaker part of a composed accent (the l in l+h*)
|
||||||
star the important part of an accent (the h in l+h*)
|
star the important part of an accent (the h in l+h*)
|
||||||
boundary non-final, but important target in boundary tone
|
boundary non-final, but important target in boundary tone
|
||||||
final the very last target in a boundary tone
|
final the very last target in a boundary tone
|
||||||
|
|
||||||
b) Generally, f0-axis values (describing the fundamental frequency)
|
b) Generally, f0-axis values (describing the fundamental frequency)
|
||||||
are in o/oo, where 0 is the baseline and 1000 is the topline.
|
are in o/oo, where 0 is the baseline and 1000 is the topline.
|
||||||
If the value of the f0 attribute is not numerical, it is an exceptional way
|
If the value of the f0 attribute is not numerical, it is an exceptional way
|
||||||
to specify f0:
|
to specify f0:
|
||||||
last_H_freq same *frequency* value as the preceding target on the topline.
|
last_H_freq same *frequency* value as the preceding target on the topline.
|
||||||
|
|
||||||
c) t values (position on the time axis) are coded in the following way:
|
c) t values (position on the time axis) are coded in the following way:
|
||||||
0 start of this declination phrase
|
0 start of this declination phrase
|
||||||
11 start of the preceding syllable
|
11 start of the preceding syllable
|
||||||
12 start of the nucleus of the preceding syllable
|
12 start of the nucleus of the preceding syllable
|
||||||
21 start of this syllable
|
21 start of this syllable
|
||||||
22 start of the nucleus of this syllable
|
22 start of the nucleus of this syllable
|
||||||
23 middle of the nucleus of this syllable
|
23 middle of the nucleus of this syllable
|
||||||
24 end of the nucleus of this syllable
|
24 end of the nucleus of this syllable
|
||||||
25 end of this syllable
|
25 end of this syllable
|
||||||
34 end of the nucleus of the following syllable
|
34 end of the nucleus of the following syllable
|
||||||
and some more specific ones:
|
and some more specific ones:
|
||||||
99 middle of the nucleus of the syllable after the (syllable associated
|
99 middle of the nucleus of the syllable after the (syllable associated
|
||||||
with) the previous tone
|
with) the previous tone
|
||||||
98 middle of the nucleus of the first 1ary or 2ary stressed syllable after
|
98 middle of the nucleus of the first 1ary or 2ary stressed syllable after
|
||||||
the syllable after the (syllable associated with) the previous tone
|
the syllable after the (syllable associated with) the previous tone
|
||||||
(i.e., skip one syllable and then search for a stressed syllable)
|
(i.e., skip one syllable and then search for a stressed syllable)
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<tobitone-params>
|
<tobitone-params>
|
||||||
|
|
||||||
<tone name="H">
|
<tone name="H">
|
||||||
<target f0="1000" t_code="23"/>
|
<target f0="1000" t_code="23"/>
|
||||||
</tone>
|
</tone>
|
||||||
|
|
||||||
<tone name="L">
|
<tone name="L">
|
||||||
<target f0="0" t_code="23"/>
|
<target f0="0" t_code="23"/>
|
||||||
</tone>
|
</tone>
|
||||||
|
|
||||||
<tone name="high">
|
<tone name="high">
|
||||||
<target f0="1000" t_code="23"/>
|
<target f0="1000" t_code="23"/>
|
||||||
</tone>
|
</tone>
|
||||||
|
|
||||||
<tone name="low">
|
<tone name="low">
|
||||||
<target f0="0" t_code="23"/>
|
<target f0="0" t_code="23"/>
|
||||||
</tone>
|
</tone>
|
||||||
|
|
||||||
<tone name="middle">
|
<tone name="middle">
|
||||||
<target f0="500" t_code="23"/>
|
<target f0="500" t_code="23"/>
|
||||||
</tone>
|
</tone>
|
||||||
|
|
||||||
<tone name="high_falling">
|
<tone name="high_falling">
|
||||||
<target f0="1000" t_code="22"/>
|
<target f0="1000" t_code="22"/>
|
||||||
<target f0="500" t_code="24"/>
|
<target f0="500" t_code="24"/>
|
||||||
</tone>
|
</tone>
|
||||||
|
|
||||||
<tone name="low_falling">
|
<tone name="low_falling">
|
||||||
<target f0="0" t_code="22"/>
|
<target f0="0" t_code="22"/>
|
||||||
<target f0="-200" t_code="24"/>
|
<target f0="-200" t_code="24"/>
|
||||||
</tone>
|
</tone>
|
||||||
|
|
||||||
|
|
||||||
</tobitone-params>
|
</tobitone-params>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,113 +1,113 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2000-2006 DFKI GmbH.
|
Copyright 2000-2006 DFKI GmbH.
|
||||||
All Rights Reserved. Use is subject to license terms.
|
All Rights Reserved. Use is subject to license terms.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to use and distribute
|
Permission is hereby granted, free of charge, to use and distribute
|
||||||
this software and its documentation without restriction, including
|
this software and its documentation without restriction, including
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
distribute, sublicense, and/or sell copies of this work, and to
|
distribute, sublicense, and/or sell copies of this work, and to
|
||||||
permit persons to whom this work is furnished to do so, subject to
|
permit persons to whom this work is furnished to do so, subject to
|
||||||
the following conditions:
|
the following conditions:
|
||||||
|
|
||||||
1. The code must retain the above copyright notice, this list of
|
1. The code must retain the above copyright notice, this list of
|
||||||
conditions and the following disclaimer.
|
conditions and the following disclaimer.
|
||||||
2. Any modifications must be clearly marked as such.
|
2. Any modifications must be clearly marked as such.
|
||||||
3. Original authors' names are not deleted.
|
3. Original authors' names are not deleted.
|
||||||
4. The authors' names are not used to endorse or promote products
|
4. The authors' names are not used to endorse or promote products
|
||||||
derived from this software without specific prior written
|
derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
|
||||||
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||||
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
-->
|
-->
|
||||||
<!-- This file contains the rules for the prediction of boundaries in the Tibetan MARY text-to-speech synthesis system.
|
<!-- This file contains the rules for the prediction of boundaries in the Tibetan MARY text-to-speech synthesis system.
|
||||||
The rules are read at program start. The meaning of the rules is described in the accompanying comments.
|
The rules are read at program start. The meaning of the rules is described in the accompanying comments.
|
||||||
Available linguistic information that can be used in the rules are:
|
Available linguistic information that can be used in the rules are:
|
||||||
type of punctuation, text of a token, number of following/preceding tokens/words, prosodic position(prenuclear, postnuclear or nuclear position), end of vorfeld(only relevant for languages with Vorfeld(German)), end of paragraph, sentence type and every arbitrary MaryXML attribute like pos(part of speech), syn_phrase(chunk phrases), given(givenness of a token), contrast(contrastiveness of a token) etc.
|
type of punctuation, text of a token, number of following/preceding tokens/words, prosodic position(prenuclear, postnuclear or nuclear position), end of vorfeld(only relevant for languages with Vorfeld(German)), end of paragraph, sentence type and every arbitrary MaryXML attribute like pos(part of speech), syn_phrase(chunk phrases), given(givenness of a token), contrast(contrastiveness of a token) etc.
|
||||||
|
|
||||||
The file contains four parts:
|
The file contains four parts:
|
||||||
a) definitions: definitions of (locally defined or external) lists that are needed for the prosody prediction rules
|
a) definitions: definitions of (locally defined or external) lists that are needed for the prosody prediction rules
|
||||||
b) accent position rules: rules that determine for every token in a sentence, if it will receive a tone accent, a force accent or if it doesn't receive any accent.
|
b) accent position rules: rules that determine for every token in a sentence, if it will receive a tone accent, a force accent or if it doesn't receive any accent.
|
||||||
c) accent shape rules: rules that determine the accent type (a concrete GToBI accent) for every token receiving an accent according to the rules in b))
|
c) accent shape rules: rules that determine the accent type (a concrete GToBI accent) for every token receiving an accent according to the rules in b))
|
||||||
d) boundary rules: rules that determine position, break index and tone of minor and major boundaries (Tones of boundaries are not included in this version of the Tibetan MARY text-to-speech synthesis system). A major boundary (i.e. a <phrase> tag is set) is inserted whenever a breakindex between 4 and 6 (including 4 and 6) is specified.
|
d) boundary rules: rules that determine position, break index and tone of minor and major boundaries (Tones of boundaries are not included in this version of the Tibetan MARY text-to-speech synthesis system). A major boundary (i.e. a <phrase> tag is set) is inserted whenever a breakindex between 4 and 6 (including 4 and 6) is specified.
|
||||||
|
|
||||||
At the current state of the Tibetan MARY text-to-speech synthesis system only part d) is used. All the other parts are not supported by the system but might be included in later versions.
|
At the current state of the Tibetan MARY text-to-speech synthesis system only part d) is used. All the other parts are not supported by the system but might be included in later versions.
|
||||||
|
|
||||||
Every rule contains an arbitrary number of conditions and exactly one "action"
|
Every rule contains an arbitrary number of conditions and exactly one "action"
|
||||||
statement(obligatory), which defines the consequence of the rule that will be applied if every condition is satisfied.
|
statement(obligatory), which defines the consequence of the rule that will be applied if every condition is satisfied.
|
||||||
|
|
||||||
Types of possible conditions that can be used right now:
|
Types of possible conditions that can be used right now:
|
||||||
a) condition with tag "attributes","nextAttributes","nextPlusXAttributes"(X is an arbitrary number),"previousAttributes","previousMinusXAttributes":
|
a) condition with tag "attributes","nextAttributes","nextPlusXAttributes"(X is an arbitrary number),"previousAttributes","previousMinusXAttributes":
|
||||||
defines MaryXML attributes and values that are required for the application of a rule
|
defines MaryXML attributes and values that are required for the application of a rule
|
||||||
Example: <rule>
|
Example: <rule>
|
||||||
<attributes pos="NN"/>
|
<attributes pos="NN"/>
|
||||||
<nextAttributes pos="NN"/>
|
<nextAttributes pos="NN"/>
|
||||||
<action accent=""/>
|
<action accent=""/>
|
||||||
</rule>
|
</rule>
|
||||||
Values can also be negated or contain a reference to a list.
|
Values can also be negated or contain a reference to a list.
|
||||||
Example: <attributes pos="!NN"/>
|
Example: <attributes pos="!NN"/>
|
||||||
<attributes pos="INLIST:pos_tonal_accent"/>
|
<attributes pos="INLIST:pos_tonal_accent"/>
|
||||||
Special attribute values are ""(value of attribute doesn't matter, but attribute has to be present) and "!" (attribute must not be present). If there isn't any token at the specified position, then the condition is not satisfied.
|
Special attribute values are ""(value of attribute doesn't matter, but attribute has to be present) and "!" (attribute must not be present). If there isn't any token at the specified position, then the condition is not satisfied.
|
||||||
|
|
||||||
b) condition with tag "folTokens" or "prevTokens" and attribute "num": defines the number of tokens that must follow or precede the current token (not only words, also punctuation marks).
|
b) condition with tag "folTokens" or "prevTokens" and attribute "num": defines the number of tokens that must follow or precede the current token (not only words, also punctuation marks).
|
||||||
Possible values are: "X"(X is an arbitrary number), "X+"(at least X), "X-"(not more than X)
|
Possible values are: "X"(X is an arbitrary number), "X+"(at least X), "X-"(not more than X)
|
||||||
Example: for a rule that should be applied only at the end of a sentence:
|
Example: for a rule that should be applied only at the end of a sentence:
|
||||||
<folTokens num="0"/>
|
<folTokens num="0"/>
|
||||||
|
|
||||||
c) condition with tag "folWords" or "prevWords" and attribute "num": defines the number of tokens that must follow or precede the current token (only words, no punctuation marks).
|
c) condition with tag "folWords" or "prevWords" and attribute "num": defines the number of tokens that must follow or precede the current token (only words, no punctuation marks).
|
||||||
Possible values are: "X"(X is an arbitrary number), "X+"(at least X), "X-"(not more than X)
|
Possible values are: "X"(X is an arbitrary number), "X+"(at least X), "X-"(not more than X)
|
||||||
|
|
||||||
d) condition with tag "sentence" and attribute "type": defines the required sentence type for the application of the rule.
|
d) condition with tag "sentence" and attribute "type": defines the required sentence type for the application of the rule.
|
||||||
Possible values are: "decl", "excl", "interrog", "interrogW", "interrogYN" and their negations.
|
Possible values are: "decl", "excl", "interrog", "interrogW", "interrogYN" and their negations.
|
||||||
|
|
||||||
e) condition with tag "text","nextText","nextPlusXText","previousText","previousMinusXText" and attribute "word": determines the required text of a token.
|
e) condition with tag "text","nextText","nextPlusXText","previousText","previousMinusXText" and attribute "word": determines the required text of a token.
|
||||||
Possible values are a word and a reference to a local or external list and their negations.
|
Possible values are a word and a reference to a local or external list and their negations.
|
||||||
Example: <nextPlus3Text word="INLIST:lib/modules/prosody/accentedWords.txt"/>
|
Example: <nextPlus3Text word="INLIST:lib/modules/prosody/accentedWords.txt"/>
|
||||||
|
|
||||||
f) condition with tag "prosodicPosition" and attribute "type": determines the position of a token with respect to the nucleus. Only available in the accentshape rule part.
|
f) condition with tag "prosodicPosition" and attribute "type": determines the position of a token with respect to the nucleus. Only available in the accentshape rule part.
|
||||||
Possible values are "prenuclear", "postnuclear", "nuclearParagraphFinal" and "nuclearNonParagraphFinal" and their negation.
|
Possible values are "prenuclear", "postnuclear", "nuclearParagraphFinal" and "nuclearNonParagraphFinal" and their negation.
|
||||||
|
|
||||||
g) condition with tag "specialPosition" and attribute "type":
|
g) condition with tag "specialPosition" and attribute "type":
|
||||||
Possible values are only: "enfofpar"(end of paragraph) and "endofvorfeld"(end of the Vorfeld in German or other language with Vorfeld) and their negations.
|
Possible values are only: "enfofpar"(end of paragraph) and "endofvorfeld"(end of the Vorfeld in German or other language with Vorfeld) and their negations.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<tobipredparams>
|
<tobipredparams>
|
||||||
|
|
||||||
<definitions>
|
<definitions>
|
||||||
</definitions>
|
</definitions>
|
||||||
|
|
||||||
<!-- the accentposition rules determine if a token gets a tone accent, a force accent or if it doesn't receive any accent -->
|
<!-- the accentposition rules determine if a token gets a tone accent, a force accent or if it doesn't receive any accent -->
|
||||||
<accentposition>
|
<accentposition>
|
||||||
</accentposition>
|
</accentposition>
|
||||||
|
|
||||||
<!-- the accentshape rules determine the type of accent for words with accent="tone" or "force" -->
|
<!-- the accentshape rules determine the type of accent for words with accent="tone" or "force" -->
|
||||||
<accentshape>
|
<accentshape>
|
||||||
</accentshape>
|
</accentshape>
|
||||||
|
|
||||||
|
|
||||||
<!-- the boundaries rules determine if a boundary has to be inserted after the current token; the rules also determine break index and boundary tone -->
|
<!-- the boundaries rules determine if a boundary has to be inserted after the current token; the rules also determine break index and boundary tone -->
|
||||||
<boundaries>
|
<boundaries>
|
||||||
|
|
||||||
<!-- set a breakindex of 6 at the end of a paragraph -->
|
<!-- set a breakindex of 6 at the end of a paragraph -->
|
||||||
<rule>
|
<rule>
|
||||||
<specialPosition type="endofpar" />
|
<specialPosition type="endofpar" />
|
||||||
<action bi="6"/>
|
<action bi="6"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<!-- set a breakindex of 5 at the end of a sentence -->
|
<!-- set a breakindex of 5 at the end of a sentence -->
|
||||||
<rule>
|
<rule>
|
||||||
<folTokens num="0"/>
|
<folTokens num="0"/>
|
||||||
<action bi="5"/>
|
<action bi="5"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
|
||||||
</boundaries>
|
</boundaries>
|
||||||
</tobipredparams>
|
</tobipredparams>
|
||||||
|
|
|
@ -1,223 +1,223 @@
|
||||||
/**
|
/**
|
||||||
* Portions Copyright 2005, Communicative Machines
|
* Portions Copyright 2005, Communicative Machines
|
||||||
* Portions Copyright 2006 DFKI GmbH.
|
* Portions Copyright 2006 DFKI GmbH.
|
||||||
* All Rights Reserved. Use is subject to license terms.
|
* All Rights Reserved. Use is subject to license terms.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to use and distribute
|
* Permission is hereby granted, free of charge, to use and distribute
|
||||||
* this software and its documentation without restriction, including
|
* this software and its documentation without restriction, including
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
* distribute, sublicense, and/or sell copies of this work, and to
|
* distribute, sublicense, and/or sell copies of this work, and to
|
||||||
* permit persons to whom this work is furnished to do so, subject to
|
* permit persons to whom this work is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* 1. The code must retain the above copyright notice, this list of
|
* 1. The code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
* 2. Any modifications must be clearly marked as such.
|
* 2. Any modifications must be clearly marked as such.
|
||||||
* 3. Original authors' names are not deleted.
|
* 3. Original authors' names are not deleted.
|
||||||
* 4. The authors' names are not used to endorse or promote products
|
* 4. The authors' names are not used to endorse or promote products
|
||||||
* derived from this software without specific prior written
|
* derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
* THIS SOFTWARE.
|
* THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
package marytts.client.air;
|
package marytts.client.air;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import javax.xml.transform.Source;
|
import javax.xml.transform.Source;
|
||||||
import javax.xml.transform.Templates;
|
import javax.xml.transform.Templates;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.URIResolver;
|
import javax.xml.transform.URIResolver;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
import javax.xml.transform.stream.StreamSource;
|
import javax.xml.transform.stream.StreamSource;
|
||||||
|
|
||||||
import com.cmlabs.air.DataSample;
|
import com.cmlabs.air.DataSample;
|
||||||
import com.cmlabs.air.Message;
|
import com.cmlabs.air.Message;
|
||||||
import com.cmlabs.air.Time;
|
import com.cmlabs.air.Time;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A PsyClone / OpenAIR module processing BML ("Behavior Markup Language")
|
* A PsyClone / OpenAIR module processing BML ("Behavior Markup Language")
|
||||||
* input and generating audio and enriched-BML output.
|
* input and generating audio and enriched-BML output.
|
||||||
* This can be used as part of a "BML realiser" component,
|
* This can be used as part of a "BML realiser" component,
|
||||||
* e.g. together with the Greta agent.
|
* e.g. together with the Greta agent.
|
||||||
* @author Marc Schröder
|
* @author Marc Schröder
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class BMLSpeechPsydule extends MarySpeechPsydule
|
public class BMLSpeechPsydule extends MarySpeechPsydule
|
||||||
{
|
{
|
||||||
protected String BMLOUTPUTTYPE = "Greta.Data.EnrichedBMLCode";
|
protected String BMLOUTPUTTYPE = "Greta.Data.EnrichedBMLCode";
|
||||||
private Templates bml2ssmlStylesheet;
|
private Templates bml2ssmlStylesheet;
|
||||||
private Templates mergeMaryxmlIntoBMLStylesheet;
|
private Templates mergeMaryxmlIntoBMLStylesheet;
|
||||||
|
|
||||||
public BMLSpeechPsydule(String airhost, int airport) throws Exception
|
public BMLSpeechPsydule(String airhost, int airport) throws Exception
|
||||||
{
|
{
|
||||||
super(airhost, airport);
|
super(airhost, airport);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initialize() throws Exception
|
protected void initialize() throws Exception
|
||||||
{
|
{
|
||||||
name = "BMLSpeechPsydule";
|
name = "BMLSpeechPsydule";
|
||||||
WHITEBOARD = "Greta.Whiteboard";
|
WHITEBOARD = "Greta.Whiteboard";
|
||||||
INPUTTYPE = "Greta.Data.BMLCode";
|
INPUTTYPE = "Greta.Data.BMLCode";
|
||||||
AUDIOOUTPUTTYPE = "Greta.Data.Audio";
|
AUDIOOUTPUTTYPE = "Greta.Data.Audio";
|
||||||
DEFAULTVOICE = System.getProperty("voice.default", "kevin16");
|
DEFAULTVOICE = System.getProperty("voice.default", "kevin16");
|
||||||
BMLOUTPUTTYPE = "Greta.Data.EnrichedBMLCode";
|
BMLOUTPUTTYPE = "Greta.Data.EnrichedBMLCode";
|
||||||
|
|
||||||
TransformerFactory tFactory = TransformerFactory.newInstance();
|
TransformerFactory tFactory = TransformerFactory.newInstance();
|
||||||
|
|
||||||
tFactory.setURIResolver(new URIResolver() {
|
tFactory.setURIResolver(new URIResolver() {
|
||||||
public Source resolve(String href, String base) {
|
public Source resolve(String href, String base) {
|
||||||
if (href.endsWith("ssml-to-mary.xsl")) {
|
if (href.endsWith("ssml-to-mary.xsl")) {
|
||||||
return new StreamSource(this.getClass().getResourceAsStream("ssml-to-mary.xsl"));
|
return new StreamSource(this.getClass().getResourceAsStream("ssml-to-mary.xsl"));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
StreamSource stylesheetStream =
|
StreamSource stylesheetStream =
|
||||||
new StreamSource(this.getClass().getResourceAsStream("bml-to-ssml.xsl"));
|
new StreamSource(this.getClass().getResourceAsStream("bml-to-ssml.xsl"));
|
||||||
bml2ssmlStylesheet = tFactory.newTemplates(stylesheetStream);
|
bml2ssmlStylesheet = tFactory.newTemplates(stylesheetStream);
|
||||||
stylesheetStream = new StreamSource(this.getClass().getResourceAsStream("merge-maryxml-into-bml.xsl"));
|
stylesheetStream = new StreamSource(this.getClass().getResourceAsStream("merge-maryxml-into-bml.xsl"));
|
||||||
mergeMaryxmlIntoBMLStylesheet = tFactory.newTemplates(stylesheetStream);
|
mergeMaryxmlIntoBMLStylesheet = tFactory.newTemplates(stylesheetStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void processInput(String input) throws Exception
|
protected void processInput(String input) throws Exception
|
||||||
{
|
{
|
||||||
System.out.println(new Time().printTime()+" - started processing");
|
System.out.println(new Time().printTime()+" - started processing");
|
||||||
String bml = input;
|
String bml = input;
|
||||||
String ssml = bml2ssml(bml);
|
String ssml = bml2ssml(bml);
|
||||||
System.out.println(new Time().printTime()+" - converted to SSML");
|
System.out.println(new Time().printTime()+" - converted to SSML");
|
||||||
String acoustparams = ssml2acoustparams(ssml);
|
String acoustparams = ssml2acoustparams(ssml);
|
||||||
System.out.println(new Time().printTime()+" - created ACOUSTPARAMS");
|
System.out.println(new Time().printTime()+" - created ACOUSTPARAMS");
|
||||||
String enrichedBML = mergeBmlAndAcoustparams(bml, acoustparams);
|
String enrichedBML = mergeBmlAndAcoustparams(bml, acoustparams);
|
||||||
System.out.println(new Time().printTime()+" - merged phone times into BML");
|
System.out.println(new Time().printTime()+" - merged phone times into BML");
|
||||||
// post enriched BML to whiteboard
|
// post enriched BML to whiteboard
|
||||||
plug.postMessage(WHITEBOARD, BMLOUTPUTTYPE, enrichedBML, "", "");
|
plug.postMessage(WHITEBOARD, BMLOUTPUTTYPE, enrichedBML, "", "");
|
||||||
System.out.println(new Time().printTime()+" - posted enriched BML");
|
System.out.println(new Time().printTime()+" - posted enriched BML");
|
||||||
byte[] audio = acoustparams2audio(acoustparams);
|
byte[] audio = acoustparams2audio(acoustparams);
|
||||||
System.out.println(new Time().printTime()+" - created audio ("+audio.length+" bytes)");
|
System.out.println(new Time().printTime()+" - created audio ("+audio.length+" bytes)");
|
||||||
// post audio to whiteboard
|
// post audio to whiteboard
|
||||||
DataSample audioData = new DataSample();
|
DataSample audioData = new DataSample();
|
||||||
//audioData.fromBinaryBuffer(0, audio, 0, audio.length);
|
//audioData.fromBinaryBuffer(0, audio, 0, audio.length);
|
||||||
audioData.data = audio;
|
audioData.data = audio;
|
||||||
audioData.size = audio.length;
|
audioData.size = audio.length;
|
||||||
Message audioMessage = new Message(name, WHITEBOARD, AUDIOOUTPUTTYPE, audioData);
|
Message audioMessage = new Message(name, WHITEBOARD, AUDIOOUTPUTTYPE, audioData);
|
||||||
plug.postMessage(WHITEBOARD, audioMessage, "");
|
plug.postMessage(WHITEBOARD, audioMessage, "");
|
||||||
System.out.println(new Time().printTime()+" - posted audio");
|
System.out.println(new Time().printTime()+" - posted audio");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the SSML section from the BML data.
|
* Extract the SSML section from the BML data.
|
||||||
* @param bml string representation of a full BML document
|
* @param bml string representation of a full BML document
|
||||||
* containing SSML.
|
* containing SSML.
|
||||||
* @return string representation of a standalone SSML document
|
* @return string representation of a standalone SSML document
|
||||||
* corresponding to the embedded SSML tags
|
* corresponding to the embedded SSML tags
|
||||||
*/
|
*/
|
||||||
private String bml2ssml(String bml) throws Exception
|
private String bml2ssml(String bml) throws Exception
|
||||||
{
|
{
|
||||||
// Extract from BML string the SSML string:
|
// Extract from BML string the SSML string:
|
||||||
StreamSource bmlSource = new StreamSource(new StringReader(bml));
|
StreamSource bmlSource = new StreamSource(new StringReader(bml));
|
||||||
StringWriter ssmlWriter = new StringWriter();
|
StringWriter ssmlWriter = new StringWriter();
|
||||||
StreamResult ssmlResult = new StreamResult(ssmlWriter);
|
StreamResult ssmlResult = new StreamResult(ssmlWriter);
|
||||||
// Transformer is not guaranteed to be thread-safe -- therefore, we
|
// Transformer is not guaranteed to be thread-safe -- therefore, we
|
||||||
// need one per thread.
|
// need one per thread.
|
||||||
Transformer transformer = bml2ssmlStylesheet.newTransformer();
|
Transformer transformer = bml2ssmlStylesheet.newTransformer();
|
||||||
transformer.transform(bmlSource, ssmlResult);
|
transformer.transform(bmlSource, ssmlResult);
|
||||||
return ssmlWriter.toString();
|
return ssmlWriter.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String mergeBmlAndAcoustparams(String bml, final String acoustparams) throws Exception
|
private String mergeBmlAndAcoustparams(String bml, final String acoustparams) throws Exception
|
||||||
{
|
{
|
||||||
StreamSource bmlSource = new StreamSource(new StringReader(bml));
|
StreamSource bmlSource = new StreamSource(new StringReader(bml));
|
||||||
StringWriter mergedWriter = new StringWriter();
|
StringWriter mergedWriter = new StringWriter();
|
||||||
StreamResult mergedResult = new StreamResult(mergedWriter);
|
StreamResult mergedResult = new StreamResult(mergedWriter);
|
||||||
// Transformer is not guaranteed to be thread-safe -- therefore, we
|
// Transformer is not guaranteed to be thread-safe -- therefore, we
|
||||||
// need one per thread.
|
// need one per thread.
|
||||||
Transformer mergingTransformer = mergeMaryxmlIntoBMLStylesheet.newTransformer();
|
Transformer mergingTransformer = mergeMaryxmlIntoBMLStylesheet.newTransformer();
|
||||||
mergingTransformer.setURIResolver(new URIResolver() {
|
mergingTransformer.setURIResolver(new URIResolver() {
|
||||||
public Source resolve(String href, String base) {
|
public Source resolve(String href, String base) {
|
||||||
if (href == null) {
|
if (href == null) {
|
||||||
return null;
|
return null;
|
||||||
} else if (href.equals("mary.acoustparams")) {
|
} else if (href.equals("mary.acoustparams")) {
|
||||||
return new StreamSource(new StringReader(acoustparams));
|
return new StreamSource(new StringReader(acoustparams));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mergingTransformer.transform(bmlSource, mergedResult);
|
mergingTransformer.transform(bmlSource, mergedResult);
|
||||||
return mergedWriter.toString();
|
return mergedWriter.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String ssml2acoustparams(String ssml) throws Exception
|
private String ssml2acoustparams(String ssml) throws Exception
|
||||||
{
|
{
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
mary.process(ssml, "SSML", "ACOUSTPARAMS", "en_US", "WAVE", DEFAULTVOICE, baos);
|
mary.process(ssml, "SSML", "ACOUSTPARAMS", "en_US", "WAVE", DEFAULTVOICE, baos);
|
||||||
return new String(baos.toByteArray(), "UTF-8");
|
return new String(baos.toByteArray(), "UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] acoustparams2audio(String acoustparams) throws Exception
|
private byte[] acoustparams2audio(String acoustparams) throws Exception
|
||||||
{
|
{
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
mary.process(acoustparams, "ACOUSTPARAMS", "AUDIO", "en_US", "WAVE", DEFAULTVOICE, baos);
|
mary.process(acoustparams, "ACOUSTPARAMS", "AUDIO", "en_US", "WAVE", DEFAULTVOICE, baos);
|
||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A standalone program which routes messages between a
|
* A standalone program which routes messages between a
|
||||||
* PsyClone/OpenAIR server and a MARY server.
|
* PsyClone/OpenAIR server and a MARY server.
|
||||||
* The server host and port for both servers can be given as
|
* The server host and port for both servers can be given as
|
||||||
* system properties: Mary server: "server.host"
|
* system properties: Mary server: "server.host"
|
||||||
* (default: cling.dfki.uni-sb.de) and "server.port" (default: 59125);
|
* (default: cling.dfki.uni-sb.de) and "server.port" (default: 59125);
|
||||||
* OpenAIR server: "airserver.host" (default: localhost) and
|
* OpenAIR server: "airserver.host" (default: localhost) and
|
||||||
* "airserver.port" (default: 10000).
|
* "airserver.port" (default: 10000).
|
||||||
* This server will listen for incoming BML files, and
|
* This server will listen for incoming BML files, and
|
||||||
* generate Enriched BML and Audio data from it.
|
* generate Enriched BML and Audio data from it.
|
||||||
* In the current version, the name of the OpenAIR whiteboard
|
* In the current version, the name of the OpenAIR whiteboard
|
||||||
* is hard-coded as "Greta.Whiteboard"; the input data type is
|
* is hard-coded as "Greta.Whiteboard"; the input data type is
|
||||||
* "Greta.Data.BMLCode"; the enriched BML output type is
|
* "Greta.Data.BMLCode"; the enriched BML output type is
|
||||||
* "Greta.Data.EnrichedBMLCode"; and the audio output is
|
* "Greta.Data.EnrichedBMLCode"; and the audio output is
|
||||||
* "Greta.Data.Audio".
|
* "Greta.Data.Audio".
|
||||||
* @param args
|
* @param args
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws Exception
|
public static void main(String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
String airhost = System.getProperty("airserver.host", "localhost");
|
String airhost = System.getProperty("airserver.host", "localhost");
|
||||||
int airport = Integer.getInteger("airserver.port", 10000).intValue();
|
int airport = Integer.getInteger("airserver.port", 10000).intValue();
|
||||||
|
|
||||||
BMLSpeechPsydule reader = new BMLSpeechPsydule(airhost, airport);
|
BMLSpeechPsydule reader = new BMLSpeechPsydule(airhost, airport);
|
||||||
reader.listenAndProcess();
|
reader.listenAndProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,182 +1,182 @@
|
||||||
/**
|
/**
|
||||||
* Portions Copyright 2005, Communicative Machines
|
* Portions Copyright 2005, Communicative Machines
|
||||||
* Portions Copyright 2006 DFKI GmbH.
|
* Portions Copyright 2006 DFKI GmbH.
|
||||||
* All Rights Reserved. Use is subject to license terms.
|
* All Rights Reserved. Use is subject to license terms.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to use and distribute
|
* Permission is hereby granted, free of charge, to use and distribute
|
||||||
* this software and its documentation without restriction, including
|
* this software and its documentation without restriction, including
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
* distribute, sublicense, and/or sell copies of this work, and to
|
* distribute, sublicense, and/or sell copies of this work, and to
|
||||||
* permit persons to whom this work is furnished to do so, subject to
|
* permit persons to whom this work is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* 1. The code must retain the above copyright notice, this list of
|
* 1. The code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
* 2. Any modifications must be clearly marked as such.
|
* 2. Any modifications must be clearly marked as such.
|
||||||
* 3. Original authors' names are not deleted.
|
* 3. Original authors' names are not deleted.
|
||||||
* 4. The authors' names are not used to endorse or promote products
|
* 4. The authors' names are not used to endorse or promote products
|
||||||
* derived from this software without specific prior written
|
* derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
* THIS SOFTWARE.
|
* THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
package marytts.client.air;
|
package marytts.client.air;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
import marytts.client.MaryClient;
|
import marytts.client.MaryClient;
|
||||||
|
|
||||||
import com.cmlabs.air.DataSample;
|
import com.cmlabs.air.DataSample;
|
||||||
import com.cmlabs.air.JavaAIRPlug;
|
import com.cmlabs.air.JavaAIRPlug;
|
||||||
import com.cmlabs.air.Message;
|
import com.cmlabs.air.Message;
|
||||||
import com.cmlabs.air.Time;
|
import com.cmlabs.air.Time;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A PsyClone / OpenAIR module processing SSML
|
* A PsyClone / OpenAIR module processing SSML
|
||||||
* (Speech Synthesis Markup Language)
|
* (Speech Synthesis Markup Language)
|
||||||
* input and generating audio output.
|
* input and generating audio output.
|
||||||
* @author Marc Schröder
|
* @author Marc Schröder
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MarySpeechPsydule
|
public class MarySpeechPsydule
|
||||||
{
|
{
|
||||||
protected String WHITEBOARD;
|
protected String WHITEBOARD;
|
||||||
protected String INPUTTYPE;
|
protected String INPUTTYPE;
|
||||||
protected String AUDIOOUTPUTTYPE;
|
protected String AUDIOOUTPUTTYPE;
|
||||||
protected String DEFAULTVOICE;
|
protected String DEFAULTVOICE;
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
protected JavaAIRPlug plug;
|
protected JavaAIRPlug plug;
|
||||||
protected MaryClient mary;
|
protected MaryClient mary;
|
||||||
|
|
||||||
public MarySpeechPsydule(String airhost, int airport) throws Exception
|
public MarySpeechPsydule(String airhost, int airport) throws Exception
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
mary = MaryClient.getMaryClient();
|
mary = MaryClient.getMaryClient();
|
||||||
plug = new JavaAIRPlug(name, airhost, airport);
|
plug = new JavaAIRPlug(name, airhost, airport);
|
||||||
if (!plug.init()) {
|
if (!plug.init()) {
|
||||||
System.out.println("Could not connect to the Server on " + airhost +
|
System.out.println("Could not connect to the Server on " + airhost +
|
||||||
" on port " + airport + "...");
|
" on port " + airport + "...");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Connected to the AIR Server on " + airhost +
|
System.out.println("Connected to the AIR Server on " + airhost +
|
||||||
":" + airport);
|
":" + airport);
|
||||||
|
|
||||||
if (!plug.openTwoWayConnectionTo(WHITEBOARD)) {
|
if (!plug.openTwoWayConnectionTo(WHITEBOARD)) {
|
||||||
System.out.println("Could not open callback connection to "+WHITEBOARD+"...");
|
System.out.println("Could not open callback connection to "+WHITEBOARD+"...");
|
||||||
}
|
}
|
||||||
|
|
||||||
String xml = "<module name=\""+name+"\"><trigger from=\""+WHITEBOARD+"\" type=\""+INPUTTYPE+"\" /></module>";
|
String xml = "<module name=\""+name+"\"><trigger from=\""+WHITEBOARD+"\" type=\""+INPUTTYPE+"\" /></module>";
|
||||||
|
|
||||||
if (!plug.sendRegistration(xml)) {
|
if (!plug.sendRegistration(xml)) {
|
||||||
System.out.println("Could not register for messages of type "+INPUTTYPE+"...");
|
System.out.println("Could not register for messages of type "+INPUTTYPE+"...");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Listening on whiteboard "+WHITEBOARD+" for messages of type "+INPUTTYPE+"...");
|
System.out.println("Listening on whiteboard "+WHITEBOARD+" for messages of type "+INPUTTYPE+"...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initialize() throws Exception
|
protected void initialize() throws Exception
|
||||||
{
|
{
|
||||||
name = "MarySpeechPsydule";
|
name = "MarySpeechPsydule";
|
||||||
WHITEBOARD = System.getProperty("mary.psyclone.whiteboard", "WB1");
|
WHITEBOARD = System.getProperty("mary.psyclone.whiteboard", "WB1");
|
||||||
INPUTTYPE = "Mary.Input.SSML";
|
INPUTTYPE = "Mary.Input.SSML";
|
||||||
AUDIOOUTPUTTYPE = "Mary.Output.Audio";
|
AUDIOOUTPUTTYPE = "Mary.Output.Audio";
|
||||||
DEFAULTVOICE = System.getProperty("voice.default", "kevin16");
|
DEFAULTVOICE = System.getProperty("voice.default", "kevin16");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void listenAndProcess()
|
public void listenAndProcess()
|
||||||
{
|
{
|
||||||
Message message;
|
Message message;
|
||||||
while (true) {
|
while (true) {
|
||||||
if ( (message = plug.waitForNewMessage(100)) != null) {
|
if ( (message = plug.waitForNewMessage(100)) != null) {
|
||||||
Time start = new Time();
|
Time start = new Time();
|
||||||
System.out.println(start.printTime() + ":" + name
|
System.out.println(start.printTime() + ":" + name
|
||||||
+ ": received wakeup message from " +
|
+ ": received wakeup message from " +
|
||||||
message.from);
|
message.from);
|
||||||
try {
|
try {
|
||||||
String input = message.getContent();
|
String input = message.getContent();
|
||||||
processInput(input);
|
processInput(input);
|
||||||
Time end = new Time();
|
Time end = new Time();
|
||||||
System.out.println("Processing took "+end.difference(start)+" ms");
|
System.out.println("Processing took "+end.difference(start)+" ms");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processInput(String input) throws Exception
|
protected void processInput(String input) throws Exception
|
||||||
{
|
{
|
||||||
byte[] audio = ssml2audio(input);
|
byte[] audio = ssml2audio(input);
|
||||||
System.out.println("Audio: "+audio.length+" bytes");
|
System.out.println("Audio: "+audio.length+" bytes");
|
||||||
// post audio to whiteboard
|
// post audio to whiteboard
|
||||||
DataSample audioData = new DataSample();
|
DataSample audioData = new DataSample();
|
||||||
//audioData.fromBinaryBuffer(0, audio, 0, audio.length);
|
//audioData.fromBinaryBuffer(0, audio, 0, audio.length);
|
||||||
audioData.data = audio;
|
audioData.data = audio;
|
||||||
audioData.size = audio.length;
|
audioData.size = audio.length;
|
||||||
Message audioMessage = new Message(name, WHITEBOARD, AUDIOOUTPUTTYPE, audioData);
|
Message audioMessage = new Message(name, WHITEBOARD, AUDIOOUTPUTTYPE, audioData);
|
||||||
plug.postMessage(WHITEBOARD, audioMessage, "");
|
plug.postMessage(WHITEBOARD, audioMessage, "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private byte[] ssml2audio(String acoustparams) throws Exception
|
private byte[] ssml2audio(String acoustparams) throws Exception
|
||||||
{
|
{
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
mary.process(acoustparams, "SSML", "AUDIO", "en_US", "WAVE", DEFAULTVOICE, baos);
|
mary.process(acoustparams, "SSML", "AUDIO", "en_US", "WAVE", DEFAULTVOICE, baos);
|
||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A standalone program which routes messages between a
|
* A standalone program which routes messages between a
|
||||||
* PsyClone/OpenAIR server and a MARY server.
|
* PsyClone/OpenAIR server and a MARY server.
|
||||||
* The server host and port for both servers can be given as
|
* The server host and port for both servers can be given as
|
||||||
* system properties: Mary server: "server.host"
|
* system properties: Mary server: "server.host"
|
||||||
* (default: cling.dfki.uni-sb.de) and "server.port" (default: 59125);
|
* (default: cling.dfki.uni-sb.de) and "server.port" (default: 59125);
|
||||||
* OpenAIR server: "airserver.host" (default: localhost) and
|
* OpenAIR server: "airserver.host" (default: localhost) and
|
||||||
* "airserver.port" (default: 10000).
|
* "airserver.port" (default: 10000).
|
||||||
* This server will listen for incoming SSML files, and
|
* This server will listen for incoming SSML files, and
|
||||||
* generate Audio data from it.
|
* generate Audio data from it.
|
||||||
* In the current version, the name of the OpenAIR whiteboard
|
* In the current version, the name of the OpenAIR whiteboard
|
||||||
* can be set via the system property "mary.psyclone.whiteboard"
|
* can be set via the system property "mary.psyclone.whiteboard"
|
||||||
* (default: "WB1"); the input data type is
|
* (default: "WB1"); the input data type is
|
||||||
* "Mary.Input.SSML"; and the audio output is
|
* "Mary.Input.SSML"; and the audio output is
|
||||||
* "Greta.Data.Audio".
|
* "Greta.Data.Audio".
|
||||||
* @param args
|
* @param args
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws Exception
|
public static void main(String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
String airhost = System.getProperty("airserver.host", "localhost");
|
String airhost = System.getProperty("airserver.host", "localhost");
|
||||||
int airport = Integer.getInteger("airserver.port", 10000).intValue();
|
int airport = Integer.getInteger("airserver.port", 10000).intValue();
|
||||||
|
|
||||||
MarySpeechPsydule reader = new MarySpeechPsydule(airhost, airport);
|
MarySpeechPsydule reader = new MarySpeechPsydule(airhost, airport);
|
||||||
reader.listenAndProcess();
|
reader.listenAndProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,300 +1,300 @@
|
||||||
/**
|
/**
|
||||||
* Copyright 2000-2008 DFKI GmbH.
|
* Copyright 2000-2008 DFKI GmbH.
|
||||||
* All Rights Reserved. Use is subject to license terms.
|
* All Rights Reserved. Use is subject to license terms.
|
||||||
*
|
*
|
||||||
* This file is part of MARY TTS.
|
* This file is part of MARY TTS.
|
||||||
*
|
*
|
||||||
* MARY TTS is free software: you can redistribute it and/or modify
|
* MARY TTS is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, version 3 of the License.
|
* the Free Software Foundation, version 3 of the License.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package marytts.language.de.infostruct;
|
package marytts.language.de.infostruct;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import marytts.util.MaryUtils;
|
import marytts.util.MaryUtils;
|
||||||
|
|
||||||
import org.apache.log4j.BasicConfigurator;
|
import org.apache.log4j.BasicConfigurator;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* Execute a query in the mySql germanet database.
|
* Execute a query in the mySql germanet database.
|
||||||
* To run it /opt/jdbc/src/ or similar schould be
|
* To run it /opt/jdbc/src/ or similar schould be
|
||||||
* in your classpath.
|
* in your classpath.
|
||||||
*
|
*
|
||||||
* How to run: /opt/jdk-1.4.1/bin/java -cp ./:/opt/jdbc/lib/mysql-connector-java-3.0.9-stable-bin.jar de.dfki.lt.mary.util.GerNetQuery [Word] [pos] [type]
|
* How to run: /opt/jdk-1.4.1/bin/java -cp ./:/opt/jdbc/lib/mysql-connector-java-3.0.9-stable-bin.jar de.dfki.lt.mary.util.GerNetQuery [Word] [pos] [type]
|
||||||
* Run example: /opt/jdk-1.4.1/bin/java -cp ./:/opt/jdbc/lib/mysql-connector-java-3.0.9-stable-bin.jar de.dfki.lt.mary.util.GerNetQuery Welt n hype
|
* Run example: /opt/jdk-1.4.1/bin/java -cp ./:/opt/jdbc/lib/mysql-connector-java-3.0.9-stable-bin.jar de.dfki.lt.mary.util.GerNetQuery Welt n hype
|
||||||
* @author Marilisa Amoia & Massimo Romanelli
|
* @author Marilisa Amoia & Massimo Romanelli
|
||||||
***********************************************/
|
***********************************************/
|
||||||
public class GerNetQuery {
|
public class GerNetQuery {
|
||||||
private Connection con;
|
private Connection con;
|
||||||
private Statement stmt;
|
private Statement stmt;
|
||||||
private static Logger logger = MaryUtils.getLogger("GerNetQuery");
|
private static Logger logger = MaryUtils.getLogger("GerNetQuery");
|
||||||
|
|
||||||
public GerNetQuery(String database, String user, String password) throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
|
public GerNetQuery(String database, String user, String password) throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
|
||||||
connect(database, user, password);
|
connect(database, user, password);
|
||||||
} //constructor
|
} //constructor
|
||||||
|
|
||||||
//Connecting
|
//Connecting
|
||||||
private void connect(String database, String user, String password)
|
private void connect(String database, String user, String password)
|
||||||
throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
|
throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
|
||||||
//Load Driver:
|
//Load Driver:
|
||||||
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
|
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
|
||||||
//Connection to Database
|
//Connection to Database
|
||||||
con =
|
con =
|
||||||
DriverManager.getConnection(
|
DriverManager.getConnection(
|
||||||
"jdbc:mysql://" + database + "?user=" + user + "&password=" + password);
|
"jdbc:mysql://" + database + "?user=" + user + "&password=" + password);
|
||||||
stmt = con.createStatement();
|
stmt = con.createStatement();
|
||||||
} //connect
|
} //connect
|
||||||
|
|
||||||
private void closeResultSet(ResultSet rs){
|
private void closeResultSet(ResultSet rs){
|
||||||
if(rs != null)
|
if(rs != null)
|
||||||
try {
|
try {
|
||||||
rs.close();
|
rs.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSynString(String lex, String pos) {
|
public String getSynString(String lex, String pos) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetWord sw1, SynsetWord sw2 WHERE sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetWord sw1, SynsetWord sw2 WHERE sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Offset=sw2.Offset and sw1.Pos=sw2.Pos and sw2.Word<>sw1.Word ");
|
+ "' AND sw1.Offset=sw2.Offset and sw1.Pos=sw2.Pos and sw2.Word<>sw1.Word ");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.append("#").append(rs.getString("Word"));
|
result.append("#").append(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
|
||||||
} //getSynString
|
} //getSynString
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Vector getSynVector(String lex, String pos) {
|
public Vector getSynVector(String lex, String pos) {
|
||||||
Vector result = new Vector();
|
Vector result = new Vector();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetWord sw1, SynsetWord sw2 WHERE sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetWord sw1, SynsetWord sw2 WHERE sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Offset=sw2.Offset and sw1.Pos=sw2.Pos and sw2.Word<>sw1.Word ");
|
+ "' AND sw1.Offset=sw2.Offset and sw1.Pos=sw2.Pos and sw2.Word<>sw1.Word ");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.add(rs.getString("Word"));
|
result.add(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} //getSynVector
|
} //getSynVector
|
||||||
|
|
||||||
public String getHyperString(String lex, String pos) {
|
public String getHyperString(String lex, String pos) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='@' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='@' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Pos=sw2.Pos");
|
+ "' AND sw1.Pos=sw2.Pos");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.append("#").append(rs.getString("Word"));
|
result.append("#").append(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
|
||||||
} //getHyperString
|
} //getHyperString
|
||||||
|
|
||||||
public Vector getHyperVector(String lex, String pos) {
|
public Vector getHyperVector(String lex, String pos) {
|
||||||
Vector result = new Vector();
|
Vector result = new Vector();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='@' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='@' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Pos=sw2.Pos");
|
+ "' AND sw1.Pos=sw2.Pos");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.add(rs.getString("Word"));
|
result.add(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} //getHyperVector
|
} //getHyperVector
|
||||||
|
|
||||||
public String getHypoString(String lex, String pos) {
|
public String getHypoString(String lex, String pos) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='~' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='~' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Pos=sw2.Pos");
|
+ "' AND sw1.Pos=sw2.Pos");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.append("#").append(rs.getString("Word"));
|
result.append("#").append(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
} //getHypoString
|
} //getHypoString
|
||||||
|
|
||||||
public Vector getHypoVector(String lex, String pos) {
|
public Vector getHypoVector(String lex, String pos) {
|
||||||
Vector result = new Vector();
|
Vector result = new Vector();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='~' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='~' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Pos=sw2.Pos");
|
+ "' AND sw1.Pos=sw2.Pos");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.add(rs.getString("Word"));
|
result.add(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} //getHypoVector
|
} //getHypoVector
|
||||||
|
|
||||||
public String getAntoString(String lex, String pos) {
|
public String getAntoString(String lex, String pos) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='!' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='!' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Pos=sw2.Pos");
|
+ "' AND sw1.Pos=sw2.Pos");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.append("#").append(rs.getString("Word"));
|
result.append("#").append(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
|
||||||
} //getAntoString
|
} //getAntoString
|
||||||
|
|
||||||
public Vector getAntoVector(String lex, String pos) {
|
public Vector getAntoVector(String lex, String pos) {
|
||||||
Vector result = new Vector();
|
Vector result = new Vector();
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
rs =
|
rs =
|
||||||
stmt.executeQuery(
|
stmt.executeQuery(
|
||||||
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='!' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
"SELECT DISTINCT(sw2.Word) FROM SynsetPtr ptr1, SynsetWord sw1, SynsetWord sw2 WHERE ptr1.Ptr='!' AND ptr1.SourcePos=sw1.Pos AND ptr1.SourceOffset=sw1.Offset AND sw2.Offset=ptr1.TargetOffSet AND sw1.Word='"
|
||||||
+ lex
|
+ lex
|
||||||
+ "' AND sw1.Pos='"
|
+ "' AND sw1.Pos='"
|
||||||
+ pos
|
+ pos
|
||||||
+ "' AND sw1.Pos=sw2.Pos");
|
+ "' AND sw1.Pos=sw2.Pos");
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
logger.debug("Germanet Query took " + (endTime - startTime) + " ms.");
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.add(rs.getString("Word"));
|
result.add(rs.getString("Word"));
|
||||||
} //while
|
} //while
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.warn("Cannot access Germanet:", e);
|
logger.warn("Cannot access Germanet:", e);
|
||||||
} finally{
|
} finally{
|
||||||
closeResultSet(rs);
|
closeResultSet(rs);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} //getAntoVector
|
} //getAntoVector
|
||||||
|
|
||||||
public static void main(java.lang.String argv[])
|
public static void main(java.lang.String argv[])
|
||||||
throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
|
throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
|
||||||
GerNetQuery query = new GerNetQuery(System.getProperty("germanet.database"),
|
GerNetQuery query = new GerNetQuery(System.getProperty("germanet.database"),
|
||||||
System.getProperty("germanet.user"), System.getProperty("germanet.password"));
|
System.getProperty("germanet.user"), System.getProperty("germanet.password"));
|
||||||
BasicConfigurator.configure();
|
BasicConfigurator.configure();
|
||||||
Vector result = new Vector();
|
Vector result = new Vector();
|
||||||
if (argv[2].equals("hypo"))
|
if (argv[2].equals("hypo"))
|
||||||
result = query.getHypoVector(argv[0], argv[1]);
|
result = query.getHypoVector(argv[0], argv[1]);
|
||||||
else if (argv[2].equals("hype"))
|
else if (argv[2].equals("hype"))
|
||||||
result = query.getHyperVector(argv[0], argv[1]);
|
result = query.getHyperVector(argv[0], argv[1]);
|
||||||
else if (argv[2].equals("anto"))
|
else if (argv[2].equals("anto"))
|
||||||
result = query.getAntoVector(argv[0], argv[1]);
|
result = query.getAntoVector(argv[0], argv[1]);
|
||||||
else if (argv[2].equals("syn"))
|
else if (argv[2].equals("syn"))
|
||||||
result = query.getSynVector(argv[0], argv[1]);
|
result = query.getSynVector(argv[0], argv[1]);
|
||||||
else if (argv[0].equals("intDef"))
|
else if (argv[0].equals("intDef"))
|
||||||
result = query.getHypoVector("gepäck", "n");
|
result = query.getHypoVector("gepäck", "n");
|
||||||
|
|
||||||
System.out.println("result is: " + (Collection) result);
|
System.out.println("result is: " + (Collection) result);
|
||||||
} //main
|
} //main
|
||||||
|
|
||||||
} //GerNetQuery
|
} //GerNetQuery
|
||||||
|
|
|
@ -1,265 +1,265 @@
|
||||||
/**
|
/**
|
||||||
* Copyright 2000-2008 DFKI GmbH.
|
* Copyright 2000-2008 DFKI GmbH.
|
||||||
* All Rights Reserved. Use is subject to license terms.
|
* All Rights Reserved. Use is subject to license terms.
|
||||||
*
|
*
|
||||||
* This file is part of MARY TTS.
|
* This file is part of MARY TTS.
|
||||||
*
|
*
|
||||||
* MARY TTS is free software: you can redistribute it and/or modify
|
* MARY TTS is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, version 3 of the License.
|
* the Free Software Foundation, version 3 of the License.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package marytts.language.de.infostruct;
|
package marytts.language.de.infostruct;
|
||||||
|
|
||||||
import marytts.util.MaryUtils;
|
import marytts.util.MaryUtils;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
public class Stemmer {
|
public class Stemmer {
|
||||||
|
|
||||||
private String vowels = "aeiouyäöü";
|
private String vowels = "aeiouyäöü";
|
||||||
private String sEndings = "bdfghklmnrt";
|
private String sEndings = "bdfghklmnrt";
|
||||||
private String stEndings = "bdfghklmnt";
|
private String stEndings = "bdfghklmnt";
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
public Stemmer() {
|
public Stemmer() {
|
||||||
logger = MaryUtils.getLogger("Stemmer");
|
logger = MaryUtils.getLogger("Stemmer");
|
||||||
}
|
}
|
||||||
|
|
||||||
//extract the stemm of the original word
|
//extract the stemm of the original word
|
||||||
public String findStem(String word) {
|
public String findStem(String word) {
|
||||||
word = prepareWord(word);
|
word = prepareWord(word);
|
||||||
// print prepared word
|
// print prepared word
|
||||||
|
|
||||||
int posR1 = calculateR(word, 0, 2); //(word, 0);
|
int posR1 = calculateR(word, 0, 2); //(word, 0);
|
||||||
int posR2 = calculateR(word, posR1, 0);
|
int posR2 = calculateR(word, posR1, 0);
|
||||||
// R1 is the region after the first non-vowel following a vowel
|
// R1 is the region after the first non-vowel following a vowel
|
||||||
String r1 = word.substring(posR1, word.length());
|
String r1 = word.substring(posR1, word.length());
|
||||||
// R2 is the region after the first non-vowel following a vowel in R1
|
// R2 is the region after the first non-vowel following a vowel in R1
|
||||||
String r2 = word.substring(posR2, word.length());
|
String r2 = word.substring(posR2, word.length());
|
||||||
// print R1 and R2
|
// print R1 and R2
|
||||||
|
|
||||||
String wordWithoutR1 = word.substring(0, posR1);
|
String wordWithoutR1 = word.substring(0, posR1);
|
||||||
// print beginn of word
|
// print beginn of word
|
||||||
|
|
||||||
//begin the cut-endings operation
|
//begin the cut-endings operation
|
||||||
String r1AfterStep1 = step1(word, r1);
|
String r1AfterStep1 = step1(word, r1);
|
||||||
// print cutted word after step1
|
// print cutted word after step1
|
||||||
|
|
||||||
String r1AfterStep2 = step2(wordWithoutR1 + r1AfterStep1, r1AfterStep1);
|
String r1AfterStep2 = step2(wordWithoutR1 + r1AfterStep1, r1AfterStep1);
|
||||||
// print cutted word after step2
|
// print cutted word after step2
|
||||||
|
|
||||||
//result = step3(wordWithoutR1+result,result,r2);
|
//result = step3(wordWithoutR1+result,result,r2);
|
||||||
//System.out.println("step3: " +wordWithoutR1 + result);
|
//System.out.println("step3: " +wordWithoutR1 + result);
|
||||||
// return wordWithoutR1+result;
|
// return wordWithoutR1+result;
|
||||||
String result = finalAdjust(wordWithoutR1 + r1AfterStep2);
|
String result = finalAdjust(wordWithoutR1 + r1AfterStep2);
|
||||||
logger.debug(word + " => " + wordWithoutR1 + "|" + r1 +
|
logger.debug(word + " => " + wordWithoutR1 + "|" + r1 +
|
||||||
" => (step1)" + wordWithoutR1 + r1AfterStep1 +
|
" => (step1)" + wordWithoutR1 + r1AfterStep1 +
|
||||||
" => (step2)" + wordWithoutR1 + r1AfterStep2 +
|
" => (step2)" + wordWithoutR1 + r1AfterStep2 +
|
||||||
" => " + result);
|
" => " + result);
|
||||||
return result;
|
return result;
|
||||||
} //findStemm
|
} //findStemm
|
||||||
|
|
||||||
private String prepareWord(String word) {
|
private String prepareWord(String word) {
|
||||||
String result = Character.toString(word.charAt(0));
|
String result = Character.toString(word.charAt(0));
|
||||||
for (int i = 1; i < word.length(); i++) {
|
for (int i = 1; i < word.length(); i++) {
|
||||||
switch (word.charAt(i)) {
|
switch (word.charAt(i)) {
|
||||||
case 'u' :
|
case 'u' :
|
||||||
{
|
{
|
||||||
if ((i != (word.length() - 1))
|
if ((i != (word.length() - 1))
|
||||||
&& (vowels.indexOf(word.charAt(i - 1)) > -1)
|
&& (vowels.indexOf(word.charAt(i - 1)) > -1)
|
||||||
&& (vowels.indexOf(word.charAt(i + 1)) > -1)) {
|
&& (vowels.indexOf(word.charAt(i + 1)) > -1)) {
|
||||||
result = result + "U";
|
result = result + "U";
|
||||||
} //if
|
} //if
|
||||||
else
|
else
|
||||||
result = result + word.charAt(i);
|
result = result + word.charAt(i);
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
case 'y' :
|
case 'y' :
|
||||||
{
|
{
|
||||||
if ((i != (word.length() - 1))
|
if ((i != (word.length() - 1))
|
||||||
&& (vowels.indexOf(word.charAt(i - 1)) > -1)
|
&& (vowels.indexOf(word.charAt(i - 1)) > -1)
|
||||||
&& (vowels.indexOf(word.charAt(i + 1)) > -1)) {
|
&& (vowels.indexOf(word.charAt(i + 1)) > -1)) {
|
||||||
result = result + "Y";
|
result = result + "Y";
|
||||||
} //if
|
} //if
|
||||||
else
|
else
|
||||||
result = result + word.charAt(i);
|
result = result + word.charAt(i);
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
case 'ß' :
|
case 'ß' :
|
||||||
{
|
{
|
||||||
result = result + "ss";
|
result = result + "ss";
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
result = result + word.charAt(i);
|
result = result + word.charAt(i);
|
||||||
break;
|
break;
|
||||||
} //default
|
} //default
|
||||||
} //switch
|
} //switch
|
||||||
} //for
|
} //for
|
||||||
return result;
|
return result;
|
||||||
} //prepareWord
|
} //prepareWord
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to cut off a simple suffix, corresponding to adjective/noun inflection endings.
|
* Try to cut off a simple suffix, corresponding to adjective/noun inflection endings.
|
||||||
* @param word
|
* @param word
|
||||||
* @param r1
|
* @param r1
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String step1(String word, String r1) {
|
private String step1(String word, String r1) {
|
||||||
String result = r1;
|
String result = r1;
|
||||||
if (r1.endsWith("ern")) {
|
if (r1.endsWith("ern")) {
|
||||||
result = result.substring(0, result.length() - 3);
|
result = result.substring(0, result.length() - 3);
|
||||||
} else if (r1.endsWith("er") || r1.endsWith("es") || r1.endsWith("em") || r1.endsWith("en")) {
|
} else if (r1.endsWith("er") || r1.endsWith("es") || r1.endsWith("em") || r1.endsWith("en")) {
|
||||||
result = result.substring(0, result.length() - 2);
|
result = result.substring(0, result.length() - 2);
|
||||||
} else if (r1.endsWith("e") || (r1.endsWith("s") && (sEndings.indexOf(word.charAt(word.length() - 2)) > -1))) {
|
} else if (r1.endsWith("e") || (r1.endsWith("s") && (sEndings.indexOf(word.charAt(word.length() - 2)) > -1))) {
|
||||||
result = result.substring(0, result.length() - 1);
|
result = result.substring(0, result.length() - 1);
|
||||||
} //else if
|
} //else if
|
||||||
return result;
|
return result;
|
||||||
} //step1
|
} //step1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to cut off a longer suffix, taking into account Komparativ and Superlativ forms
|
* Try to cut off a longer suffix, taking into account Komparativ and Superlativ forms
|
||||||
* of adjectives.
|
* of adjectives.
|
||||||
* @param word
|
* @param word
|
||||||
* @param r
|
* @param r
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String step2(String word, String r) {
|
private String step2(String word, String r) {
|
||||||
String result = r;
|
String result = r;
|
||||||
if (r.endsWith("est")) {
|
if (r.endsWith("est")) {
|
||||||
result = result.substring(0, result.length() - 3);
|
result = result.substring(0, result.length() - 3);
|
||||||
} else if (
|
} else if (
|
||||||
r.endsWith("er")
|
r.endsWith("er")
|
||||||
|| r.endsWith("en")
|
|| r.endsWith("en")
|
||||||
|| (r.endsWith("st")
|
|| (r.endsWith("st")
|
||||||
&& (stEndings.indexOf(word.charAt(word.length() - 3)) > -1)
|
&& (stEndings.indexOf(word.charAt(word.length() - 3)) > -1)
|
||||||
&& (word.length() - 3 > 2))) {
|
&& (word.length() - 3 > 2))) {
|
||||||
result = result.substring(0, result.length() - 2);
|
result = result.substring(0, result.length() - 2);
|
||||||
} //else if
|
} //else if
|
||||||
return result;
|
return result;
|
||||||
} //step2
|
} //step2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to cut of adjective- and noun-building suffixes.
|
* Try to cut of adjective- and noun-building suffixes.
|
||||||
* @param word
|
* @param word
|
||||||
* @param r1
|
* @param r1
|
||||||
* @param r2
|
* @param r2
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String step3(String word, String r1, String r2) {
|
private String step3(String word, String r1, String r2) {
|
||||||
String result = r1;
|
String result = r1;
|
||||||
if (r2.endsWith("isch") && (r1.charAt(r1.length() - 4) != 'e')) {
|
if (r2.endsWith("isch") && (r1.charAt(r1.length() - 4) != 'e')) {
|
||||||
result = result.substring(0, result.length() - 4);
|
result = result.substring(0, result.length() - 4);
|
||||||
} else if (r2.endsWith("lich") || r2.endsWith("heit")) {
|
} else if (r2.endsWith("lich") || r2.endsWith("heit")) {
|
||||||
if (r1.endsWith("erlich") || r1.endsWith("enlich")) {
|
if (r1.endsWith("erlich") || r1.endsWith("enlich")) {
|
||||||
result = result.substring(0, result.length() - 6);
|
result = result.substring(0, result.length() - 6);
|
||||||
} else
|
} else
|
||||||
result = result.substring(0, result.length() - 4);
|
result = result.substring(0, result.length() - 4);
|
||||||
} else if (r2.endsWith("keit")) {
|
} else if (r2.endsWith("keit")) {
|
||||||
if (r2.endsWith("lichkeit")) {
|
if (r2.endsWith("lichkeit")) {
|
||||||
result = result.substring(0, result.length() - 8);
|
result = result.substring(0, result.length() - 8);
|
||||||
} else if (r2.endsWith("igkeit")) {
|
} else if (r2.endsWith("igkeit")) {
|
||||||
result = result.substring(0, result.length() - 6);
|
result = result.substring(0, result.length() - 6);
|
||||||
} else
|
} else
|
||||||
result = result.substring(0, result.length() - 4);
|
result = result.substring(0, result.length() - 4);
|
||||||
} else if (r2.endsWith("end") || r2.endsWith("ung")) {
|
} else if (r2.endsWith("end") || r2.endsWith("ung")) {
|
||||||
if ((r2.substring(0, r2.length() - 3)).endsWith("ig") && (r1.charAt(r1.length() - 5) != 'e')) {
|
if ((r2.substring(0, r2.length() - 3)).endsWith("ig") && (r1.charAt(r1.length() - 5) != 'e')) {
|
||||||
result = result.substring(0, result.length() - 5);
|
result = result.substring(0, result.length() - 5);
|
||||||
} else
|
} else
|
||||||
result = result.substring(0, result.length() - 3);
|
result = result.substring(0, result.length() - 3);
|
||||||
} else if ((r2.endsWith("ig") || r2.endsWith("ik")) && r1.charAt(r1.length() - 3) != 'e') {
|
} else if ((r2.endsWith("ig") || r2.endsWith("ik")) && r1.charAt(r1.length() - 3) != 'e') {
|
||||||
result = result.substring(0, result.length() - 2);
|
result = result.substring(0, result.length() - 2);
|
||||||
} //else if
|
} //else if
|
||||||
return result;
|
return result;
|
||||||
} // step3
|
} // step3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In the given word, and starting from a given index, find the first consonant
|
* In the given word, and starting from a given index, find the first consonant
|
||||||
* after a vowel sequence and return the position after that consonant, or
|
* after a vowel sequence and return the position after that consonant, or
|
||||||
* constraint, whichever is larger.
|
* constraint, whichever is larger.
|
||||||
* @param word the string in which to search for a V-C pattern
|
* @param word the string in which to search for a V-C pattern
|
||||||
* @param index index in word from which to start
|
* @param index index in word from which to start
|
||||||
* @param constraint minimum return value
|
* @param constraint minimum return value
|
||||||
* @return the position after the consonant, or constraint, whichever is larger.
|
* @return the position after the consonant, or constraint, whichever is larger.
|
||||||
*/
|
*/
|
||||||
private int calculateR(String word, int index, int constraint) {
|
private int calculateR(String word, int index, int constraint) {
|
||||||
int result = index;
|
int result = index;
|
||||||
for (int i = index; i < word.length(); i++) {
|
for (int i = index; i < word.length(); i++) {
|
||||||
if (vowels.indexOf(word.charAt(i)) > -1) {
|
if (vowels.indexOf(word.charAt(i)) > -1) {
|
||||||
for (int j = i; j < word.length(); j++) {
|
for (int j = i; j < word.length(); j++) {
|
||||||
if ((vowels.indexOf(word.charAt(j)) == -1) && j > 1) {
|
if ((vowels.indexOf(word.charAt(j)) == -1) && j > 1) {
|
||||||
result = ++j;
|
result = ++j;
|
||||||
if (result > constraint) {
|
if (result > constraint) {
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
result = constraint;
|
result = constraint;
|
||||||
} //if
|
} //if
|
||||||
} // for:j
|
} // for:j
|
||||||
break;
|
break;
|
||||||
} //if
|
} //if
|
||||||
} // for:i
|
} // for:i
|
||||||
return result;
|
return result;
|
||||||
} //calculateR
|
} //calculateR
|
||||||
|
|
||||||
private String finalAdjust(String word) {
|
private String finalAdjust(String word) {
|
||||||
|
|
||||||
String result = Character.toString(word.charAt(0));
|
String result = Character.toString(word.charAt(0));
|
||||||
|
|
||||||
for (int i = 1; i < word.length(); i++) {
|
for (int i = 1; i < word.length(); i++) {
|
||||||
|
|
||||||
switch (word.charAt(i)) {
|
switch (word.charAt(i)) {
|
||||||
case 'U' :
|
case 'U' :
|
||||||
{
|
{
|
||||||
result = result + "u";
|
result = result + "u";
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
case 'Y' :
|
case 'Y' :
|
||||||
{
|
{
|
||||||
result = result + "y";
|
result = result + "y";
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
case 'ä' :
|
case 'ä' :
|
||||||
{
|
{
|
||||||
result = result + "a";
|
result = result + "a";
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
case 'ö' :
|
case 'ö' :
|
||||||
{
|
{
|
||||||
result = result + "o";
|
result = result + "o";
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
case 'ü' :
|
case 'ü' :
|
||||||
{
|
{
|
||||||
result = result + "u";
|
result = result + "u";
|
||||||
break;
|
break;
|
||||||
} //case
|
} //case
|
||||||
|
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
result = result + word.charAt(i);
|
result = result + word.charAt(i);
|
||||||
break;
|
break;
|
||||||
} //default
|
} //default
|
||||||
} //switch
|
} //switch
|
||||||
|
|
||||||
} //for
|
} //for
|
||||||
//result = result.substring(0,word.length());
|
//result = result.substring(0,word.length());
|
||||||
return result;
|
return result;
|
||||||
} //finalAdjust
|
} //finalAdjust
|
||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
Stemmer stemmer = new Stemmer();
|
Stemmer stemmer = new Stemmer();
|
||||||
System.out.println("RESULT: " + stemmer.findStem(args[0]));
|
System.out.println("RESULT: " + stemmer.findStem(args[0]));
|
||||||
} //main
|
} //main
|
||||||
|
|
||||||
} //Stemmer
|
} //Stemmer
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,135 +1,135 @@
|
||||||
/**
|
/**
|
||||||
* Copyright 2000-2006 DFKI GmbH.
|
* Copyright 2000-2006 DFKI GmbH.
|
||||||
* All Rights Reserved. Use is subject to license terms.
|
* All Rights Reserved. Use is subject to license terms.
|
||||||
*
|
*
|
||||||
* This file is part of MARY TTS.
|
* This file is part of MARY TTS.
|
||||||
*
|
*
|
||||||
* MARY TTS is free software: you can redistribute it and/or modify
|
* MARY TTS is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, version 3 of the License.
|
* the Free Software Foundation, version 3 of the License.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package marytts.language.tib;
|
package marytts.language.tib;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import marytts.language.tib.datatypes.TibetanDataTypes;
|
import marytts.language.tib.datatypes.TibetanDataTypes;
|
||||||
import marytts.modules.ProsodyGeneric;
|
import marytts.modules.ProsodyGeneric;
|
||||||
import marytts.util.dom.DomUtils;
|
import marytts.util.dom.DomUtils;
|
||||||
import marytts.util.dom.MaryDomUtils;
|
import marytts.util.dom.MaryDomUtils;
|
||||||
import marytts.util.dom.NameNodeFilter;
|
import marytts.util.dom.NameNodeFilter;
|
||||||
|
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
import org.w3c.dom.traversal.DocumentTraversal;
|
import org.w3c.dom.traversal.DocumentTraversal;
|
||||||
import org.w3c.dom.traversal.NodeFilter;
|
import org.w3c.dom.traversal.NodeFilter;
|
||||||
import org.w3c.dom.traversal.TreeWalker;
|
import org.w3c.dom.traversal.TreeWalker;
|
||||||
|
|
||||||
|
|
||||||
public class Prosody extends ProsodyGeneric
|
public class Prosody extends ProsodyGeneric
|
||||||
{
|
{
|
||||||
public Prosody()
|
public Prosody()
|
||||||
{
|
{
|
||||||
super(TibetanDataTypes.TONES_TIB,
|
super(TibetanDataTypes.TONES_TIB,
|
||||||
TibetanDataTypes.PHRASES_TIB,
|
TibetanDataTypes.PHRASES_TIB,
|
||||||
new Locale("tib"),
|
new Locale("tib"),
|
||||||
"tibetan.prosody.tobipredparams", null, null, "tibetan.prosody.paragraphdeclination");
|
"tibetan.prosody.tobipredparams", null, null, "tibetan.prosody.paragraphdeclination");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Currently, no accents assigned for Tibetan.
|
* Currently, no accents assigned for Tibetan.
|
||||||
* @param token a token element
|
* @param token a token element
|
||||||
* @param accent the accent string to assign.
|
* @param accent the accent string to assign.
|
||||||
*/
|
*/
|
||||||
protected void setAccent(Element token, String accent)
|
protected void setAccent(Element token, String accent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks if a boundary is to be inserted after the current token
|
/** Checks if a boundary is to be inserted after the current token
|
||||||
* Override default implementation in order not to assign boundary
|
* Override default implementation in order not to assign boundary
|
||||||
* tones, but only break indices (no tones in Tibetan yet).
|
* tones, but only break indices (no tones in Tibetan yet).
|
||||||
* @param token (current token)
|
* @param token (current token)
|
||||||
* @param tokens (list of tokens in sentence)
|
* @param tokens (list of tokens in sentence)
|
||||||
* @param position (position in token list)
|
* @param position (position in token list)
|
||||||
* @param sentenceType (declarative, exclamative or interrogative)
|
* @param sentenceType (declarative, exclamative or interrogative)
|
||||||
* @param specialPositionType (endofvorfeld if sentence has vorfeld and the next token is a finite verb or end of paragraph)
|
* @param specialPositionType (endofvorfeld if sentence has vorfeld and the next token is a finite verb or end of paragraph)
|
||||||
* @param invalidXML (true if xml structure allows boundary insertion)
|
* @param invalidXML (true if xml structure allows boundary insertion)
|
||||||
* @param firstTokenInPhrase (begin of intonation phrase)
|
* @param firstTokenInPhrase (begin of intonation phrase)
|
||||||
* @return firstTokenInPhrase (if a boundary was inserted, firstTokenInPhrase gets null)
|
* @return firstTokenInPhrase (if a boundary was inserted, firstTokenInPhrase gets null)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected Element getBoundary(Element token, NodeList tokens, int position,
|
protected Element getBoundary(Element token, NodeList tokens, int position,
|
||||||
String sentenceType, String specialPositionType,
|
String sentenceType, String specialPositionType,
|
||||||
boolean invalidXML, Element firstTokenInPhrase)
|
boolean invalidXML, Element firstTokenInPhrase)
|
||||||
{
|
{
|
||||||
|
|
||||||
String tokenText = MaryDomUtils.tokenText(token); // text of current token
|
String tokenText = MaryDomUtils.tokenText(token); // text of current token
|
||||||
|
|
||||||
Element ruleList = null;
|
Element ruleList = null;
|
||||||
// only the "boundaries" rules are relevant
|
// only the "boundaries" rules are relevant
|
||||||
ruleList = (Element) tobiPredMap.get("boundaries");
|
ruleList = (Element) tobiPredMap.get("boundaries");
|
||||||
// search for concrete rules (search for tag "rule")
|
// search for concrete rules (search for tag "rule")
|
||||||
TreeWalker tw = ((DocumentTraversal) ruleList.getOwnerDocument())
|
TreeWalker tw = ((DocumentTraversal) ruleList.getOwnerDocument())
|
||||||
.createTreeWalker(ruleList, NodeFilter.SHOW_ELEMENT,
|
.createTreeWalker(ruleList, NodeFilter.SHOW_ELEMENT,
|
||||||
new NameNodeFilter(new String[] { "rule" }), false);
|
new NameNodeFilter(new String[] { "rule" }), false);
|
||||||
|
|
||||||
boolean rule_fired = false;
|
boolean rule_fired = false;
|
||||||
Element rule = null;
|
Element rule = null;
|
||||||
|
|
||||||
// search for appropriate rules; the top rule has highest prority
|
// search for appropriate rules; the top rule has highest prority
|
||||||
// if a rule fires (that is: all the conditions are fulfilled), the boundary is inserted and the loop stops
|
// if a rule fires (that is: all the conditions are fulfilled), the boundary is inserted and the loop stops
|
||||||
while (!rule_fired && (rule = (Element) tw.nextNode()) != null) {
|
while (!rule_fired && (rule = (Element) tw.nextNode()) != null) {
|
||||||
// rule = the whole rule
|
// rule = the whole rule
|
||||||
// currentRulePart = part of the rule (condition or action)
|
// currentRulePart = part of the rule (condition or action)
|
||||||
Element currentRulePart = DomUtils.getFirstChildElement(rule);
|
Element currentRulePart = DomUtils.getFirstChildElement(rule);
|
||||||
|
|
||||||
while (!rule_fired && currentRulePart != null) {
|
while (!rule_fired && currentRulePart != null) {
|
||||||
boolean conditionSatisfied = false;
|
boolean conditionSatisfied = false;
|
||||||
|
|
||||||
// if rule part with tag "action": boundary insertion
|
// if rule part with tag "action": boundary insertion
|
||||||
if (currentRulePart.getTagName().equals("action")) {
|
if (currentRulePart.getTagName().equals("action")) {
|
||||||
int bi = Integer.parseInt(currentRulePart
|
int bi = Integer.parseInt(currentRulePart
|
||||||
.getAttribute("bi"));
|
.getAttribute("bi"));
|
||||||
if (bi == 0) {
|
if (bi == 0) {
|
||||||
// no boundary insertion
|
// no boundary insertion
|
||||||
} else if ((bi >= 4) && (bi <= 6)) {
|
} else if ((bi >= 4) && (bi <= 6)) {
|
||||||
if (!invalidXML) {
|
if (!invalidXML) {
|
||||||
insertMajorBoundary(tokens, position,
|
insertMajorBoundary(tokens, position,
|
||||||
firstTokenInPhrase, null, bi);
|
firstTokenInPhrase, null, bi);
|
||||||
firstTokenInPhrase = null;
|
firstTokenInPhrase = null;
|
||||||
} else
|
} else
|
||||||
insertBoundary(token, null, bi);
|
insertBoundary(token, null, bi);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
insertBoundary(token, null, bi);
|
insertBoundary(token, null, bi);
|
||||||
rule_fired = true;
|
rule_fired = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the condition is satisfied
|
// check if the condition is satisfied
|
||||||
conditionSatisfied = checkRulePart(currentRulePart, token,
|
conditionSatisfied = checkRulePart(currentRulePart, token,
|
||||||
tokens, position, sentenceType, specialPositionType,
|
tokens, position, sentenceType, specialPositionType,
|
||||||
tokenText);
|
tokenText);
|
||||||
if (!conditionSatisfied)
|
if (!conditionSatisfied)
|
||||||
break; // condition violated, try next rule
|
break; // condition violated, try next rule
|
||||||
|
|
||||||
// the previous conditions are satisfied --> check the next rule part
|
// the previous conditions are satisfied --> check the next rule part
|
||||||
currentRulePart = DomUtils
|
currentRulePart = DomUtils
|
||||||
.getNextSiblingElement(currentRulePart);
|
.getNextSiblingElement(currentRulePart);
|
||||||
}//while loop that checks the rule parts
|
}//while loop that checks the rule parts
|
||||||
} // while loop that checks the whole rule
|
} // while loop that checks the whole rule
|
||||||
return firstTokenInPhrase;
|
return firstTokenInPhrase;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -17,8 +17,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package marytts.signalproc.demo;
|
package marytts.signalproc.demo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -36,81 +36,81 @@ import marytts.util.data.BufferedDoubleDataSource;
|
||||||
import marytts.util.data.DoubleDataSource;
|
import marytts.util.data.DoubleDataSource;
|
||||||
import marytts.util.data.SequenceDoubleDataSource;
|
import marytts.util.data.SequenceDoubleDataSource;
|
||||||
import marytts.util.data.audio.AudioDoubleDataSource;
|
import marytts.util.data.audio.AudioDoubleDataSource;
|
||||||
|
|
||||||
|
|
||||||
public class LPCCrossSynthesisOnline extends LPCAnalysisResynthesis {
|
public class LPCCrossSynthesisOnline extends LPCAnalysisResynthesis {
|
||||||
protected int frameLength;
|
protected int frameLength;
|
||||||
protected AudioInputStream residualStream;
|
protected AudioInputStream residualStream;
|
||||||
protected DoubleDataSource newResidual;
|
protected DoubleDataSource newResidual;
|
||||||
protected DoubleDataSource padding1;
|
protected DoubleDataSource padding1;
|
||||||
protected DoubleDataSource paddedExcitation;
|
protected DoubleDataSource paddedExcitation;
|
||||||
protected FrameProvider newResidualAudioFrames;
|
protected FrameProvider newResidualAudioFrames;
|
||||||
protected int samplingRate;
|
protected int samplingRate;
|
||||||
protected InputStream resStream;
|
protected InputStream resStream;
|
||||||
protected String resFile;
|
protected String resFile;
|
||||||
|
|
||||||
public LPCCrossSynthesisOnline(int p, int frmLen, String inResFile, int fs)
|
public LPCCrossSynthesisOnline(int p, int frmLen, String inResFile, int fs)
|
||||||
{
|
{
|
||||||
super(p);
|
super(p);
|
||||||
|
|
||||||
this.resFile = inResFile;
|
this.resFile = inResFile;
|
||||||
this.frameLength = frmLen;
|
this.frameLength = frmLen;
|
||||||
this.samplingRate = fs;
|
this.samplingRate = fs;
|
||||||
|
|
||||||
this.resStream = null;
|
this.resStream = null;
|
||||||
this.residualStream = null;
|
this.residualStream = null;
|
||||||
this.newResidual = null;
|
this.newResidual = null;
|
||||||
this.padding1 = null;
|
this.padding1 = null;
|
||||||
this.paddedExcitation = null;
|
this.paddedExcitation = null;
|
||||||
this.newResidualAudioFrames = null;
|
this.newResidualAudioFrames = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace residual with new residual from audio signal,
|
* Replace residual with new residual from audio signal,
|
||||||
* adapting the gain in order to maintain overall volume.
|
* adapting the gain in order to maintain overall volume.
|
||||||
*/
|
*/
|
||||||
protected void processLPC(LpCoeffs coeffs, double[] residual)
|
protected void processLPC(LpCoeffs coeffs, double[] residual)
|
||||||
{
|
{
|
||||||
if (newResidualAudioFrames==null || !newResidualAudioFrames.hasMoreData())
|
if (newResidualAudioFrames==null || !newResidualAudioFrames.hasMoreData())
|
||||||
{
|
{
|
||||||
resStream = ChangeMyVoiceUI.class.getResourceAsStream(resFile);
|
resStream = ChangeMyVoiceUI.class.getResourceAsStream(resFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
residualStream = AudioSystem.getAudioInputStream(resStream);
|
residualStream = AudioSystem.getAudioInputStream(resStream);
|
||||||
} catch (UnsupportedAudioFileException e) {
|
} catch (UnsupportedAudioFileException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
newResidual = new AudioDoubleDataSource(residualStream);
|
newResidual = new AudioDoubleDataSource(residualStream);
|
||||||
padding1 = new BufferedDoubleDataSource(new double[3*frameLength/4]);
|
padding1 = new BufferedDoubleDataSource(new double[3*frameLength/4]);
|
||||||
paddedExcitation = new SequenceDoubleDataSource(new DoubleDataSource[]{padding1, newResidual});
|
paddedExcitation = new SequenceDoubleDataSource(new DoubleDataSource[]{padding1, newResidual});
|
||||||
newResidualAudioFrames = new FrameProvider(paddedExcitation, Window.get(Window.HANNING, frameLength, 0.5), frameLength, frameLength/4, samplingRate, false);
|
newResidualAudioFrames = new FrameProvider(paddedExcitation, Window.get(Window.HANNING, frameLength, 0.5), frameLength, frameLength/4, samplingRate, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
double gain = coeffs.getGain();
|
double gain = coeffs.getGain();
|
||||||
double[] frame = newResidualAudioFrames.getNextFrame();
|
double[] frame = newResidualAudioFrames.getNextFrame();
|
||||||
|
|
||||||
assert frame.length == residual.length;
|
assert frame.length == residual.length;
|
||||||
|
|
||||||
int excP = 3;
|
int excP = 3;
|
||||||
LpCoeffs newCoeffs = LpcAnalyser.calcLPC(frame, excP);
|
LpCoeffs newCoeffs = LpcAnalyser.calcLPC(frame, excP);
|
||||||
double newResidualGain = newCoeffs.getGain();
|
double newResidualGain = newCoeffs.getGain();
|
||||||
//double[] newResidual = ArrayUtils.subarray(new FIRFilter(oneMinusA).apply(frame),0,frame.length);
|
//double[] newResidual = ArrayUtils.subarray(new FIRFilter(oneMinusA).apply(frame),0,frame.length);
|
||||||
//System.arraycopy(newResidual, 0, residual, 0, residual.length);
|
//System.arraycopy(newResidual, 0, residual, 0, residual.length);
|
||||||
double gainFactor = gain/newResidualGain;
|
double gainFactor = gain/newResidualGain;
|
||||||
Arrays.fill(residual, 0);
|
Arrays.fill(residual, 0);
|
||||||
for (int n=0; n<residual.length; n++) {
|
for (int n=0; n<residual.length; n++) {
|
||||||
for (int i=0; i<=excP && i<=n; i++) {
|
for (int i=0; i<=excP && i<=n; i++) {
|
||||||
residual[n] += newCoeffs.getOneMinusA(i) * frame[n-i];
|
residual[n] += newCoeffs.getOneMinusA(i) * frame[n-i];
|
||||||
}
|
}
|
||||||
residual[n] *= gainFactor;
|
residual[n] *= gainFactor;
|
||||||
}
|
}
|
||||||
// System.out.println("Gain:" + coeffs.getGain() + ", otherGain:"+newCoeffs.getGain()+", factor="+gainFactor);
|
// System.out.println("Gain:" + coeffs.getGain() + ", otherGain:"+newCoeffs.getGain()+", factor="+gainFactor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче