Safe Haskell | None |
---|
- data Rule = Rule {}
- apply :: Rule -> Text -> Text
- between :: Text -> Text -> Rule
- type UID = Int
- type POS = Text
- type Word = Text
- type Base = Text
- type IsBase = Bool
- data Lex i a b = Lex {}
- data LexKey i = LexKey {}
- data LexElem a b = LexElem {}
- type LexSet i a b = Map (LexKey i) (LexElem a b)
- mkLexSet :: Ord i => [Lex i a b] -> LexSet i a b
- unLexSet :: LexSet i a b -> [Lex i a b]
- type Dict i a b = DAWG Char () (Map i (a, Map Rule b))
- type BaseDict i a b = Dict i a b
- type FormDict i a b = Dict i a b
- mkDict :: (Ord i, Ord a, Ord b) => [(Text, i, a, Text, b)] -> Dict i a b
- unDict :: (Ord i, Ord a, Ord b) => Dict i a b -> [(Text, i, a, Text, b)]
- revDict :: (Ord i, Ord a, Ord b) => Dict i a b -> Dict i a b
- lookup :: Ord i => Text -> Dict i a b -> LexSet i a b
- entries :: Ord i => Dict i a b -> [Lex i a b]
- data Bila i a b = Bila {}
- mkBila :: (Ord i, Ord a, Ord b) => [(Base, i, a, Word, b)] -> Bila i a b
- withForm :: Ord i => Bila i a b -> Word -> LexSet i a b
- type Hist = BaseDict UID (Set POS) IsBase
- mkHist :: [BinEntry] -> Hist
- type HLex = Lex UID (Set POS) IsBase
- type Poli = Bila POS () ()
- type PLex = Lex POS () ()
- type PLexSet = LexSet POS () ()
- mkPoli :: [Entry] -> Poli
- type Corresp = Poli -> HLex -> PLexSet
- buildCorresp :: Core -> Filter -> Choice -> Corresp
- type Core = Poli -> HLex -> [PLexSet]
- type Filter = HLex -> PLex -> Bool
- type Choice = [PLexSet] -> PLexSet
- byForms :: Core
- posFilter :: Filter
- sumChoice :: Choice
- type Fused = BaseDict UID () Code
- type FLex = Lex UID () Code
- data Code
- extend :: HLex -> PLexSet -> FLex
- fuse :: Corresp -> Hist -> Poli -> Fused
Rule
A rule for translating a form into another form.
Basic types
Dictionary
Entry
A lexical entry.
Lexical entry dictionary key.
Lexical entry info.
Dictionary
type Dict i a b = DAWG Char () (Map i (a, Map Rule b))Source
One-way dictionary parametrized over ID i
, with info a
for every
(key, i) pair and info b
for every (key, i, apply rule key) triple.
type BaseDict i a b = Dict i a bSource
Dictionary keys represent base forms and rules transform base forms to
their corresponding word forms. Info a
is assigned to every lexeme
and info b
to every word form.
type FormDict i a b = Dict i a bSource
Dictionary keys represent word forms and rules transform word forms to
their corresponding base forms. Info a
is assigned to every lexeme
and info b
to every word form.
mkDict :: (Ord i, Ord a, Ord b) => [(Text, i, a, Text, b)] -> Dict i a bSource
Make dictionary from a list of (key, ID, key/ID info, elem, key/ID/elem info) tuples.
unDict :: (Ord i, Ord a, Ord b) => Dict i a b -> [(Text, i, a, Text, b)]Source
Transform dictionary back into the list of (key, ID, key/ID info, elem, key/ID/elem info) tuples.
Bilateral
Bilateral dictionary.
mkBila :: (Ord i, Ord a, Ord b) => [(Base, i, a, Word, b)] -> Bila i a bSource
Make bilateral dictionary from a list of (base form, ID, additional lexeme info, word form, additional word form info) tuples.
withForm :: Ord i => Bila i a b -> Word -> LexSet i a bSource
Identify entries which contain given word form.
Historical
Contemporary
Correspondence
type Corresp = Poli -> HLex -> PLexSetSource
A function which determines entries from a bilateral dictionary corresponing to a given historical lexeme.
buildCorresp :: Core -> Filter -> Choice -> CorrespSource
Build Corresp
function form individual components.
Components
type Core = Poli -> HLex -> [PLexSet]Source
We provide three component types, Core
, Filter
and Choice
, which
can be combined together using the buildCorresp
function to construct
a Corresp
function. The first one, Core
, is used to identify a list
of potential sets of lexemes. It is natural to define the core function
in such a way because the task of determining corresponding lexemes can
be usually divided into a set of smaller tasks of the same purpose.
For example, we may want to identify LexSet
s corresponding to individual
word forms of the historical lexeme.
type Filter = HLex -> PLex -> BoolSource
Function which can be used to filter out lexemes which do not satisfy a particular predicate. For example, we may want to filter out lexemes with incompatible POS value.
type Choice = [PLexSet] -> PLexSetSource
The final choice of lexemes. Many different strategies can be used here -- sum of the sets, intersection, or voting.
Filter out lexemes with POS value incompatible with the set of POS values assigned to the historical lexeme.
Fusion
Code of word form origin.