HsHyperEstraier-0.1: HyperEstraier binding for HaskellContentsIndex
Text.HyperEstraier.Document
Contents
Types
Creating and parsing document
Setting contents and attributes of document
Getting contents and attributes of document
Dumping document
Making snippet of document
Description
An interface to manipulate documents of the HyperEstraier.
Synopsis
data Document
type DocumentID = Int
newDocument :: IO Document
parseDraft :: String -> IO Document
addText :: Document -> String -> IO ()
addHiddenText :: Document -> String -> IO ()
setAttribute :: Document -> String -> Maybe String -> IO ()
setURI :: Document -> Maybe URI -> IO ()
setKeywords :: Document -> [(String, Integer)] -> IO ()
setScore :: Document -> Maybe Int -> IO ()
getId :: Document -> IO DocumentID
getAttrNames :: Document -> IO [String]
getAttribute :: Document -> String -> IO (Maybe String)
getText :: Document -> IO String
getURI :: Document -> IO (Maybe URI)
getKeywords :: Document -> IO [(String, Integer)]
getScore :: Document -> IO (Maybe Int)
dumpDraft :: Document -> IO String
makeSnippet :: Document -> [String] -> Int -> Int -> Int -> IO [Either String (String, String)]
Types
data Document
Document is an opaque object representing a document of HyperEstraier.
type DocumentID = Int
DocumentID is just an alias to Int. It represents a document ID.
Creating and parsing document
newDocument :: IO Document
newDocument creates an empty document.
parseDraft :: String -> IO Document
parseDraft parses a document in the "draft" format.
Setting contents and attributes of document
addText :: Document -> String -> IO ()
Add a block of text to a document.
addHiddenText :: Document -> String -> IO ()
Add a block of hidden text to a document.
setAttribute
:: DocumentThe document.
-> StringAn attribute name.
-> Maybe StringAn attribute value. If this is Nothing, the attribute will be deleted.
-> IO ()
Set an attribute value of a document.
setURI :: Document -> Maybe URI -> IO ()
Set an URI of a document. This is a special case of setAttribute.
setKeywords
:: DocumentThe document.
-> [(String, Integer)]A list of (keyword, score).
-> IO ()
Set keywords of a document.
setScore :: Document -> Maybe Int -> IO ()
Set an alternative score of a document.
Getting contents and attributes of document
getId :: Document -> IO DocumentID
Get the ID of document.
getAttrNames :: Document -> IO [String]
Get a list of all attribute names in a document.
getAttribute :: Document -> String -> IO (Maybe String)
Get an attribute value of a document.
getText :: Document -> IO String
Get the text in a document.
getURI :: Document -> IO (Maybe URI)
Get the URI of a document.
getKeywords :: Document -> IO [(String, Integer)]
Get the keywords of a document.
getScore :: Document -> IO (Maybe Int)
Get an alternative score of a document.
Dumping document
dumpDraft :: Document -> IO String
Dump a document in the "draft" format.
Making snippet of document
makeSnippet
:: DocumentThe document.
-> [String]Words to be highlighted.
-> IntMaximum width of the whole result.
-> IntWidth of the heading text to be shown.
-> IntWidth of the text surrounding each highlighted words.
-> IO [Either String (String, String)]A list of either (Left non-highlighted text) or (Right (highlighted word, its normalized form)).
Make a snippet from a document.
Produced by Haddock version 0.8