Method Detail

knownTypes

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.

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.

s - is the String to be expanded,

type - is the index in knownTypes this string has matched with before.

Returns:

the list of expanded (=new) tokens.

matchTelephone

canDealWith

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.

expandTelephone

This method, differently from what is usually done, does not take a string argument, but the original tokens. The reason is
that grouping of telephone number parts is often done using whitespace, information that would be lost if the
whitespace-free string was used.