haskseg-0.1.0.3: Simple unsupervised segmentation model

Safe HaskellNone
LanguageHaskell2010

Text.HaskSeg.Location

Synopsis

Documentation

randomFlip :: (Ord a, Random a, RandomGen b, Fractional a) => a -> b -> (Bool, b) Source #

randomizeLocations :: Double -> Locations elem -> StdGen -> (Locations elem, StdGen) Source #

Switch each potential morpheme boundary (i.e. intra-word indices) to True or False

updateLocations :: MonadState (SamplingState elem) m => elem -> Set Int -> Set Int -> m () Source #

updateLocations' :: elem -> Locations elem -> Set Int -> Set Int -> Locations elem Source #

nonConflicting :: MonadLog (WithSeverity String) m => (Int, (Int, Int)) -> Set (Int, (Int, Int)) -> Set (Int, (Int, Int)) -> m (Set Int, Set Int) Source #

For sites with matching type, return a subset that don't conflict

wordsToSites :: (Probability p, MonadState (SamplingState elem) m, MonadReader (Params p) m, MonadLog (WithSeverity String) m, Show elem, Ord elem, PrintfArg elem) => Int -> Lookup elem -> Lookup elem -> Morph elem -> Morph elem -> m (Set Int, Set Int) Source #

For two words, return all compatible sites

siteToWords :: (Show elem, MonadLog (WithSeverity String) m, MonadState (SamplingState elem) m) => Int -> m (Morph elem, Morph elem) Source #

Find the two words implied by a boundary at the given site

initReverseLookup :: Eq elem => Lookup elem -> Lookup elem -> Map Int (Morph elem, Morph elem) Source #

Turn a sequence of values into a sequence of locations sequenceToLocations :: [elem] -> Locations elem sequenceToLocations xs = Vector.fromList $ nonFinal ++ [final] where xs' = init xs nonFinal = map (x -> Location x False False) xs' x = last xs final = Location x True True True