{-# LANGUAGE LambdaCase, Rank2Types #-}
module Drasil.ExtractDocDesc (
getDocDesc, egetDocDesc, getSec,
extractDocBib
) where
import Control.Lens((^.))
import Data.Functor.Constant (Constant(Constant))
import Data.Generics.Multiplate (appendPlate, foldFor, purePlate, preorderFold)
import qualified Data.Set as S
import Language.Drasil hiding (getCitations, Manual, Verb)
import Language.Drasil.Development (lnames)
import Drasil.System (System, HasSystem(systemdb))
import Theory.Drasil (Derivation(..), MayHaveDerivation(..))
import Drasil.DocumentLanguage.Core hiding (System)
import Drasil.GetChunks (resolveBibliography)
import Drasil.Sections.SpecificSystemDescription (inDataConstTbl, outDataConstTbl)
import Drasil.ExtractCommon (sentToExp, extractSents, extractSents', extractMExprs)
secConPlate :: Monoid b => (forall a. HasContents a => [a] -> b) ->
([Section] -> b) -> DLPlate (Constant b)
secConPlate :: forall b.
Monoid b =>
(forall a. HasContents a => [a] -> b)
-> ([Section] -> b) -> DLPlate (Constant b)
secConPlate forall a. HasContents a => [a] -> b
mCon [Section] -> b
mSec = DLPlate (Constant b) -> DLPlate (Constant b)
forall (p :: (* -> *) -> *) o.
(Multiplate p, Monoid o) =>
p (Constant o) -> p (Constant o)
preorderFold (DLPlate (Constant b) -> DLPlate (Constant b))
-> DLPlate (Constant b) -> DLPlate (Constant b)
forall a b. (a -> b) -> a -> b
$ DLPlate (Constant b)
forall (p :: (* -> *) -> *) (f :: * -> *).
(Multiplate p, Applicative f) =>
p f
purePlate {
refSec = Constant <$> \(RefProg Contents
c [RefTab]
_) -> [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents
c],
introSub = Constant <$> \case
(IOrgSec CI
_ Section
s Sentence
_) -> [Section] -> b
mSec [Section
s]
IntroSub
_ -> b
forall a. Monoid a => a
mempty,
gsdSub = Constant <$> \case
(SysCntxt [Contents]
c) -> [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents]
c
(UsrChars [Contents]
c) -> [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents]
c
(SystCons [Contents]
c [Section]
s) -> [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents]
c b -> b -> b
forall a. Monoid a => a -> a -> a
`mappend` [Section] -> b
mSec [Section]
s,
pdSec = Constant <$> \(PDProg Sentence
_ [Section]
s [PDSub]
_) -> [Section] -> b
mSec [Section]
s,
pdSub = Constant <$> \case
(TermsAndDefs Maybe Sentence
_ [c]
_) -> b
forall a. Monoid a => a
mempty
(PhySysDesc a
_ [Sentence]
_ LabelledContent
lc [Contents]
c) -> [LabelledContent] -> b
forall a. HasContents a => [a] -> b
mCon [LabelledContent
lc] b -> b -> b
forall a. Monoid a => a -> a -> a
`mappend` [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents]
c
(Goals [Sentence]
_ [ConceptInstance]
_) -> b
forall a. Monoid a => a
mempty,
scsSub = Constant <$> \case
(Constraints Sentence
_ [c]
c) -> [LabelledContent] -> b
forall a. HasContents a => [a] -> b
mCon [[c] -> LabelledContent
forall c.
(HasUncertainty c, Quantity c, Constrained c, HasReasVal c,
MayHaveUnit c) =>
[c] -> LabelledContent
inDataConstTbl [c]
c]
(CorrSolnPpties [c]
c [Contents]
cs) -> [LabelledContent] -> b
forall a. HasContents a => [a] -> b
mCon [[c] -> LabelledContent
forall c. (Quantity c, Constrained c) => [c] -> LabelledContent
outDataConstTbl [c]
c] b -> b -> b
forall a. Monoid a => a -> a -> a
`mappend` [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents]
cs
SCSSub
_ -> b
forall a. Monoid a => a
mempty,
reqSub = Constant <$> \case
(FReqsSub [ConceptInstance]
_ [LabelledContent]
c) -> [LabelledContent] -> b
forall a. HasContents a => [a] -> b
mCon [LabelledContent]
c
(NonFReqsSub [ConceptInstance]
_) -> b
forall a. Monoid a => a
mempty,
offShelfSec = Constant <$> \(OffShelfSolnsProg [Contents]
c) -> [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents]
c,
appendSec = Constant <$> \(AppndxProg [Contents]
c) -> [Contents] -> b
forall a. HasContents a => [a] -> b
mCon [Contents]
c
}
exprPlate :: DLPlate (Constant [ModelExpr])
exprPlate :: DLPlate (Constant [ModelExpr])
exprPlate = ([Sentence] -> [ModelExpr]) -> DLPlate (Constant [ModelExpr])
forall a. Monoid a => ([Sentence] -> a) -> DLPlate (Constant a)
sentencePlate ((Sentence -> [ModelExpr]) -> [Sentence] -> [ModelExpr]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Sentence -> [ModelExpr]
sentToExp) DLPlate (Constant [ModelExpr])
-> DLPlate (Constant [ModelExpr]) -> DLPlate (Constant [ModelExpr])
forall (p :: (* -> *) -> *) o.
(Multiplate p, Monoid o) =>
p (Constant o) -> p (Constant o) -> p (Constant o)
`appendPlate` (forall a. HasContents a => [a] -> [ModelExpr])
-> ([Section] -> [ModelExpr]) -> DLPlate (Constant [ModelExpr])
forall b.
Monoid b =>
(forall a. HasContents a => [a] -> b)
-> ([Section] -> b) -> DLPlate (Constant b)
secConPlate ((a -> [ModelExpr]) -> [a] -> [ModelExpr]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap a -> [ModelExpr]
forall a. HasContents a => a -> [ModelExpr]
extractMExprs)
((Section -> [ModelExpr]) -> [Section] -> [ModelExpr]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [ModelExpr]
egetSec) DLPlate (Constant [ModelExpr])
-> DLPlate (Constant [ModelExpr]) -> DLPlate (Constant [ModelExpr])
forall (p :: (* -> *) -> *) o.
(Multiplate p, Monoid o) =>
p (Constant o) -> p (Constant o) -> p (Constant o)
`appendPlate` (DLPlate (Constant [ModelExpr]) -> DLPlate (Constant [ModelExpr])
forall (p :: (* -> *) -> *) o.
(Multiplate p, Monoid o) =>
p (Constant o) -> p (Constant o)
preorderFold (DLPlate (Constant [ModelExpr]) -> DLPlate (Constant [ModelExpr]))
-> DLPlate (Constant [ModelExpr]) -> DLPlate (Constant [ModelExpr])
forall a b. (a -> b) -> a -> b
$ DLPlate (Constant [ModelExpr])
forall (p :: (* -> *) -> *) (f :: * -> *).
(Multiplate p, Applicative f) =>
p f
purePlate {
scsSub = Constant <$> \case
(TMs [Sentence]
_ Fields
_ [TheoryModel]
t) -> [TheoryModel] -> [ModelExpr]
forall a. Express a => [a] -> [ModelExpr]
go [TheoryModel]
t
(DDs [Sentence]
_ Fields
_ [DataDefinition]
d DerivationDisplay
_) -> [DataDefinition] -> [ModelExpr]
forall a. Express a => [a] -> [ModelExpr]
go [DataDefinition]
d
(GDs [Sentence]
_ Fields
_ [GenDefn]
g DerivationDisplay
_) -> [GenDefn] -> [ModelExpr]
forall a. Express a => [a] -> [ModelExpr]
go [GenDefn]
g
(IMs [Sentence]
_ Fields
_ [InstanceModel]
i DerivationDisplay
_) -> [InstanceModel] -> [ModelExpr]
forall a. Express a => [a] -> [ModelExpr]
go [InstanceModel]
i
SCSSub
_ -> [],
auxConsSec = Constant <$> \(AuxConsProg CI
_ [ConstQDef]
qdef) -> [ConstQDef] -> [ModelExpr]
forall a. Express a => [a] -> [ModelExpr]
go [ConstQDef]
qdef
}) where
go :: Express a => [a] -> [ModelExpr]
go :: forall a. Express a => [a] -> [ModelExpr]
go = (a -> ModelExpr) -> [a] -> [ModelExpr]
forall a b. (a -> b) -> [a] -> [b]
map a -> ModelExpr
forall c. Express c => c -> ModelExpr
express
fmGetDocDesc :: DLPlate (Constant [a]) -> DocDesc -> [a]
fmGetDocDesc :: forall a. DLPlate (Constant [a]) -> DocDesc -> [a]
fmGetDocDesc DLPlate (Constant [a])
p = (DocSection -> [a]) -> DocDesc -> [a]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Projector DLPlate DocSection
-> DLPlate (Constant [a]) -> DocSection -> [a]
forall (p :: (* -> *) -> *) a o.
Multiplate p =>
Projector p a -> p (Constant o) -> a -> o
foldFor DLPlate f -> DocSection -> f DocSection
Projector DLPlate DocSection
docSec DLPlate (Constant [a])
p)
egetDocDesc :: DocDesc -> [ModelExpr]
egetDocDesc :: DocDesc -> [ModelExpr]
egetDocDesc = DLPlate (Constant [ModelExpr]) -> DocDesc -> [ModelExpr]
forall a. DLPlate (Constant [a]) -> DocDesc -> [a]
fmGetDocDesc DLPlate (Constant [ModelExpr])
exprPlate
egetSec :: Section -> [ModelExpr]
egetSec :: Section -> [ModelExpr]
egetSec (Section Sentence
_ [SecCons]
sc Reference
_ ) = (SecCons -> [ModelExpr]) -> [SecCons] -> [ModelExpr]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap SecCons -> [ModelExpr]
egetSecCon [SecCons]
sc
egetSecCon :: SecCons -> [ModelExpr]
egetSecCon :: SecCons -> [ModelExpr]
egetSecCon (Sub Section
s) = Section -> [ModelExpr]
egetSec Section
s
egetSecCon (Con Contents
c) = Contents -> [ModelExpr]
forall a. HasContents a => a -> [ModelExpr]
extractMExprs Contents
c
sentencePlate :: Monoid a => ([Sentence] -> a) -> DLPlate (Constant a)
sentencePlate :: forall a. Monoid a => ([Sentence] -> a) -> DLPlate (Constant a)
sentencePlate [Sentence] -> a
f = DLPlate (Constant a)
-> DLPlate (Constant a) -> DLPlate (Constant a)
forall (p :: (* -> *) -> *) o.
(Multiplate p, Monoid o) =>
p (Constant o) -> p (Constant o) -> p (Constant o)
appendPlate ((forall a. HasContents a => [a] -> a)
-> ([Section] -> a) -> DLPlate (Constant a)
forall b.
Monoid b =>
(forall a. HasContents a => [a] -> b)
-> ([Section] -> b) -> DLPlate (Constant b)
secConPlate ([Sentence] -> a
f ([Sentence] -> a) -> ([a] -> [Sentence]) -> [a] -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> [Sentence]
forall a. HasContents a => [a] -> [Sentence]
extractSents') (([Section] -> a) -> DLPlate (Constant a))
-> ([Section] -> a) -> DLPlate (Constant a)
forall a b. (a -> b) -> a -> b
$ [Sentence] -> a
f ([Sentence] -> a) -> ([Section] -> [Sentence]) -> [Section] -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Section -> [Sentence]) -> [Section] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [Sentence]
getSec) (DLPlate (Constant a) -> DLPlate (Constant a))
-> DLPlate (Constant a) -> DLPlate (Constant a)
forall a b. (a -> b) -> a -> b
$
DLPlate (Constant a) -> DLPlate (Constant a)
forall (p :: (* -> *) -> *) o.
(Multiplate p, Monoid o) =>
p (Constant o) -> p (Constant o)
preorderFold (DLPlate (Constant a) -> DLPlate (Constant a))
-> DLPlate (Constant a) -> DLPlate (Constant a)
forall a b. (a -> b) -> a -> b
$ DLPlate (Constant a)
forall (p :: (* -> *) -> *) (f :: * -> *).
(Multiplate p, Applicative f) =>
p f
purePlate {
introSec = Constant . f <$> \(IntroProg Sentence
s1 Sentence
s2 [IntroSub]
s3) -> [Sentence
s1, Sentence
s2] [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ (IntroSub -> [Sentence]) -> [IntroSub] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap IntroSub -> [Sentence]
getIntroSub [IntroSub]
s3,
introSub = Constant . f <$> \case
(IPurpose [Sentence]
s) -> [Sentence]
s
(IScope Sentence
s) -> [Sentence
s]
(IChar [Sentence]
s1 [Sentence]
s2 [Sentence]
s3) -> [[Sentence]] -> [Sentence]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[Sentence]
s1, [Sentence]
s2, [Sentence]
s3]
(IOrgSec CI
_ Section
s1 Sentence
s2) -> Sentence
s2 Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: Section -> [Sentence]
getSec Section
s1,
stkSub = Constant . f <$> \case
(Client CI
_ Sentence
s) -> [Sentence
s]
(Cstmr CI
_) -> [],
pdSec = Constant . f <$> \(PDProg Sentence
s [Section]
secs [PDSub]
pds) -> Sentence
s Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: (Section -> [Sentence]) -> [Section] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Section -> [Sentence]
getSec [Section]
secs [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ (PDSub -> [Sentence]) -> [PDSub] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap PDSub -> [Sentence]
getPDSub [PDSub]
pds,
pdSub = Constant . f <$> \case
(TermsAndDefs Maybe Sentence
Nothing [c]
cs) -> [c] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [c]
cs
(TermsAndDefs (Just Sentence
s) [c]
cs) -> Sentence
s Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: [c] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [c]
cs
(PhySysDesc a
_ [Sentence]
s LabelledContent
lc [Contents]
cs) -> [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ LabelledContent -> [Sentence]
forall a. HasContents a => a -> [Sentence]
extractSents LabelledContent
lc [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [Contents] -> [Sentence]
forall a. HasContents a => [a] -> [Sentence]
extractSents' [Contents]
cs
(Goals [Sentence]
s [ConceptInstance]
c) -> [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ConceptInstance] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConceptInstance]
c,
scsSub = Constant . f <$> \case
(Assumptions [ConceptInstance]
c) -> [ConceptInstance] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConceptInstance]
c
(TMs [Sentence]
s Fields
_ [TheoryModel]
t) -> [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [TheoryModel] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [TheoryModel]
t [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [TheoryModel] -> [Sentence]
forall a. HasAdditionalNotes a => [a] -> [Sentence]
notes [TheoryModel]
t
(DDs [Sentence]
s Fields
_ [DataDefinition]
d DerivationDisplay
_) -> [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [DataDefinition] -> [Sentence]
forall a. MayHaveDerivation a => [a] -> [Sentence]
der [DataDefinition]
d [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [DataDefinition] -> [Sentence]
forall a. HasAdditionalNotes a => [a] -> [Sentence]
notes [DataDefinition]
d
(GDs [Sentence]
s Fields
_ [GenDefn]
d DerivationDisplay
_) -> [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [GenDefn] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [GenDefn]
d [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [GenDefn] -> [Sentence]
forall a. MayHaveDerivation a => [a] -> [Sentence]
der [GenDefn]
d [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [GenDefn] -> [Sentence]
forall a. HasAdditionalNotes a => [a] -> [Sentence]
notes [GenDefn]
d
(IMs [Sentence]
s Fields
_ [InstanceModel]
d DerivationDisplay
_) -> [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [InstanceModel] -> [Sentence]
forall a. MayHaveDerivation a => [a] -> [Sentence]
der [InstanceModel]
d [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [InstanceModel] -> [Sentence]
forall a. HasAdditionalNotes a => [a] -> [Sentence]
notes [InstanceModel]
d
(Constraints Sentence
s [c]
_) -> [Sentence
s]
(CorrSolnPpties [c]
_ [Contents]
cs) -> [Contents] -> [Sentence]
forall a. HasContents a => [a] -> [Sentence]
extractSents' [Contents]
cs,
reqSub = Constant . f <$> \case
(FReqsSub [ConceptInstance]
c [LabelledContent]
lcs) -> [ConceptInstance] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConceptInstance]
c [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [LabelledContent] -> [Sentence]
forall a. HasContents a => [a] -> [Sentence]
extractSents' [LabelledContent]
lcs
(NonFReqsSub [ConceptInstance]
c) -> [ConceptInstance] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConceptInstance]
c,
lcsSec = Constant . f <$> \(LCsProg [ConceptInstance]
c) -> [ConceptInstance] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConceptInstance]
c,
ucsSec = Constant . f <$> \(UCsProg [ConceptInstance]
c) -> [ConceptInstance] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConceptInstance]
c,
traceSec = Constant . f <$> \(TraceabilityProg [TraceConfig]
progs) ->
(TraceConfig -> [Sentence]) -> [TraceConfig] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(TraceConfig UID
_ [Sentence]
ls Sentence
s [TraceViewCat]
_ [TraceViewCat]
_) -> Sentence
s Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: [Sentence]
ls) [TraceConfig]
progs,
auxConsSec = Constant . f <$> \(AuxConsProg CI
_ [ConstQDef]
qdef) -> [ConstQDef] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConstQDef]
qdef
} where
def :: Definition a => [a] -> [Sentence]
def :: forall a. Definition a => [a] -> [Sentence]
def = (a -> Sentence) -> [a] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (a -> Getting Sentence a Sentence -> Sentence
forall s a. s -> Getting a s a -> a
^. Getting Sentence a Sentence
forall c. Definition c => Lens' c Sentence
Lens' a Sentence
defn)
getIntroSub :: IntroSub -> [Sentence]
getIntroSub :: IntroSub -> [Sentence]
getIntroSub (IPurpose [Sentence]
ss) = [Sentence]
ss
getIntroSub (IScope Sentence
s) = [Sentence
s]
getIntroSub (IChar [Sentence]
s1 [Sentence]
s2 [Sentence]
s3) = [Sentence]
s1 [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [Sentence]
s2 [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [Sentence]
s3
getIntroSub (IOrgSec CI
_ Section
s1 Sentence
s2) = Sentence
s2 Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: Section -> [Sentence]
getSec Section
s1
der :: MayHaveDerivation a => [a] -> [Sentence]
der :: forall a. MayHaveDerivation a => [a] -> [Sentence]
der = (a -> [Sentence]) -> [a] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Maybe Derivation -> [Sentence]
getDerivSent (Maybe Derivation -> [Sentence])
-> (a -> Maybe Derivation) -> a -> [Sentence]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a
-> Getting (Maybe Derivation) a (Maybe Derivation)
-> Maybe Derivation
forall s a. s -> Getting a s a -> a
^. Getting (Maybe Derivation) a (Maybe Derivation)
forall c. MayHaveDerivation c => Lens' c (Maybe Derivation)
Lens' a (Maybe Derivation)
derivations))
getDerivSent :: Maybe Derivation -> [Sentence]
getDerivSent :: Maybe Derivation -> [Sentence]
getDerivSent Maybe Derivation
Nothing = []
getDerivSent (Just (Derivation Sentence
h [Sentence]
s)) = Sentence
h Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: [Sentence]
s
notes :: HasAdditionalNotes a => [a] -> [Sentence]
notes :: forall a. HasAdditionalNotes a => [a] -> [Sentence]
notes = (a -> [Sentence]) -> [a] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (a -> Getting [Sentence] a [Sentence] -> [Sentence]
forall s a. s -> Getting a s a -> a
^. Getting [Sentence] a [Sentence]
forall c. HasAdditionalNotes c => Lens' c [Sentence]
Lens' a [Sentence]
getNotes)
getPDSub :: PDSub -> [Sentence]
getPDSub :: PDSub -> [Sentence]
getPDSub (TermsAndDefs Maybe Sentence
ms [c]
c) = [c] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [c]
c [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [Sentence]
-> (Sentence -> [Sentence]) -> Maybe Sentence -> [Sentence]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] Sentence -> [Sentence]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Sentence
ms
getPDSub (PhySysDesc a
_ [Sentence]
s LabelledContent
lc [Contents]
cs) = [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ LabelledContent -> [Sentence]
forall a. HasContents a => a -> [Sentence]
extractSents LabelledContent
lc [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [Contents] -> [Sentence]
forall a. HasContents a => [a] -> [Sentence]
extractSents' [Contents]
cs
getPDSub (Goals [Sentence]
s [ConceptInstance]
c) = [Sentence]
s [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ConceptInstance] -> [Sentence]
forall a. Definition a => [a] -> [Sentence]
def [ConceptInstance]
c
getDocDesc :: DocDesc -> [Sentence]
getDocDesc :: DocDesc -> [Sentence]
getDocDesc = DLPlate (Constant [Sentence]) -> DocDesc -> [Sentence]
forall a. DLPlate (Constant [a]) -> DocDesc -> [a]
fmGetDocDesc (([Sentence] -> [Sentence]) -> DLPlate (Constant [Sentence])
forall a. Monoid a => ([Sentence] -> a) -> DLPlate (Constant a)
sentencePlate [Sentence] -> [Sentence]
forall a. a -> a
id)
getSec :: Section -> [Sentence]
getSec :: Section -> [Sentence]
getSec (Section Sentence
t [SecCons]
sc Reference
_ ) = Sentence
t Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: (SecCons -> [Sentence]) -> [SecCons] -> [Sentence]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap SecCons -> [Sentence]
getSecCon [SecCons]
sc
getSecCon :: SecCons -> [Sentence]
getSecCon :: SecCons -> [Sentence]
getSecCon (Sub Section
s) = Section -> [Sentence]
getSec Section
s
getSecCon (Con Contents
c) = Contents -> [Sentence]
forall a. HasContents a => a -> [Sentence]
extractSents Contents
c
extractDocBib :: System -> [Section] -> BibRef
System
si = ChunkDB -> Set UID -> BibRef
resolveBibliography (System
si System -> Getting ChunkDB System ChunkDB -> ChunkDB
forall s a. s -> Getting a s a -> a
^. Getting ChunkDB System ChunkDB
forall c. HasSystem c => Lens' c ChunkDB
Lens' System ChunkDB
systemdb) (Set UID -> BibRef)
-> ([Section] -> Set UID) -> [Section] -> BibRef
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Section] -> Set UID
extractAllSecRefs
where
extractAllSecRefs :: [Section] -> Set UID
extractAllSecRefs = [Set UID] -> Set UID
forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a
S.unions ([Set UID] -> Set UID)
-> ([Section] -> [Set UID]) -> [Section] -> Set UID
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Section -> Set UID) -> [Section] -> [Set UID]
forall a b. (a -> b) -> [a] -> [b]
map ([Set UID] -> Set UID
forall (f :: * -> *) a. (Foldable f, Ord a) => f (Set a) -> Set a
S.unions ([Set UID] -> Set UID)
-> (Section -> [Set UID]) -> Section -> Set UID
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sentence -> Set UID) -> [Sentence] -> [Set UID]
forall a b. (a -> b) -> [a] -> [b]
map Sentence -> Set UID
lnames ([Sentence] -> [Set UID])
-> (Section -> [Sentence]) -> Section -> [Set UID]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Section -> [Sentence]
getSec)