Copyright | © 2018 bruno cuconato |
---|---|
License | LPGL-3 |
Maintainer | bruno cuconato <bcclaro+hackage@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Build a diff of CoNLL-U elements (documents, sentences, words). it may show the diff (the print* functions return pairs of the differing fields in two words) or return the word pairs for further processing (the diff* functions). it expects paired sentences as input, and a default pairing function is provided.
this module is useful for visualizing or debugging the processing of CoNLL-U corpora. be sure that the sentences are well-paired, or else it'll be -- as always -- garbage in, garbage out.
Synopsis
- type FDiff = StringPair
- type WDiff a = (CW a, CW a)
- type SDiff a = [WDiff a]
- type DDiff a = [SDiff a]
- diffW :: WDiff a -> Bool
- diffWs :: [CW a] -> [CW a] -> [WDiff a]
- diffS :: (Sent, Sent) -> SDiff AW
- diffSs :: [(Sent, Sent)] -> DDiff AW
- showM :: Show a => Maybe a -> String
- pairSentsBy :: (Sent -> Sent -> Ordering) -> [Sent] -> [Sent] -> [(Sent, Sent)]
- sentId :: Sent -> Maybe Index
- pairSents :: [Sent] -> [Sent] -> [(Sent, Sent)]
- printFieldDiffs :: WDiff a -> [Maybe StringPair]
- printWDiff :: WDiff a -> [StringPair]
- printSDiff :: SDiff a -> [[StringPair]]
- printDDiff :: DDiff a -> [[[StringPair]]]
type synonims
type FDiff = StringPair Source #
CoNLL-U field diff.
diffing functions
auxiliary functions
pairing functions
pairSentsBy :: (Sent -> Sent -> Ordering) -> [Sent] -> [Sent] -> [(Sent, Sent)] Source #
pairs sentences by some ordering of Sent
.
sentId :: Sent -> Maybe Index Source #
try to find an index in a sentence's metadata looking for 'sent_id = n'.
pairSents :: [Sent] -> [Sent] -> [(Sent, Sent)] Source #
pair sentences by their sent_id, found in their metadata.
printing functions
printFieldDiffs :: WDiff a -> [Maybe StringPair] Source #
list of maybe differing fields in a pair of words.
printWDiff :: WDiff a -> [StringPair] Source #
list of differing fields in a pair of words.
printSDiff :: SDiff a -> [[StringPair]] Source #
list of differing words in a sentence.
printDDiff :: DDiff a -> [[[StringPair]]] Source #
list of lists of differing words in sentences.