/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.IO;
using Lucene.Net.Analysis;
namespace Lucene.Net.Search.Highlight
{
/// Adds to the score for a fragment based on its tokens
public interface IScorer
{
///
/// Called to init the Scorer with a {@link TokenStream}. You can grab references to
/// the attributes you are interested in here and access them from {@link #getTokenScore()}.
///
/// the {@link TokenStream} that will be scored.
///
/// either a {@link TokenStream} that the Highlighter should continue using (eg
/// if you read the tokenSream in this method) or null to continue
/// using the same {@link TokenStream} that was passed in.
///
///
///
TokenStream Init(TokenStream tokenStream);
///
/// Called when a new fragment is started for consideration.
///
/// the fragment that will be scored next
void StartFragment(TextFragment newFragment);
///
/// Called for each token in the current fragment. The {@link Highlighter} will
/// increment the {@link TokenStream} passed to init on every call.
///
/// a score which is passed to the {@link Highlighter} class to influence the
/// mark-up of the text (this return value is NOT used to score the
/// fragment)
float GetTokenScore();
///
/// Called when the {@link 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 {@link #getTokenScore()}.
///
float FragmentScore { get; }
}
}