polimorf-0.6.0: Working with the PoliMorf dictionary

Safe HaskellNone

Data.PoliMorf

Contents

Description

The module provides functionality for manipulating PoliMorf, the morphological dictionary for Polish. Apart from IO utilities there is a merge function which can be used to merge the PoliMorf with another dictionary resources.

Synopsis

Core types

type Form = TextSource

A form.

type Base = TextSource

A base form.

type Tag = TextSource

A morphosyntactic tag.

type Cat = TextSource

A category.

data Entry Source

An entry from the PoliMorf dictionary.

Constructors

Entry 

Fields

form :: !Form
 
base :: !Base
 
tag :: !Tag
 
cat :: !Cat
 

atomic :: Entry -> BoolSource

Is the entry an atomic one? More precisely, we treat all negative forms starting with ''nie'' and all superlatives starting with ''naj'' as non-atomic entries.

Parsing

readPoliMorf :: FilePath -> IO [Entry]Source

Read the PoliMorf from the file.

parsePoliMorf :: Text -> [Entry]Source

Parse the PoliMorf into a list of entries.

Utilities

data Rule Source

A rule for translating a form into another one.

Constructors

Rule 

Fields

cut :: !Int

Number of characters to cut from the end of the form.

suffix :: !Text

A suffix to paste.

Instances

apply :: Rule -> Text -> TextSource

Apply the rule.

type DAWG a = DAWG Trans Char () aSource

type AnaMap = DAWG (Map Rule (Set Tag))Source

A map from forms to their potential interpretations. It can be used directly to determine all potential dictionary interpretations of a given form.

mkAnaMap :: [Entry] -> AnaMapSource

Construct an AnaMap from a list of entries.

anaWord :: AnaMap -> Form -> Map Base (Set Tag)Source

Analyse word.

mkRuleMap :: [(Text, Text)] -> DAWG (Set Rule)Source

Make a rule map from a list of entries.

type BaseMap = DAWG (Set Rule)Source

A map from forms to their possible base forms (there may be many since the form may be a member of multiple lexemes).

mkBaseMap :: [Entry] -> BaseMapSource

Make a BaseMap from a list of entries.

type FormMap = DAWG (Set Rule)Source

A map from base forms to all their potential forms.

mkFormMap :: [Entry] -> FormMapSource

Make a FormMap from a list of entries.