3 -- DEFINITIONS as SPECS
4 -- (Engineering axioms for Gargantext)
7 ------------------------------------------------------------------------
9 ------------------------------------------------------------------------
11 -- > A Corpus is a list of Documents
12 data Corpus = [Document]
14 -- > A Document should have a date, some text and a maybe a language.
16 -- > If no date then force one ?
17 -- > Analyze either text or numbers
18 -- > only one language per document
19 data Document = Document { date :: UTCTime
20 , uce :: Map Text $ Either (Maybe Text) (Maybe Double)
21 , lang :: Maybe Language
24 parseFiles :: Maybe ParserType -> [File] -> Corpus
25 parseFiles = undefined
27 -- This function exists already (in Python)
28 parseFile' :: ParserType -> File -> Maybe [Document]
29 parseFile' = undefined
31 -- This function does not exist yet
32 parseFile :: Maybe ParserType -> File -> Maybe [Document]
33 parseFile parserType file = documents
35 documents = case parserType of
37 Nothing -> case guessParserType file of
38 Nothing -> askUser "Answer to the question with link to $doc"
39 Just parserType' -> parseFile (Just parserType') file
41 Just parserType'' -> case parserType'' of
42 UnsupportedYet -> askUser "Not supported yet, which priority ?"
43 otherwise -> parseFile' parserType'' file
45 data ParserType = RIS | ISI | XML | CSV | Europresse | Book | UnsupportedYet
46 guessParserType :: File -> Maybe ParserType
47 guessParserType = undefined
50 ------------------------------------------------------------------------
51 -- What kind of interactions with our users ?
52 ------------------------------------------------------------------------
54 -- Question is Text only
58 data Answer = ClosedAnswer | NumAnswer | OpenAnswer
59 -- Definitions of the Answers
60 type ClosedAnswer = Bool
61 type OpenAnswer = Text
63 -- Un formulaire est un mapping entre question et peut-être une réponse
64 -- Un formulaire vide a Nothing au champs (Maybe Answer)
65 -- Une question répondue a la valeur (Just Response)
66 type Formular = Map Question (Maybe Answer)
68 askUser :: Question -> ClosedAnswer
71 data Advice = BugReport | WishList
72 askUser' :: Question -> Advice
73 askUser' question = case askUser question of
78 ------------------------------------------------------------------------
79 -- Specs for Lang Detection
80 ------------------------------------------------------------------------
81 data Language = English | French
83 tagDoc :: Document -> Ngrams
86 ngrams = case lang doc of
87 Nothing -> case guessLang doc of
91 ------------------------------------------------------------------------
92 -- Specs for ngrams Worflow
93 ------------------------------------------------------------------------