|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.combi.StrategyAdapter
public class StrategyAdapter
A strategy adapter translates labels to the internal labels expected by a
CombinationStrategy
, using a list of regular
expressions and replacement texts (or the other way around). This can be
used to interpret labeling systems that follow the model of a specific
combination strategy but use a different naming convention. For example,
the state "O" (outside) usually used by IOB1/IOB2 tagging can be translated
to the state "A" internally used by
InsideOutsideStrategy
. Note that patterns
are matched
against complete label
texts, matches that cover only parts of label texts are not considered.
Instances of this class are not thread-safe and must be synchronized externally, if required.
Constructor Summary | |
---|---|
StrategyAdapter(LinkedHashMap<Pattern,String> replacements)
Creates a new instance. |
|
StrategyAdapter(TiesConfiguration conf)
Creates a new instance. |
Method Summary | |
---|---|
static StrategyAdapter |
createDummyAdapter()
Factory method for creating a dummy adapter that simple returns the labels generated by the combination strategy without modifying them in any way. |
String |
toString()
Returns a string representation of this object. |
String[] |
translate(String[] labels)
Translates the array of labels generated by a combination strategy to the corresponding labels following some external convention (or the other way around). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StrategyAdapter(TiesConfiguration conf)
conf
- used to configure this instancepublic StrategyAdapter(LinkedHashMap<Pattern,String> replacements)
replacements
- an ordered map from regex patterns to replacement
textsMethod Detail |
---|
public static StrategyAdapter createDummyAdapter()
public String[] translate(String[] labels)
labels
- the array of labels to translate
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |