public interface Scorer
TextFragment
scores.Modifier and Type | Method and Description |
---|---|
float |
getFragmentScore()
Called when the
Highlighter has no more tokens for the current fragment -
the Scorer returns the weighting it has derived for the most recent
fragment, typically based on the results of getTokenScore() . |
float |
getTokenScore()
Called for each token in the current fragment.
|
TokenStream |
init(TokenStream tokenStream)
Called to init the Scorer with a
TokenStream . |
void |
startFragment(TextFragment newFragment)
Called when a new fragment is started for consideration.
|
TokenStream init(TokenStream tokenStream) throws IOException
TokenStream
. You can grab references to
the attributes you are interested in here and access them from getTokenScore()
.tokenStream
- the TokenStream
that will be scored.TokenStream
that the Highlighter should continue using (eg
if you read the tokenSream in this method) or null to continue
using the same TokenStream
that was passed in.IOException
- If there is a low-level I/O errorvoid startFragment(TextFragment newFragment)
newFragment
- the fragment that will be scored nextfloat getTokenScore()
Highlighter
will
increment the TokenStream
passed to init on every call.Highlighter
class to influence the
mark-up of the text (this return value is NOT used to score the
fragment)float getFragmentScore()
Highlighter
has no more tokens for the current fragment -
the Scorer returns the weighting it has derived for the most recent
fragment, typically based on the results of getTokenScore()
.Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.