Safe Haskell | None |
---|---|
Language | Haskell2010 |
Feature structures in GenI can be seen as a simple mapping from attributes to values (no fancy recursion).
From an implementation standpoint, we do truck around lists of
AvPair
quite a bit which unfortunately means we don't
guarantee things like uniqueness of attributes. We may phase
this out over time in favour of FeatStruct
- type Flist a = [AvPair a]
- data AvPair a = AvPair {}
- type FeatStruct a = Map Text a
- emptyFeatStruct :: FeatStruct a
- mkFeatStruct :: Flist GeniVal -> FeatStruct GeniVal
- fromFeatStruct :: FeatStruct a -> Flist a
- sortFlist :: Flist a -> Flist a
- unifyFeat :: MonadUnify m => Flist GeniVal -> Flist GeniVal -> m (Flist GeniVal, Subst)
- alignFeat :: Flist GeniVal -> Flist GeniVal -> [(Text, GeniVal, GeniVal)]
- alignFeatH :: Flist GeniVal -> Flist GeniVal -> [(Text, GeniVal, GeniVal)] -> [(Text, GeniVal, GeniVal)]
- crushAvPair :: AvPair SchemaVal -> Maybe (AvPair GeniVal)
- crushFlist :: Flist SchemaVal -> Maybe (Flist GeniVal)
Documentation
type Flist a = [AvPair a] Source #
A list of attribute-value pairs. It's not a great idea to represent feature structures with this because it allows for duplicates in the attributes. But maybe sometimes you really do mean a list.
An attribute-value pair, the typical use being
AvPair GeniVal
or if you have something even simpler
AvPair Text
Pretty SemInput Source # | |
GeniShow SemInput Source # | |
Eq a => Eq (AvPair a) Source # | |
Data a => Data (AvPair a) Source # | |
Ord a => Ord (AvPair a) Source # | |
Binary a => Binary (AvPair a) Source # | |
NFData a => NFData (AvPair a) Source # | |
Pretty (AvPair GeniVal) Source # | |
Pretty (Flist GeniVal) Source # | |
GeniShow gv => GeniShow (AvPair gv) Source # | |
GeniShow gv => GeniShow (Flist gv) Source # | |
DescendGeniVal v => DescendGeniVal (AvPair v) Source # | |
Collectable a => Collectable (AvPair a) Source # | |
type FeatStruct a = Map Text a Source #
Experimental, alternative representation of Flist which guarantees uniqueness of keys
emptyFeatStruct :: FeatStruct a Source #
A feature structure with no pairs
mkFeatStruct :: Flist GeniVal -> FeatStruct GeniVal Source #
Convert an Flist
to a proper FeatStruct
Unsafely assumes the keys are unique
fromFeatStruct :: FeatStruct a -> Flist a Source #
Convert an FeatStruct
to a simpler to process Flist
alignFeat :: Flist GeniVal -> Flist GeniVal -> [(Text, GeniVal, GeniVal)] Source #
alignFeat
is a pre-procesing step used to ensure that feature structures
have the same set of keys. If a key is missing in one, we copy it to the
other with an anonymous value.
The two feature structures must be sorted for this to work
alignFeatH :: Flist GeniVal -> Flist GeniVal -> [(Text, GeniVal, GeniVal)] -> [(Text, GeniVal, GeniVal)] Source #
Helper for alignFeat
; ignore
crushAvPair :: AvPair SchemaVal -> Maybe (AvPair GeniVal) Source #
Flatten a fancy disjunction attribute-value pair
See crushOne
for details
crushFlist :: Flist SchemaVal -> Maybe (Flist GeniVal) Source #
Flatten a fancy-disjunction feature structure
See crushOne
for details
Orphan instances
Pretty (FeatStruct GeniVal) Source # | |
GeniShow (FeatStruct GeniVal) Source # | |
DescendGeniVal a => DescendGeniVal (String, a) Source # | |