Copyright | Copyright (C) 2007, 2008 Timo B. Huebel |
---|---|
License | MIT |
Maintainer | Timo B. Huebel (tbh@holumbus.org) |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
Version : 0.3
The ranking mechanism for Hunt.
Customized ranking functions for both documents and suggested words can be provided by the user. Some predefined ranking functions are avaliable, too.
- data RankConfig e = RankConfig {}
- type DocRanking e = ContextWeights -> DocId -> Score -> DocInfo e -> DocContextHits -> Score
- type WordRanking = Word -> WordInfo -> WordContextHits -> Score
- type ContextWeights = Map Context Weight
- rank :: (DocTable dt, Monad m, Applicative m) => RankConfig e -> dt -> ContextWeights -> Result e -> m (Result e)
- docRankByCount :: DocRanking e
- wordRankByCount :: WordRanking
- wordRankBySimilarity :: WordRanking
- defaultRankConfig :: DocumentWrapper e => RankConfig e
Ranking types
data RankConfig e Source
The configuration of the ranking mechanism.
RankConfig | |
|
type DocRanking e = ContextWeights -> DocId -> Score -> DocInfo e -> DocContextHits -> Score Source
The signature of a function to determine the score of a document.
type WordRanking = Word -> WordInfo -> WordContextHits -> Score Source
The signature of a function to determine the score of a word.
type ContextWeights = Map Context Weight Source
Weights for the contexts (optional).
Ranking
rank :: (DocTable dt, Monad m, Applicative m) => RankConfig e -> dt -> ContextWeights -> Result e -> m (Result e) Source
Rank the result with custom ranking functions (and the given context weights).
Predefined document rankings
docRankByCount :: DocRanking e Source
Rank documents by count and multiply occurrences with
their respective context weights (default 1.0
).
Pass an empty map to discard context weights.
docRankByCount :: ContextWeights -> DocId -> Score -> DocInfo e -> DocContextHits -> Score
Predefined word rankings
wordRankByCount :: WordRanking Source
Rank words by count.
wordRankByCount :: Word -> WordInfo -> WordContextHits -> Score
defaultRankConfig :: DocumentWrapper e => RankConfig e Source
The configuration of the ranking mechanism.