public class CompositeEP extends ExpansionPattern
composite, number, specialChar
Constructor and Description |
---|
CompositeEP() |
Modifier and Type | Method and Description |
---|---|
protected int |
canDealWith(String input,
int typeCode)
Decide whether we can expand a string according to type
typeCode . |
protected List |
expand(List tokens,
String text,
int typeCode)
Subclasses do their expansion in this class.
|
List |
knownTypes()
Returns the types known by this ExpansionPattern.
|
protected int |
match(String input,
int typeCode)
Subclasses do their matching in this class.
|
boolean |
process(Element t,
List expanded)
Process this token.
|
Pattern |
reMatchingChars()
Returns the regular expression object matching any of the chars occurring in the pattern.
|
allowMultipleTokens, allPatterns, doesFullExpansion, getPattern, getSplitAtChars, isCandidate, makeNewTokens, makeNewTokens, makeNewTokens, match, replaceTokens, reSplitAtChars, slowDown, slowDown
public List knownTypes()
ExpansionPattern
type
attribute to the
say-as
element, as defined in MaryXML.dtd. Each subclass needs to override this to return something
meaningful.knownTypes
in class ExpansionPattern
public Pattern reMatchingChars()
ExpansionPattern
reMatchingChars
in class ExpansionPattern
public boolean process(Element t, List expanded)
process
in class ExpansionPattern
t
- the element to expand. After processing, this Element will still exist and be a valid Element, but possibly with
a different content, and possibly enclosed by an <mtu> element. In addition, <t> may have new
right-hand neighbors.expanded
- an empty list into which the expanded Elements are placed if an expansion occurred. The list will remain empty
if no expansion was performed.protected int canDealWith(String input, int typeCode)
ExpansionPattern
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 recognizer. 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.canDealWith
in class ExpansionPattern
input
- inputtypeCode
- typeCodeprotected int match(String input, int typeCode)
ExpansionPattern
match
in class ExpansionPattern
input
- is the String to be matched,typeCode
- is the index in knownTypes
to match with.typeCode
is a general type (
typeCode == 0
), it may have matched with a more specific subtype). On failure, -1
is
returned.protected List expand(List tokens, String text, int typeCode)
ExpansionPattern
expand
in class ExpansionPattern
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.text
- is the String to be expanded,typeCode
- is the index in knownTypes
this string has matched with before.Copyright © 2000–2016 DFKI GmbH. All rights reserved.