aboutsummaryrefslogtreecommitdiff
path: root/README.org
blob: 17f73af5ea68f4941bd7c9685ae715354105003d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#+title: Monads in Haskell
#+date: 2024H2

* Task
:PROPERTIES:
:CUSTOM_ID: task
:END:
Implement two syntax analyzers that solve the following tasks:
1. Develop a parser for processing strings from a text file.  It has
   to:
   - Read lines containing values and binary operations from a text
     file (=.txt=), the name of which is entered by the user.
   - Parse values represented by integers in decimal the number
     system.
   - Process binary operations: addition, subtraction, multiplication.
     division.
   - Calculate the result of an expression and display it on the
     screen.
2. Develop a text parser and text continuation generator. Tasks:
   1. Read the text from the file, the name of which is entered by the
      user, and perform its syntactic analysis:
      - Split the text into sentences using the following rules: words
        consist only of letters; sentences consist of words and
        separated by characters: =.!?;:()=.
      - Remove all punctuation characters and numbers from the text.
   2. Build an N-gram model:
      - Use bigrams and trigrams.
      - Create a dictionary where the keys are one word or a pair
        words, and values --- lists of all unique possible
        continuations.
      - Save the dictionary to a text file (=.txt=).
   3. Implement user interaction:
      - When entering one or a couple of words, return a random
        string.  a text of 2 to 15 words, based on the created
        dictionary.
      - If the entered word is not in the dictionary keys, display a
        message indicating this.
   4. Organize a dialogue between two N‑gram models created based on
      two different texts:
      - The user specifies an initial word or a pair of words and the
        number of messages (the depth of the dialogue).
      - The answer of each model is based on the last word (or the
        penultimate one, if the latter is not in the dictionary) of
        the opponent's previous message.

Use works of art as texts for building models: *Ilfa and Petrov*

* Documentation
:PROPERTIES:
:CUSTOM_ID: documentation
:END:
The exported report can be found at [[https://git.michalec.dev/files/uni/term-05/func-prog/coursework/report.pdf][this link]].

* Unlicense
:PROPERTIES:
:CUSTOM_ID: unlicense
:END:
#+include: UNLICENSE verse