penntreebank-megaparsec alternatives and similar packages
Based on the "Natural Language Processing" category.
Alternatively, view penntreebank-megaparsec alternatives based on common mentions on social networks and blogs.
-
chatter
A library of Natural Language Processing algorithms for Haskell. -
nerf
Named entity recognition tool based on linear-chain CRFs -
cndict
Chinese/Mandarin <-> English dictionary, Chinese lexer. -
concraft-pl
A morphosyntactic tagger for Polish based on conditional random fields -
concraft
A morphosyntactic disambiguation library based on constrained conditional random fields -
minimorph
English spelling functions with an emphasis on simplicity. Originally by https://github.com/kowey. -
tsuntsun
Interacts with tesseract to ease reading of RAW Japanese manga. -
PTQ
An implementation of Montague's PTQ (Proper Treatment of Quantification). -
corenlp-parser
Launches CoreNLP and parses the JSON output -
sentiwordnet-parser
Parser for the [SentiWordNet](http://sentiwordnet.isti.cnr.it/) tab-separated file -
haskell-postal
Haskell binding for the libpostal library -
hist-pl
Programs and libraries related to the historical dictionary of Polish -
polh-lexicon
Programs and libraries related to the historical dictionary of Polish -
crf-chain2-tiers
Second-order, tiered, constrained, linear conditional random fields -
concraft-hr
A part-of-speech tagger for Croatian based on the concraft library. -
moan
Language-agnostic analyzer for positional morphosyntactic tags
Free Global Payroll designed for tech teams
Do you think we are missing an alternative of penntreebank-megaparsec or a related project?
README
penntreebank-megaparsec :: Megaparsec parsers for trees in the Penn Treebank format
This Haskell package provides parsers for syntactic trees annotated in the Penn Treebank format, powered by Megaparsec.
It supports vertical composition of custom label parsers with tree parsers, which means you can customize your label parsers and use these parsers to perform parsing of labels at the same time as that of trees. For the following example of categorial grammar trees,
(A/B (B He)
(B\<A/B> thinks))
the result of tree parsing is:
Node "A/B" [
Node "B" [
Node "He" []
],
Node "B\<A/B>" [
Node "thinks" []
]
]
which you can make followed by a secondary parsing of labels (= categories):
Node (CatRight (Atom B) (Atom A)) [
Node (Atom B) [
Node (Lex "He") []
],
Node (CatLeft (Atom B) (CatRight (Atom B) (Atom A))) [
Node (Lex "thinks") []
]
]
Usage
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE MultiParamTypeClasses #-}
import Data.Tree.Parser.Penn.Megaparsec.Char as TC
import Data.Text (Text)
import Text.Megaparsec as MegaP
-- define the node type
data PennNode = NonTerm Text | Term Text deriving (Show)
-- define the node parsers
instance {-# OVERLAPS #-} TC.ParsableAsTerm Text PennNode where
pNonTerm = NonTerm <$> MegaP.takeRest
pTerm = Term <$> MegaP.takeRest
-- specify and disambiguate the type of the input stream
parser :: (Monad m) => TC.PennTreeParserT Text m PennNode
parser = TC.pTree
main :: IO ()
main = MegaP.parseTest parser "(A (B C (D E)))"