Portability | archlinux |
---|---|
Stability | experimental |
Maintainer | Peter Harpending <pharpend2@gmail.com> |
Safe Haskell | None |
If you want to make your own phraselist, you need to write a JSON
file, in accordance with the
schema.
Once you do that, make a data type for your phraselist.
Make your data type an instance of Phraselist
, and you're good to
go.
For example, let's say your phraselist is mylist.json
, and it's
all in accordance with the schema. Your code would look something
like this:
data MyList = MyList instance Phraselist MyList where phraselistPath MyList = getDataFileName mylist.json phraselistPath _ = undefined
Don't forget to add mylist.json
to Data-Files
in your .cabal
file.
If you want to use one of the lists we already supply
- readPhraselist :: Phraselist t => t -> IO PhraseForest
- readPhraseMap :: Phraselist t => t -> IO PhraseMap
- servePhraselist :: Phraselist t => t -> IO ByteString
- class Phraselist t where
- phraselistPath :: t -> IO FilePath
- type PhraselistSet = Phraselist t => [t]
- data ErosList
- = Chat
- | Conspiracy
- | DrugAdvocacy
- | Forums
- | Gambling
- | Games
- | Gore
- | IdTheft
- | IllegalDrugs
- | Intolerance
- | LegalDrugs
- | Malware
- | Music
- | News
- | Nudism
- | Peer2Peer
- | Personals
- | Pornography
- | Proxies
- | SecretSocieties
- | SelfLabeling
- | Sport
- | Translation
- | UpstreamFilter
- | Violence
- | WarezHacking
- | Weapons
- | Webmail
- erosLists :: [ErosList]
- erosListPaths :: IO [FilePath]
- erosListNames :: [Text]
- erosListNamePairs :: [(ErosList, Text)]
- erosNameByList :: ErosList -> Maybe Text
- erosNameListMap :: Map Text ErosList
- erosListByName :: Text -> Maybe ErosList
- data PhraseAlmostTree = PhraseAlmostTree {}
- type PAT = PhraseAlmostTree
- fromPAT :: PAT -> PhraseTree
- fromPhraseAlmostTree :: PAT -> PhraseTree
- loadPhraselist :: Phraselist t => t -> IO PhraseForest
- readPhraseFile :: Phraselist t => t -> IO PhraseForest
- loadPhraseFile :: Phraselist t => t -> IO PhraseForest
- readPhraseForest :: Phraselist t => t -> IO PhraseForest
- loadPhraseForest :: Phraselist t => t -> IO PhraseForest
- loadPhraseMap :: Phraselist t => t -> IO PhraseMap
Documentation
readPhraselist :: Phraselist t => t -> IO PhraseForestSource
Read a Phraselist
, marshal it into a PhraseForest
.
readPhraseMap :: Phraselist t => t -> IO PhraseMapSource
Load a Phraselist
directly into a PhraseMap
servePhraselist :: Phraselist t => t -> IO ByteStringSource
Read the phraselist from disk
type PhraselistSet = Phraselist t => [t]Source
A set of Phraselist
s. Note that this is actually a list, and I'm
calling it a set for purely lexical purposes.
The phraselists in res/
. Each of these constructors correspond
to one of the files
here.
Gitlab has a terrible interface, so I won't provide links to each one of them.
erosListPaths :: IO [FilePath]Source
A list of the paths to the phraselists we provide.
erosListNames :: [Text]Source
erosListNamePairs :: [(ErosList, Text)]Source
You can't really order the lists, so we won't use Map
data PhraseAlmostTree Source
Placeholder type used to read JSON. The JSON schema (currently, at
least) is such that one needs this type to read the JSON. You can
use fromPAT
to convert this type into a PhraseTree
Read PhraseAlmostTree | |
Show PhraseAlmostTree | |
FromJSON PAT | You can read the JSON schema to see how this works. |
type PAT = PhraseAlmostTreeSource
Alias for PhraseAlmostTree
fromPAT :: PAT -> PhraseTreeSource
Convert a PAT
into a PhraseTree
.
fromPhraseAlmostTree :: PAT -> PhraseTreeSource
I figure some people like to type a lot.
loadPhraselist :: Phraselist t => t -> IO PhraseForestSource
Alias for readPhraselist
readPhraseFile :: Phraselist t => t -> IO PhraseForestSource
Alias for readPhraselist
loadPhraseFile :: Phraselist t => t -> IO PhraseForestSource
Alias for readPhraselist
readPhraseForest :: Phraselist t => t -> IO PhraseForestSource
Alias for readPhraselist
loadPhraseForest :: Phraselist t => t -> IO PhraseForestSource
Alias for readPhraselist
loadPhraseMap :: Phraselist t => t -> IO PhraseMapSource
Alias for readPhraseMap