public class DateEP extends ExpansionPattern
Constructor and Description |
---|
DateEP() |
Modifier and Type | Method and Description |
---|---|
protected int |
canDealWith(String s,
int type)
Decide whether we can expand a string according to type
typeCode . |
protected List<Element> |
expand(List<Element> tokens,
String s,
int type)
Subclasses do their expansion in this class.
|
protected List<Element> |
expandDateDay(Document doc,
String s) |
protected List<Element> |
expandDateDM(Document doc,
String s) |
protected List<Element> |
expandDateDMY(Document doc,
String s) |
protected List<Element> |
expandDateMD(Document doc,
String s) |
protected List<Element> |
expandDateMDY(Document doc,
String s) |
protected List<Element> |
expandDateMonth(Document doc,
String s) |
protected List<Element> |
expandDateMY(Document doc,
String s) |
protected List<Element> |
expandDateYear(Document doc,
String s) |
protected List<Element> |
expandDateYMD(Document doc,
String s) |
List<String> |
knownTypes()
Returns the types known by this ExpansionPattern.
|
protected int |
match(String s,
int type)
Subclasses do their matching in this class.
|
protected boolean |
matchDateD(String s) |
protected boolean |
matchDateDM(String s) |
protected boolean |
matchDateDMY(String s) |
protected boolean |
matchDateM(String s) |
protected boolean |
matchDateMD(String s) |
protected boolean |
matchDateMDY(String s) |
protected boolean |
matchDateMY(String s) |
protected boolean |
matchDateY(String s) |
protected boolean |
matchDateYMD(String s) |
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, process, replaceTokens, reSplitAtChars, slowDown, slowDown
protected final String sDay
protected final String sMonth
protected final String sMonthword
protected final String sMonthabbr
protected final String sYear
protected final String sDot
protected final String sSlash
protected final String sMinus
protected final String sMatchingChars
protected final String sSeparators
protected final Pattern reDayMonthYear
protected final Pattern reDayMonthwordYear
protected final Pattern reDayMonthabbrYear
protected final Pattern reYearMonthDay
protected final Pattern reYearMonthwordDay
protected final Pattern reYearMonthabbrDay
protected final Pattern reMonthDayYear
protected final Pattern reMonthwordDayYear
protected final Pattern reMonthabbrDayYear
protected final Pattern reDayMonth
protected final Pattern reDayMonthword
protected final Pattern reDayMonthabbr
protected final Pattern reMonthDay
protected final Pattern reMonthwordDay
protected final Pattern reMonthabbrDay
protected final Pattern reMonthYear
protected final Pattern reMonthwordYear
protected final Pattern reMonthabbrYear
protected final Pattern reYear
protected final Pattern reMonth
protected final Pattern reMonthword
protected final Pattern reMonthabbr
protected final Pattern reDay
public List<String> 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
protected int canDealWith(String s, int type)
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 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.canDealWith
in class ExpansionPattern
s
- inputtype
- typeCodeprotected int match(String s, int type)
ExpansionPattern
match
in class ExpansionPattern
s
- is the String to be matched,type
- 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<Element> expand(List<Element> tokens, String s, int type)
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.s
- is the String to be expanded,type
- is the index in knownTypes
this string has matched with before.protected boolean matchDateDMY(String s)
protected boolean matchDateYMD(String s)
protected boolean matchDateDM(String s)
protected boolean matchDateMY(String s)
protected boolean matchDateY(String s)
protected boolean matchDateM(String s)
protected boolean matchDateD(String s)
protected boolean matchDateMDY(String s)
protected boolean matchDateMD(String s)
Copyright © 2000–2016 DFKI GmbH. All rights reserved.