From c5866d5530af825e816a563ac5f6269b6c6b4651 Mon Sep 17 00:00:00 2001 From: Alice BRENON <alice.brenon@ens-lyon.fr> Date: Mon, 30 Oct 2023 15:30:36 +0100 Subject: [PATCH] Give a meaningful name to a zipper function in the script to split articles into paragraphs --- scripts/paragraphs.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/paragraphs.hs b/scripts/paragraphs.hs index 2e93224..2a4d0e0 100755 --- a/scripts/paragraphs.hs +++ b/scripts/paragraphs.hs @@ -18,12 +18,13 @@ articleParagraphs = fmap (fmap (leave . linearize False . enter) . splitOn "\n\n") . Text.readFile withMeta :: ArticleRecord @ Entry -> [Text] -> [(ParagraphMeta, Text)] -withMeta (articleRecord :@: entry) paragraphs = zipWith f [1..] paragraphs +withMeta (articleRecord :@: entry) paragraphs = + zipWith numberParagraph [1..] paragraphs where prodigyMeta = ProdigyMeta { totalParagraphs = length paragraphs , Prodigy.headword = Article.headword entry } - f paragraph paragraphText = + numberParagraph paragraph paragraphText = (articleRecord :@: Paragraph {paragraph} :@: prodigyMeta, paragraphText) to :: FilePath -> FilePath -> ArticleRecord @ Entry -> IO [ParagraphMeta] -- GitLab