nerf-0.5.4.1: Nerf, a named entity recognition tool based on linear-chain CRFs

Safe HaskellNone
LanguageHaskell2010

NLP.Nerf.Dict.Base

Contents

Description

Basic types for dictionary handling.

Synopsis

Lexicon entry

type NeType = Text Source #

A type of named entity.

type Form = Text Source #

A orthographic form.

isMultiWord :: Form -> Bool Source #

Is the form a multiword one?

data Entry Source #

A Named Entity entry from the LMF dictionary.

Constructors

Entry 

Fields

Instances
Eq Entry Source # 
Instance details

Defined in NLP.Nerf.Dict.Base

Methods

(==) :: Entry -> Entry -> Bool #

(/=) :: Entry -> Entry -> Bool #

Ord Entry Source # 
Instance details

Defined in NLP.Nerf.Dict.Base

Methods

compare :: Entry -> Entry -> Ordering #

(<) :: Entry -> Entry -> Bool #

(<=) :: Entry -> Entry -> Bool #

(>) :: Entry -> Entry -> Bool #

(>=) :: Entry -> Entry -> Bool #

max :: Entry -> Entry -> Entry #

min :: Entry -> Entry -> Entry #

Read Entry Source # 
Instance details

Defined in NLP.Nerf.Dict.Base

Show Entry Source # 
Instance details

Defined in NLP.Nerf.Dict.Base

Methods

showsPrec :: Int -> Entry -> ShowS #

show :: Entry -> String #

showList :: [Entry] -> ShowS #

Dictionary

type Label = Text Source #

Dictionary label.

type DAWG = DAWG Trans Char () Source #

A Dict is a map from forms to labels. Each form may be annotated with multiple labels. The map is represented using the directed acyclic word graph. type Dict = D.DAWG (S.Set Label)

fromPairs :: [(Form, Label)] -> Dict Source #

Construct dictionary from the list of form/label pairs.

fromEntries :: [Entry] -> Dict Source #

Construct dictionary from the list of entries.

siftDict :: (Form -> Set Label -> Bool) -> Dict -> Dict Source #

Remove dictionary entries which do not satisfy the predicate.

saveDict :: FilePath -> Dict -> IO () Source #

Save the dictionary in the file.

loadDict :: FilePath -> IO Dict Source #

Load the dictionary from the file.

Merging dictionaries

merge :: [Dict] -> Dict Source #

Merge dictionary resources.

diff :: [Dict] -> [Dict] Source #

Differentiate labels from separate dictionaries using dictionary-unique prefixes.