marytts.language.de.preprocess
Class SpecialCharEP

java.lang.Object
  extended by marytts.language.de.preprocess.ExpansionPattern
      extended by marytts.language.de.preprocess.SpecialCharEP

public class SpecialCharEP
extends ExpansionPattern

An expansion pattern implementation for specialChar patterns.

Author:
Marc Schröder

Field Summary
protected  java.lang.String sMatchingChars
           
protected  java.lang.String sMatchingCharsSimpleString
           
 
Fields inherited from class marytts.language.de.preprocess.ExpansionPattern
abbrev, composite, currency, date, duration, measure, multiword, net, number, specialChar, telephone, time
 
Constructor Summary
SpecialCharEP()
           
 
Method Summary
protected  int canDealWith(java.lang.String s, int type)
          Decide whether we can expand a string according to type typeCode.
protected  boolean doPronounce(java.lang.String specialChar)
           
protected  java.util.List expand(java.util.List tokens, java.lang.String s, int type)
          Subclasses do their expansion in this class.
protected  java.util.List expandSpecialChar(org.w3c.dom.Document doc, java.lang.String s)
           
protected  java.lang.String expandSpecialChar(java.lang.String s)
           
protected  java.util.regex.Pattern getRESplitAtChars()
          A regular expression matching the characters at which a token should be split into parts before any preprocessing patterns are applied.
 java.util.List knownTypes()
          Returns the types known by this ExpansionPattern.
protected  int match(java.lang.String s, int type)
          Subclasses do their matching in this class.
 boolean matchSpecialChar(java.lang.String s)
          Tell whether String s is a specialChar.
 java.util.regex.Pattern reMatchingChars()
          Returns the regular expression object matching any of the chars occurring in the pattern.
protected  java.lang.String splitAtChars()
          A string containing the characters at which a token should be split into parts before any preprocessing patterns are applied.
 
Methods inherited from class marytts.language.de.preprocess.ExpansionPattern
allowMultipleTokens, allPatterns, doesFullExpansion, getPattern, getSplitAtChars, isCandidate, makeNewTokens, makeNewTokens, makeNewTokens, match, process, replaceTokens, reSplitAtChars, slowDown, slowDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sMatchingChars

protected final java.lang.String sMatchingChars

sMatchingCharsSimpleString

protected final java.lang.String sMatchingCharsSimpleString
Constructor Detail

SpecialCharEP

public SpecialCharEP()
Method Detail

knownTypes

public java.util.List knownTypes()
Description copied from class: ExpansionPattern
Returns the types known by this ExpansionPattern. These are possible values of the type attribute to the say-as element, as defined in MaryXML.dtd. Each subclass needs to override this to return something meaningful.

Specified by:
knownTypes in class ExpansionPattern

reMatchingChars

public java.util.regex.Pattern reMatchingChars()
Description copied from class: ExpansionPattern
Returns the regular expression object matching any of the chars occurring in the pattern. Each subclass needs to override this to return something meaningful.

Specified by:
reMatchingChars in class ExpansionPattern

getRESplitAtChars

protected java.util.regex.Pattern getRESplitAtChars()
A regular expression matching the characters at which a token should be split into parts before any preprocessing patterns are applied.


splitAtChars

protected java.lang.String splitAtChars()
A string containing the characters at which a token should be split into parts before any preprocessing patterns are applied.


canDealWith

protected int canDealWith(java.lang.String s,
                          int type)
Description copied from class: ExpansionPattern
Decide whether we can expand a string according to type typeCode. This is important in cases where a particular expansion is requested via a say-as element. As a default, reply that a string can be expanded if it would be matched by the pattern recogniser. Subclasses may wish to override this with less strict requirements. Returns the type as which it can be expanded, or -1 if expansion is not possible.

Specified by:
canDealWith in class ExpansionPattern

match

protected int match(java.lang.String s,
                    int type)
Description copied from class: ExpansionPattern
Subclasses do their matching in this class.

Specified by:
match in class ExpansionPattern
Parameters:
s - is the String to be matched,
type - is the index in knownTypes to match with.
Returns:
type actually matched on successful match with this type (if typeCode is a general type (typeCode == 0), it may have matched with a more specific subtype). On failure, -1 is returned.

expand

protected java.util.List expand(java.util.List tokens,
                                java.lang.String s,
                                int type)
Description copied from class: ExpansionPattern
Subclasses do their expansion in this class.

Specified by:
expand in class ExpansionPattern
Parameters:
tokens - is a list of token Elements to be replaced with their expanded form. The expanded forms are inserted into the DOM tree at the same positions as the tokens in List tokens. If there are more new tokens than old tokens, the rest are inserted as siblings at the position of the last old token.
type - is the index in knownTypes this string has matched with before.
Returns:
the list of expanded (=new) tokens.

matchSpecialChar

public boolean matchSpecialChar(java.lang.String s)
Tell whether String s is a specialChar.


doPronounce

protected boolean doPronounce(java.lang.String specialChar)

expandSpecialChar

protected java.util.List expandSpecialChar(org.w3c.dom.Document doc,
                                           java.lang.String s)

expandSpecialChar

protected java.lang.String expandSpecialChar(java.lang.String s)