Package opennlp.tools.namefind
Class BilouCodec
- java.lang.Object
-
- opennlp.tools.namefind.BilouCodec
-
- All Implemented Interfaces:
SequenceCodec<String>
public class BilouCodec extends Object implements SequenceCodec<String>
The defaultSequenceCodec
implementation according to theBILOU
scheme.- B: 'beginning' of a NE
- I: 'inside', the word is inside a NE
- L: 'last', the last (I) word inside a NE
- O: 'outside', the word is a regular word outside a NE
- U: 'unit', any standalone token following words outside of NE
- See Also:
SequenceCodec
,BioCodec
-
-
Constructor Summary
Constructors Constructor Description BilouCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areOutcomesCompatible(String[] outcomes)
B requires CL or L, C requires BL, L requires B, O requires any valid combo/unit, U requires none.
SequenceValidator<String>
createSequenceValidator()
Span[]
decode(List<String> c)
String[]
encode(Span[] names, int length)
-
-
-
Field Detail
-
START
public static final String START
- See Also:
- Constant Field Values
-
CONTINUE
public static final String CONTINUE
- See Also:
- Constant Field Values
-
LAST
public static final String LAST
- See Also:
- Constant Field Values
-
UNIT
public static final String UNIT
- See Also:
- Constant Field Values
-
OTHER
public static final String OTHER
- See Also:
- Constant Field Values
-
-
Method Detail
-
decode
public Span[] decode(List<String> c)
Description copied from interface:SequenceCodec
- Specified by:
decode
in interfaceSequenceCodec<String>
- Parameters:
c
- A list ofSequenceCodec
to decode.- Returns:
- A
Span
array encapsulating the decoded elements inc
.
-
encode
public String[] encode(Span[] names, int length)
Description copied from interface:SequenceCodec
- Specified by:
encode
in interfaceSequenceCodec<String>
- Parameters:
names
- A list ofelements
to encode.length
- The length to respect.- Returns:
- An array of
SequenceCodec
to encode.
-
createSequenceValidator
public SequenceValidator<String> createSequenceValidator()
- Specified by:
createSequenceValidator
in interfaceSequenceCodec<String>
- Returns:
- A
SequenceValidator
which can validate a sequence ofoutcomes
.
-
areOutcomesCompatible
public boolean areOutcomesCompatible(String[] outcomes)
B requires CL or L, C requires BL, L requires B, O requires any valid combo/unit, U requires none.
- Specified by:
areOutcomesCompatible
in interfaceSequenceCodec<String>
- Parameters:
outcomes
- All potential model outcomes check.- Returns:
true
, if model outcomes are compatible,false
otherwise.
-
-