module Language.Drasil.Sentence.Extract(sdep, shortdep, lnames, lnames') where
import Language.Drasil.UID (UID)
import Language.Drasil.Sentence(Sentence(..), SentenceStyle(..))
import Language.Drasil.ModelExpr.Extract (meNames)
import Data.Containers.ListUtils (nubOrd)
getUIDs :: Sentence -> [UID]
getUIDs :: Sentence -> [UID]
getUIDs (Ch SentenceStyle
ShortStyle TermCapitalization
_ UID
_) = []
getUIDs (Ch SentenceStyle
TermStyle TermCapitalization
_ UID
_) = []
getUIDs (Ch SentenceStyle
PluralTerm TermCapitalization
_ UID
_) = []
getUIDs (SyCh UID
a) = [UID
a]
getUIDs Sy {} = []
getUIDs S {} = []
getUIDs P {} = []
getUIDs Ref {} = []
getUIDs Sentence
Percent = []
getUIDs ((:+:) Sentence
a Sentence
b) = Sentence -> [UID]
getUIDs Sentence
a [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++ Sentence -> [UID]
getUIDs Sentence
b
getUIDs (Quote Sentence
a) = Sentence -> [UID]
getUIDs Sentence
a
getUIDs (E ModelExpr
a) = ModelExpr -> [UID]
meNames ModelExpr
a
getUIDs Sentence
EmptyS = []
getUIDshort :: Sentence -> [UID]
getUIDshort :: Sentence -> [UID]
getUIDshort (Ch SentenceStyle
ShortStyle TermCapitalization
_ UID
a) = [UID
a]
getUIDshort (Ch SentenceStyle
TermStyle TermCapitalization
_ UID
_) = []
getUIDshort (Ch SentenceStyle
PluralTerm TermCapitalization
_ UID
_) = []
getUIDshort SyCh {} = []
getUIDshort Sy {} = []
getUIDshort S {} = []
getUIDshort Sentence
Percent = []
getUIDshort P {} = []
getUIDshort Ref {} = []
getUIDshort ((:+:) Sentence
a Sentence
b) = Sentence -> [UID]
getUIDshort Sentence
a [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++ Sentence -> [UID]
getUIDshort Sentence
b
getUIDshort (Quote Sentence
a) = Sentence -> [UID]
getUIDshort Sentence
a
getUIDshort E {} = []
getUIDshort Sentence
EmptyS = []
sdep :: Sentence -> [UID]
sdep :: Sentence -> [UID]
sdep = [UID] -> [UID]
forall a. Ord a => [a] -> [a]
nubOrd ([UID] -> [UID]) -> (Sentence -> [UID]) -> Sentence -> [UID]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sentence -> [UID]
getUIDs
shortdep :: Sentence -> [UID]
shortdep :: Sentence -> [UID]
shortdep = [UID] -> [UID]
forall a. Ord a => [a] -> [a]
nubOrd ([UID] -> [UID]) -> (Sentence -> [UID]) -> Sentence -> [UID]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sentence -> [UID]
getUIDshort
lnames :: Sentence -> [UID]
lnames :: Sentence -> [UID]
lnames Ch {} = []
lnames SyCh {} = []
lnames Sy {} = []
lnames S {} = []
lnames Sentence
Percent = []
lnames P {} = []
lnames (Ref UID
a Sentence
_ RefInfo
_) = [UID
a]
lnames ((:+:) Sentence
a Sentence
b) = Sentence -> [UID]
lnames Sentence
a [UID] -> [UID] -> [UID]
forall a. [a] -> [a] -> [a]
++ Sentence -> [UID]
lnames Sentence
b
lnames Quote {} = []
lnames E {} = []
lnames Sentence
EmptyS = []
lnames' :: [Sentence] -> [UID]
lnames' :: [Sentence] -> [UID]
lnames' = (Sentence -> [UID]) -> [Sentence] -> [UID]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Sentence -> [UID]
lnames