Safe Haskell | None |
---|---|
Language | Haskell2010 |
Earley-style TAG parsing based on automata, with a distinction between active and passive items.
- recognize :: (Ord t, Ord n) => FactGram n t -> [Set t] -> IO Bool
- recognizeFrom :: (Ord t, Ord n) => FactGram n t -> n -> [Set t] -> IO Bool
- parse :: (Ord t, Ord n) => FactGram n t -> n -> [Set t] -> IO (Set (Tree n t))
- earley :: (Ord t, Ord n) => FactGram n t -> [Set t] -> IO (Hype n t)
- recognizeAuto :: (Ord t, Ord n) => GramAuto n t -> [Set t] -> IO Bool
- recognizeFromAuto :: (Ord t, Ord n) => GramAuto n t -> n -> [Set t] -> IO Bool
- parseAuto :: (Ord t, Ord n) => GramAuto n t -> n -> [Set t] -> IO (Set (Tree n t))
- earleyAuto :: (Ord t, Ord n) => GramAuto n t -> [Set t] -> IO (Hype n t)
- data Hype n t
- parsedTrees :: forall n t. (Ord n, Ord t) => Hype n t -> n -> Int -> Set (Tree n t)
- hyperNodesNum :: Hype n t -> Int
- hyperEdgesNum :: forall n t. Hype n t -> Int
- printHype :: (Show n, Show t) => Hype n t -> IO ()
- type Pos = Int
Earley-style parsing
All the parsing functions described below employ the
NLP.Partage.Auto.DAWG grammar representation.
You can also pre-compile your own automaton and use it with
e.g. parseAuto
.
Does the given grammar generate the given sentence?
Uses the earley
algorithm under the hood.
:: (Ord t, Ord n) | |
=> FactGram n t | The grammar (set of rules) |
-> n | The start symbol |
-> [Set t] | Input sentence |
-> IO Bool |
Does the given grammar generate the given sentence from the
given non-terminal symbol (i.e. from an initial tree with this
symbol in its root)? Uses the earley
algorithm under the
hood.
:: (Ord t, Ord n) | |
=> FactGram n t | The grammar (set of rules) |
-> n | The start symbol |
-> [Set t] | Input sentence |
-> IO (Set (Tree n t)) |
Parse the given sentence and return the set of parsed trees.
Perform the earley-style computation given the grammar and the input sentence.
With automata precompiled
See recognize
.
:: (Ord t, Ord n) | |
=> GramAuto n t | Grammar automaton |
-> n | The start symbol |
-> [Set t] | Input sentence |
-> IO Bool |
See recognizeFrom
.
:: (Ord t, Ord n) | |
=> GramAuto n t | Grammar automaton |
-> n | The start symbol |
-> [Set t] | Input sentence |
-> IO (Set (Tree n t)) |
See parse
.
See earley
.
Parsing trace (hypergraph)
Extracting parsed trees
:: (Ord n, Ord t) | |
=> Hype n t | Final state of the earley parser |
-> n | The start symbol |
-> Int | Length of the input sentence |
-> Set (Tree n t) |
Extract the set of parsed trees obtained on the given input sentence. Should be run on the result of the earley algorithm.
Stats
hyperNodesNum :: Hype n t -> Int Source
Number of nodes in the parsing hypergraph.
hyperEdgesNum :: forall n t. Hype n t -> Int Source
Number of edges in the parsing hypergraph.