Compare commits

...

68 Commits

Author SHA1 Message Date
Pawel Felcyn
da203c4b6f f 2024-01-21 21:43:56 +01:00
Pawel Felcyn
9081d592a0 Merge remote-tracking branch 'wmi_upstream/main' 2024-01-08 14:15:57 +01:00
Pawel Felcyn
53ac53201c e 2024-01-08 14:14:27 +01:00
Jacek Kałużny
dc0392f7d6
Delete TaskG04 directory 2024-01-08 13:58:09 +01:00
Jacek Kałużny
ae508b36b1
Update description.txt 2024-01-08 13:56:18 +01:00
Jacek Kałużny
cd6b06cefa
Update description.txt 2024-01-08 13:55:58 +01:00
Jacek Kałużny
c818e6742f
Update description.txt 2024-01-08 13:55:38 +01:00
Jacek Kałużny
6b53fddd75
Update description.txt 2024-01-08 13:54:44 +01:00
Jacek Kałużny
8fb54512d7
Add files via upload 2024-01-08 11:27:35 +01:00
Pawel Felcyn
b1e6a2a7f8 e od 0 do 7 2024-01-07 23:04:53 +01:00
Pawel Felcyn
9e915b26ba e00 2023-12-11 14:40:10 +01:00
Pawel Felcyn
f3924b4961 d04 2023-12-11 14:31:09 +01:00
Pawel Felcyn
c40716abe8 d03 2023-12-11 14:23:02 +01:00
Pawel Felcyn
e1be7d9d73 d02 2023-12-11 14:16:28 +01:00
Pawel Felcyn
6f56d563d4 d01 2023-12-11 14:07:25 +01:00
Pawel Felcyn
858de1d809 Merge remote-tracking branch 'wmi_upstream/main' 2023-12-11 14:00:40 +01:00
Jacek Kałużny
2a11de62de
Add files via upload 2023-12-11 11:42:57 +01:00
Jacek Kałużny
f0b3128a5d
Add files via upload 2023-12-11 11:41:28 +01:00
Pawel Felcyn
6fbb005972 c03 2023-12-10 22:24:36 +01:00
Pawel Felcyn
5ef5ae56b5 c02 2023-12-10 22:21:29 +01:00
Pawel Felcyn
9f7409a8c5 c01 2023-12-10 22:17:14 +01:00
Pawel Felcyn
f60d42816e c00 2023-12-10 21:57:29 +01:00
Pawel Felcyn
1820fc5e14 Merge remote-tracking branch 'wmi_upstream/main' 2023-11-27 14:01:38 +01:00
Jacek Kałużny
ffdd599310
Add files via upload 2023-11-27 12:29:45 +01:00
Jacek Kałużny
e4b645e080
Add files via upload 2023-11-27 11:00:24 +01:00
Jacek Kałużny
3eb63c638d
Update description.txt 2023-11-27 10:58:05 +01:00
Jacek Kałużny
5b5256e00a
Update description.txt 2023-11-27 10:57:38 +01:00
Jacek Kałużny
a1cee0ae11
Update description.txt 2023-11-27 10:57:10 +01:00
Jacek Kałużny
ef01b8e788
Update description.txt 2023-11-27 10:56:43 +01:00
Jacek Kałużny
5b7ca344ae
Add files via upload 2023-11-27 10:56:21 +01:00
Pawel Felcyn
060ba0d890 add helpers 2023-11-13 15:02:07 +01:00
Pawel Felcyn
d04a124987 fix b06 2023-11-13 15:00:14 +01:00
Pawel Felcyn
ad9e565a23 b09 2023-11-13 14:57:17 +01:00
Pawel Felcyn
0b4741a48c b08 2023-11-13 14:52:51 +01:00
Pawel Felcyn
e1e1346813 fix b07 2023-11-13 14:50:07 +01:00
Pawel Felcyn
4f60436fc0 b07 2023-11-13 14:39:16 +01:00
Pawel Felcyn
3e1db9e80c b06 2023-11-13 14:24:03 +01:00
Pawel Felcyn
f57b8ff2b6 b05 2023-11-13 14:06:11 +01:00
Jacek Kałużny
c1d39e1306
Update description.txt 2023-11-13 10:38:48 +01:00
Jacek Kałużny
2b98340896
Update description.txt 2023-11-13 10:38:21 +01:00
Jacek Kałużny
ce0c53d50a
Update description.txt 2023-11-13 10:35:56 +01:00
Jacek Kałużny
c9335bdb9f
Update description.txt 2023-11-13 10:34:29 +01:00
Jacek Kałużny
dcf45a1d54
Update description.txt 2023-11-13 10:34:05 +01:00
Jacek Kałużny
4f03509917
Update description.txt 2023-11-13 10:33:49 +01:00
Jacek Kałużny
807770dd92
Update description.txt 2023-11-13 10:33:30 +01:00
Jacek Kałużny
576a05281f
Update description.txt 2023-11-13 10:31:04 +01:00
Jacek Kałużny
55a1a16560
Add files via upload 2023-11-13 10:29:11 +01:00
Pawel Felcyn
58a11535df b04 2023-11-11 20:21:28 +01:00
Pawel Felcyn
17e95848f6 b03 2023-11-11 20:19:35 +01:00
Pawel Felcyn
5c03c766de b02 2023-11-11 20:11:16 +01:00
Pawel Felcyn
e1e0578083 b01 2023-11-11 20:09:29 +01:00
Pawel Felcyn
a09908bb53 b00 2023-11-11 19:28:17 +01:00
Jacek Kałużny
2b37e5c4cf
Update README.md 2023-10-30 14:23:44 +01:00
Pawel Felcyn
96a028393c Merge remote-tracking branch 'wmi_upstream/main' 2023-10-30 13:57:54 +01:00
Jacek Kałużny
39345a1424
Update description.txt 2023-10-30 09:54:23 +01:00
Jacek Kałużny
713fa2349d
Update description.txt 2023-10-30 09:51:14 +01:00
Jacek Kałużny
fa7060ad43
Update description.txt 2023-10-30 09:50:39 +01:00
Jacek Kałużny
f11377a4b5
Update description.txt 2023-10-30 09:50:10 +01:00
Jacek Kałużny
3e4026d2db
Update README.md 2023-10-30 09:49:37 +01:00
Jacek Kałużny
cfb4d0806d
Update README.md 2023-10-30 09:49:22 +01:00
Jacek Kałużny
4b34cb1d3a
Update description.txt 2023-10-30 09:48:26 +01:00
Jacek Kałużny
60e52dd992
Update description.txt 2023-10-30 09:47:59 +01:00
Jacek Kałużny
fec8352787
Update description.txt 2023-10-30 09:47:03 +01:00
Jacek Kałużny
b12c09ad32
Update description.txt 2023-10-30 09:46:20 +01:00
Jacek Kałużny
85c35b6bdf
Update description.txt 2023-10-30 09:45:07 +01:00
Jacek Kałużny
b2809dd921
Update description.txt 2023-10-30 09:44:34 +01:00
Jacek Kałużny
7fde0b4513
Add files via upload 2023-10-30 09:43:54 +01:00
Pawel Felcyn
ee561d0f06 tasks 1 2023-10-28 18:05:08 +02:00
358 changed files with 1444993 additions and 344 deletions

349
README.md
View File

@ -1,6 +1,11 @@
## Zajęcia 1
Copyright AMU Poznan
Made by multiple people
### Informacje na temat przedmiotu
Prowadzący: Jacek Kałużny
@ -18,347 +23,3 @@ W ten sposób będziemy aktualizować zadania co zajęcia.
Zadania robimy do końca soboty poprzedzającej zajęcia
Rozwiązanie zapisujemy w pliku run.py
## Zajęcia 2 Wyrażenia regularne
Dokumentacja wyrażeń regularnych w python3: https://docs.python.org/3/library/re.html
### Podstawowe funkcje
search - zwraca pierwsze dopasowanie w napisie
findall - zwraca listę wszystkich dopasowań (nienakładających się na siebie)
match - zwraca dopasowanie od początku string
To tylko podstawowe funkcje, z których będziemy korzystać. W dokumentacji opisane są wszystkie.
### Obiekt match
```
import re
answer = re.search('na','banan')
print(answer)
print(answer.start())
print(answer.end())
print(answer.group())
answer = re.search('na','kabanos')
print(answer)
type(answer)
if answer:
print(answer.group())
else:
pass
```
### Metaznaki
- [] - zbiór znaków
- . - jakikolwiek znak
- ^ - początek napisu
- $ - koniec napisu
- ? - znak występuje lub nie występuje
- \* - zero albo więcej pojawień się
- \+ - jeden albo więcej pojawień się
- {} - dokładnie tyle pojawień się
- | - lub
- () - grupa
- \ -znak ucieczki
- \d digit
- \D nie digit
- \s whitespace
- \S niewhitespace
### Flagi
Można użyć specjalnych flag, np:
`re.search('ma', 'AlA Ma KoTa', re.IGNORECASE)`.
### Przykłady (objaśnienia na laboratoriach)
Do nauki lepiej użyć pythona w wersji interaktywnej, a najlepiej ipython.
```
import re
text = 'Ala ma kota i hamak, oraz 150 bananów.'
re.search('ma',text)
re.match('ma',text)
re.match('Ala ma',text)
re.findall('ma',text)
re.findall('[mn]a',text)
re.findall('[0-9]',text)
re.findall('[0-9abc]',text)
re.findall('[a-z][a-z]ma[a-z]',text)
re.findall('[a-zA-Z][a-zA-Z]ma[a-zA-z0-9]',text)
re.findall('\d',text)
re.search('[0-9][0-9][0-9]',text)
re.search('[\d][\d][\d]',text)
re.search('\d{2}',text)
re.search('\d{3}',text)
re.search('\d+',text)
re.search('\d+ bananów',text)
re.search('\d* bananów','Ala ma dużo bananów')
re.search('\d* bananów',text)
re.search('ma \d? bananów','Ala ma 5 bananów')
re.search('ma ?\d? bananów','Ala ma bananów')
re.search('ma( \d)? bananów','Ala ma bananów')
re.search('\d+ bananów','Ala ma 10 bananów albo 20 bananów')
re.search('\d+ bananów$','Ala ma 10 bananów albo 20 bananów')
text = 'Ala ma kota i hamak, oraz 150 bananów.'
re.search('\d+ bananów',text)
re.search('\d+\sbananów',text)
re.search('kota . hamak',text)
re.search('kota . hamak','Ala ma kota z hamakiem')
re.search('kota .* hamak','Ala ma kota lub hamak')
re.search('\.',text)
re.search('kota|psa','Ala ma kota lub hamak')
re.findall('kota|psa','Ala ma kota lub psa')
re.search('kota (i|lub) psa','Ala ma kota lub psa')
re.search('mam (kota).*(kota|psa)','Ja mam kota. Ala ma psa.').group(0)
re.search('mam (kota).*(kota|psa)','Ja mam kota. Ala ma psa.').group(1)
re.search('mam (kota).*(kota|psa)','Ja mam kota. Ala ma psa.').group(2)
```
### Przykłady wyrażenia regularne 2 (objaśnienia na laboratoriach)
#### ^
```
re.search('[0-9]+', '123-456-789')
re.search('[^0-9][0-9]+[^0-9]', '123-456-789')
```
#### cudzysłów
'' oraz "" - oznaczają to samo w pythonie
' ala ma psa o imieniu "Burek"'
" ala ma psa o imieniu 'Burek' "
' ala ma psa o imieniu \'Burek\' '
" ala ma psa o imieniu \"Burek\" "
#### multiline string
#### raw string
przy raw string znaki \ traktowane są jako zwykłe znaki \
chociaż nawet w raw string nadal są escapowane (ale wtedy \ pozostają również w stringu bez zmian)
https://docs.python.org/3/reference/lexical_analysis.html
dobra praktyka - wszędzie escapować
```
'\\'
print('\\')
r'\\'
print(r'\\')
print("abcd")
print("ab\cd")
print(r"ab\cd")
print("ab\nd")
print(r"ab\nd")
print("\"")
print(r"\"")
print("\")
print(r"\")
re.search('\\', r'a\bc')
re.search(r'\\', r'a\bc')
re.search('\\\\', r'a\bc')
```
#### RE SUB
```
re.sub(pattern, replacement, string)
re.sub('a','b', 'ala ma kota')
```
#### backreferencje:
```
re.search(r' \d+ \d+', 'ala ma 41 41 kota')
re.search(r' \d+ \d+', 'ala ma 41 123 kota')
re.search(r' (\d+) \1', 'ala ma 41 41 kota')
re.search(r' (\d+) \1', 'ala ma 41 123 kota')
```
#### lookahead ( to sa takie assercje):
```
re.search(r'ma kot', 'ala ma kot')
re.search(r'ma kot(?=[ay])', 'ala ma kot')
re.search(r'ma kot(?=[ay])', 'ala ma kotka')
re.search(r'ma kot(?=[ay])', 'ala ma koty')
re.search(r'ma kot(?=[ay])', 'ala ma kota')
re.search(r'ma kot(?![ay])', 'ala ma kot')
re.search(r'ma kot(?![ay])', 'ala ma kotka')
re.search(r'ma kot(?![ay])', 'ala ma koty')
re.search(r'ma kot(?![ay])', 'ala ma kota')
```
#### named groups
```
r = re.search(r'ma (?P<ilepsow>\d+) kotow i (?P<ilekotow>\d+) psow', 'ala ma 100 kotow i 200 psow')
r.groups()
r.groups('ilepsow')
r.groups('ilekotow')
```
#### re.split
```
('a,b.c,d').split(',')
('a,b.c,d').split(',')
('a,b.c,d').split(',.')
re.split(r',', 'a,b.c,d')
re.split(r'[.,]', 'a,b.c,d')
```
#### \w word character
```
\w - matchuje Unicod word character , jeżeli flaga ASCII to [a-zA-Z0-9_]
\w - odwrotne do \W, jezeli flaga ASCI to [^a-zA-Z0-9_]
re.findall(r'\w+', 'ala ma 3 koty.')
re.findall(r'\W+', 'ala ma 3 koty.')
```
#### początek albo koniec słowa | word boundary
```
re.search(r'\bkot\b', 'Ala ma kota')
re.search(r'\bkot\b', 'Ala ma kot')
re.search(r'\bkot\b', 'Ala ma kot.')
re.search(r'\bkot\b', 'Ala ma kot ')
re.search(r'\Bot\B', 'Ala ma kot ')
re.search(r'\Bot\B', 'Ala ma kota ')
```
#### MULTILINE
```
re.findall(r'^Ma', 'Ma kota Ala\nMa psa Jacek')
re.findall(r'^Ma', 'Ma kota Ala\nMa psa Jacek', re.MULTILINE)
```
#### RE.COMPILE
## zajęcia 6
instalacja https://pypi.org/project/google-re2/
### DFA i NDFA
```
import re2 as re
n = 50
regexp = "a?"*n+"a"*n
s = "a"*n
re.match(regexp, s)
```
```
re.match(r"(\d)abc\1", "3abc3") # re2 nie obsługuje backreferencji
```
re2 max memory - podniesienie limitu
time # mierzenie czasu działania
gdyby ktoś chciał poczytać więcej:
https://swtch.com/~rsc/regexp/regexp1.html
### UTF-8
```
c = ""
ord(c)
chr(8459)
8* 16**2 + 0 * 16**(1) + 0*16**(0)
15*16**3 + 15* 16**2 + 15 * 16**(1) + 15*16**(0)
```
```
xxd -b file
xxd file
```
termin oddawania zadań - 15. listopada
## Zajęcia 7
https://www.openfst.org/twiki/bin/view/GRM/Thrax
https://www.cs.jhu.edu/~jason/465/hw-ofst/hw-ofst.pdf
Wszystkie zadania proszę robić na wzór `TaskH00`. Proszę umieszczać gramatykę w pliku `grammar.grm` oraz
opisywać finalną regułę nazwą `FinalRule`.
## KOLOKWIUM
Operatory, obowiązujące na kolokwium
====================================
* kwantyfikatory `-` `*` `+` `?` `{n}` `{n,}` `{n, m}`
* alternatywa — `|`
* klasy znaków — `[...]`
* zanegowane klasy znaków — `[^...]`
* dowolny znak — `.`
* unieważnianie znaków specjalnych — \
* operatory zakotwiczające — `^` `$`
Na kolokwium do każdego z 4 pytań będą 3 podpunkty. Na każdy podpunkt odpowiadamy TAK/NIE. Czas trwania to 15 minut.
- zawsze daszek i dolar
- nie bierzemy pod uwagę capturing (jeżeli są pytania o równoważne)
- proponuję wydrukować cały test w wersji bez opdowiedzi i sprawdzać
Do zaliczenia należy zdobyć conajmniej 10 punktów.

20
TaskA01/run.py Normal file
View File

@ -0,0 +1,20 @@
def contains_word(to_be_checked: str, word: str) -> bool:
word_len: int = len(word)
word_character_number: int = 0
for c in to_be_checked:
if c != word[word_character_number]:
word_character_number = 0
continue
if word_character_number == word_len - 1:
return True
word_character_number += 1
return False
file = open('shakespeare.exp', 'r', encoding='utf8')
result = []
line_number = 0
for line in file:
if contains_word(line, 'Hamlet'):
result.append(line_number)
line_number += 1
print(result)

62
TaskA02/run.py Normal file
View File

@ -0,0 +1,62 @@
class Machine:
_state: int = 0
def consume_character(self, char: str) -> None:
if self._state == 0:
if char == 'P' or char == 'p':
self._state = 1
else:
self._state = 6
elif self._state == 1:
if char == 'I' or char == 'i':
self._state = 2
else:
self._state = 6
elif self._state == 2:
if char == 'E' or char == 'e':
self._state = 3
else:
self._state = 6
elif self._state == 3:
if char == 'S' or char == 's':
self._state = 4
else:
self._state = 6
elif self._state == 4:
if char == '\n' or char == ' ' or char == '\t' or char == '\r':
self._state = 5
else:
self._state = 6
elif self._state == 6:
if char == ' ' or char == '\t':
self._state = 0
def is_success_state(self) -> bool:
return self._state == 5
def restart(self) -> None:
self._state = 0
def find_lines_with_pies(text: str) -> list[int]:
output: list[int] = []
line_number = 0
machine = Machine()
for char in text:
machine.consume_character(char)
if char == '\n':
if machine.is_success_state():
output.append(line_number)
machine.restart()
line_number += 1
if machine.is_success_state():
output.append(line_number)
line_number += 1
return output
text: str = None
with open('polish_wiki_excerpt.exp', 'r', encoding='utf8') as file:
text = file.read()
result = find_lines_with_pies(text)
print(result)

70
TaskA03/run.py Normal file
View File

@ -0,0 +1,70 @@
class Machine:
_state: int = 0
def consume_character(self, char: str) -> None:
if self._state == 0:
if char == '1':
self._state = 1
else:
self._state = 0
elif self._state == 1:
if char == '9':
self._state = 2
else:
self._state = 0
elif self._state == 2:
if char == '1' or char == '2' or char == '3' or char == '4' or char == '5' or char == '6' or char == '7' or char == '8' or char == '9':
self._state = 3
else:
self._state = 0
elif self._state == 3:
if char == '1' or char == '2' or char == '3' or char == '4' or char == '5' or char == '6' or char == '7' or char == '8' or char == '9':
self._state = 4
else:
self._state = 0
elif self._state == 4:
if char == ' ':
self._state = 5
else:
self._state = 0
elif self._state == 5:
if char == 'r':
self._state = 6
else:
self._state = 0
elif self._state == 6:
if char == '.':
self._state = 7
else:
self._state = 0
def is_success_state(self) -> bool:
return self._state == 7
def restart(self) -> None:
self._state = 0
def find_lines_with_date(text: str) -> list[int]:
output: list[int] = []
line_number = 0
machine = Machine()
for char in text:
machine.consume_character(char)
if char == '\n':
if machine.is_success_state():
output.append(line_number)
machine.restart()
line_number += 1
if machine.is_success_state():
output.append(line_number)
line_number += 1
return output
text: str = None
with open('polish_wiki_excerpt.exp', 'r', encoding='utf8') as file:
text = file.read()
result = find_lines_with_date(text)
print(result)

51
TaskA04/run.py Normal file
View File

@ -0,0 +1,51 @@
class Machine:
_state: int = 0
_current_digital_substring: str = ''
_results: list[str] = []
def consume_character(self, char: str) -> None:
if self._state == 0:
if self._is_digit(char):
self._state = 1
self._current_digital_substring += char
elif not self._is_separator(char):
self.state = 2
elif self._state == 1:
if self._is_digit(char):
self._current_digital_substring += char
elif not self._is_separator(char):
self.state = 2
self._current_digital_substring = ''
else:
self.finish()
elif self._state == 2:
if self._is_separator(char):
self.state = 0
def _is_separator(self, char) -> bool:
return char == '\n' or char == ' ' or char == '\t'
def _is_digit(self, char: str) -> bool:
return char == '1' or char == '2' or char == '3' or char == '4' or char == '5' or char == '6' or char == '7' or char == '8' or char == '9'
def finish(self) -> None:
if self._current_digital_substring != '':
self._results.append(self._current_digital_substring)
self._current_digital_substring = ''
self._state = 0
def get_results(self) -> list[int]:
return self._results
text: str = None
with open('simple.exp', 'r', encoding='utf8') as file:
text = file.read()
machine = Machine()
for c in text:
machine.consume_character(c)
machine.finish()
print(machine.get_results())

8
TaskB00/description.txt Normal file
View File

@ -0,0 +1,8 @@
Read a description of a deterministic finite-state automaton in the AT&T format
(without weights) from the file in the first argument.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.
The program is invoked like this: ./run.py fsa_description.arg < test1.in > test1.out

View File

@ -0,0 +1,16 @@
0 1 x
1 2 y
2 3 z
0 4 y
0 4 z
1 4 x
1 4 z
2 4 x
2 4 y
3 4 x
3 4 y
3 4 z
4 4 x
4 4 y
4 4 z
3

36
TaskB00/run.py Normal file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python3
import pandas as pd
import os
import sys
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep='\t', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
input_file_path = os.path.join(os.path.dirname(__file__), 'test1.in')
output_file_path = os.path.join(os.path.dirname(__file__), 'test1.out')
results: list[str] = []
with open(input_file_path, 'r', encoding='utf8') as input_file:
for line in input_file:
state = 0
for c in line:
if c == '\n':
continue
state = automat_function(c, state)
results.append('YES\n' if state == accept_state else 'NO\n')
with open(output_file_path, 'w') as output_file:
output_file.writelines(results)

9
TaskB00/test1.exp Normal file
View File

@ -0,0 +1,9 @@
NO
YES
NO
NO
NO
NO
NO
NO
NO

9
TaskB00/test1.in Normal file
View File

@ -0,0 +1,9 @@
xxyz
xyz
xy
zz
xxy
yzx
x
xyzz

9
TaskB00/test1.out Normal file
View File

@ -0,0 +1,9 @@
NO
YES
NO
NO
NO
NO
NO
NO
NO

10
TaskB01/description.txt Normal file
View File

@ -0,0 +1,10 @@
Use a deterministic finite-state automaton (FSA) engine from the TaskE00.
Create your own FSA description to check whether the string starts with "01" and ends with "01.
Save it to fsa_description.arg file.
The alphabet is "0", "1".
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

View File

@ -0,0 +1,11 @@
0 4 1
4 4 0
4 4 1
0 1 0
1 4 0
1 2 1
2 3 0
2 3 1
3 3 0
3 2 1
2

29
TaskB01/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep=' ', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write binary sequence: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(int(c), state)
print('YES' if state == accept_state else "NO")
txt = input('Write binary sequence: ')

14
TaskB01/test.exp Normal file
View File

@ -0,0 +1,14 @@
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO

14
TaskB01/test.in Normal file
View File

@ -0,0 +1,14 @@
01
10
0101
1010
011101
101010
100010
0100001
00110
0000
10101
0
1

9
TaskB02/description.txt Normal file
View File

@ -0,0 +1,9 @@
Use a deterministic finite-state automaton (FSA) engine from the TaskE00.
Create your own FSA description to check whether the string starts with "10" and ends with "10.
Save it to fsa_description.arg file.
The alphabet is "0", "1".
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

View File

@ -0,0 +1,11 @@
0 4 0
4 4 1
4 4 0
0 1 1
1 4 1
1 2 0
2 3 1
2 3 0
3 3 1
3 2 0
2

29
TaskB02/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep=' ', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write binary sequence: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(int(c), state)
print('YES' if state == accept_state else "NO")
txt = input('Write binary sequence: ')

14
TaskB02/test.exp Normal file
View File

@ -0,0 +1,14 @@
NO
YES
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO

14
TaskB02/test.in Normal file
View File

@ -0,0 +1,14 @@
01
10
0101
1010
011101
101010
100010
0100001
00110
0000
10101
0
1

11
TaskB03/description.txt Normal file
View File

@ -0,0 +1,11 @@
Use a deterministic finite-state automaton (FSA) engine from the TaskE00.
Create your own FSA description to check whether the string contains "0"
even number of times.
Save it to fsa_description.arg file.
The alphabet is "0", "1".
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

View File

@ -0,0 +1,5 @@
0 1 0
1 0 0
0 0 1
1 1 1
0

29
TaskB03/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep=' ', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write binary sequence: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(int(c), state)
print('YES' if state == accept_state else "NO")
txt = input('Write binary sequence: ')

14
TaskB03/test.exp Normal file
View File

@ -0,0 +1,14 @@
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES

14
TaskB03/test.in Normal file
View File

@ -0,0 +1,14 @@
01
10
0101
1010
011101
101010
100010
0100001
00110
0000
10101
0
1

11
TaskB04/description.txt Normal file
View File

@ -0,0 +1,11 @@
Use a deterministic finite-state automaton (FSA) engine from the TaskE00.
Create your own FSA description to check whether the string contains "0"
odd number of times.
Save it to fsa_description.arg file.
The alphabet is "0", "1".
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

View File

@ -0,0 +1,5 @@
0 1 0
1 0 0
0 0 1
1 1 1
1

29
TaskB04/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep=' ', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write binary sequence: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(int(c), state)
print('YES' if state == accept_state else "NO")
txt = input('Write binary sequence: ')

14
TaskB04/test.exp Normal file
View File

@ -0,0 +1,14 @@
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO

14
TaskB04/test.in Normal file
View File

@ -0,0 +1,14 @@
01
10
0101
1010
011101
101010
100010
0100001
00110
0000
10101
0
1

10
TaskB05/description.txt Normal file
View File

@ -0,0 +1,10 @@
Use a deterministic finite-state automaton (FSA) engine from the TaskB00.
Create your own FSA description to check whether the line contains string '19DD', where D is a digit.
Save it to fsa_description.arg file.
FSA alphabet is '0123456789x'.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

View File

@ -0,0 +1,56 @@
0 1 1
1 2 9
2 3 0
2 3 1
2 3 2
2 3 3
2 3 4
2 3 5
2 3 6
2 3 7
2 3 8
2 3 9
3 4 0
3 4 1
3 4 2
3 4 3
3 4 4
3 4 5
3 4 6
3 4 7
3 4 8
3 4 9
4 4 0
4 4 1
4 4 2
4 4 3
4 4 4
4 4 5
4 4 6
4 4 7
4 4 8
4 4 9
4 4 x
0 0 x
0 0 0
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
1 0 x
1 0 0
1 0 1
1 0 2
1 0 3
1 0 4
1 0 5
1 0 6
1 0 7
1 0 8
2 0 x
3 0 x
4

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

29
TaskB05/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep=' ', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write valid input: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(c, state)
print('YES' if state == accept_state else "NO")
txt = input('Write valid input: ')

6
TaskB05/simple.exp Normal file
View File

@ -0,0 +1,6 @@
NO
YES
NO
NO
YES
YES

6
TaskB05/simple.in Normal file
View File

@ -0,0 +1,6 @@
3214545443
1910
19
xxx2190x
xxx21905x
1905x54545

9
TaskB06/description.txt Normal file
View File

@ -0,0 +1,9 @@
Use a deterministic finite-state automaton (FSA) engine from the previous task.
Create your own FSA description to check whether the word "hamlet" is in the given line.
Save it to fsa_description.arg file.
FSA alphabet is 'abcdefghijklmnopqrstuvwxyz '.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

190
TaskB06/fsa_description.arg Normal file
View File

@ -0,0 +1,190 @@
0 0 a
1 2 a
2 0 a
3 0 a
4 0 a
5 0 a
6 6 a
0 0 b
1 0 b
2 0 b
3 0 b
4 0 b
5 0 b
6 6 b
0 0 c
1 0 c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
6

29
TaskB06/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep='\t', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write valid input: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(c, state)
print('YES' if state == accept_state else "NO")
txt = input('Write valid input: ')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3
TaskB06/simple.exp Normal file
View File

@ -0,0 +1,3 @@
NO
YES
YES

3
TaskB06/simple.in Normal file
View File

@ -0,0 +1,3 @@
haml
hamlet
aaahamletbbb

10
TaskB07/description.txt Normal file
View File

@ -0,0 +1,10 @@
Use a deterministic finite-state automaton (FSA) engine from the previous task.
Create your own FSA description to check whether the word "ophelia" is in the given line.
Save it to fsa_description.arg file.
FSA alphabet is 'abcdefghijklmnopqrstuvwxyz '.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

217
TaskB07/fsa_description.arg Normal file
View File

@ -0,0 +1,217 @@
0 0 a
1 0 a
2 0 a
3 0 a
4 0 a
5 0 a
6 7 a
7 7 a
0 0 b
1 0 b
2 0 b
3 0 b
4 0 b
5 0 b
6 0 b
7 7 b
0 0 c
1 0 c
2 0 c
3 0 c
4 0 c
5 0 c
6 0 c
7 7 c
0 0 d
1 0 d
2 0 d
3 0 d
4 0 d
5 0 d
6 0 d
7 7 d
0 0 e
1 0 e
2 0 e
3 4 e
4 0 e
5 0 e
6 0 e
7 7 e
0 0 f
1 0 f
2 0 f
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29
TaskB07/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep='\t', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write valid input: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(c, state)
print('YES' if state == accept_state else "NO")
txt = input('Write valid input: ')

File diff suppressed because it is too large Load Diff

3
TaskB07/simple.exp Normal file
View File

@ -0,0 +1,3 @@
NO
YES
YES

3
TaskB07/simple.in Normal file
View File

@ -0,0 +1,3 @@
oph
ophelia
xfdfdopheliafff

10
TaskB08/description.txt Normal file
View File

@ -0,0 +1,10 @@
Use a deterministic finite-state automaton (FSA) engine from the previous task.
Create your own FSA description to check whether the word "juliet" is in the given line.
Save it to fsa_description.arg file.
FSA alphabet is 'abcdefghijklmnopqrstuvwxyz '.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

190
TaskB08/fsa_description.arg Normal file
View File

@ -0,0 +1,190 @@
0 0 a
1 0 a
2 0 a
3 0 a
4 0 a
5 0 a
6 6 a
0 0 b
1 0 b
2 0 b
3 0 b
4 0 b
5 0 b
6 6 b
0 0 c
1 0 c
2 0 c
3 0 c
4 0 c
5 0 c
6 6 c
0 0 d
1 0 d
2 0 d
3 0 d
4 0 d
5 0 d
6 6 d
0 0 e
1 0 e
2 0 e
3 0 e
4 5 e
5 0 e
6 6 e
0 0 f
1 0 f
2 0 f
3 0 f
4 0 f
5 0 f
6 6 f
0 0 g
1 0 g
2 0 g
3 0 g
4 0 g
5 0 g
6 6 g
0 0 h
1 0 h
2 0 h
3 0 h
4 0 h
5 0 h
6 6 h
0 0 i
1 0 i
2 0 i
3 4 i
4 0 i
5 0 i
6 6 i
0 1 j
1 0 j
2 0 j
3 0 j
4 0 j
5 0 j
6 6 j
0 0 k
1 0 k
2 0 k
3 0 k
4 0 k
5 0 k
6 6 k
0 0 l
1 0 l
2 3 l
3 0 l
4 0 l
5 0 l
6 6 l
0 0 m
1 0 m
2 0 m
3 0 m
4 0 m
5 0 m
6 6 m
0 0 n
1 0 n
2 0 n
3 0 n
4 0 n
5 0 n
6 6 n
0 0 o
1 0 o
2 0 o
3 0 o
4 0 o
5 0 o
6 6 o
0 0 p
1 0 p
2 0 p
3 0 p
4 0 p
5 0 p
6 6 p
0 0 q
1 0 q
2 0 q
3 0 q
4 0 q
5 0 q
6 6 q
0 0 r
1 0 r
2 0 r
3 0 r
4 0 r
5 0 r
6 6 r
0 0 s
1 0 s
2 0 s
3 0 s
4 0 s
5 0 s
6 6 s
0 0 t
1 0 t
2 0 t
3 0 t
4 0 t
5 6 t
6 6 t
0 0 u
1 2 u
2 0 u
3 0 u
4 0 u
5 0 u
6 6 u
0 0 v
1 0 v
2 0 v
3 0 v
4 0 v
5 0 v
6 6 v
0 0 w
1 0 w
2 0 w
3 0 w
4 0 w
5 0 w
6 6 w
0 0 x
1 0 x
2 0 x
3 0 x
4 0 x
5 0 x
6 6 x
0 0 y
1 0 y
2 0 y
3 0 y
4 0 y
5 0 y
6 6 y
0 0 z
1 0 z
2 0 z
3 0 z
4 0 z
5 0 z
6 6 z
0 0
1 0
2 0
3 0
4 0
5 0
6 6
6

29
TaskB08/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep='\t', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write valid input: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(c, state)
print('YES' if state == accept_state else "NO")
txt = input('Write valid input: ')

File diff suppressed because it is too large Load Diff

3
TaskB08/simple.exp Normal file
View File

@ -0,0 +1,3 @@
NO
YES
YES

3
TaskB08/simple.in Normal file
View File

@ -0,0 +1,3 @@
juli
juliet
dgfdgjulietaaa

10
TaskB09/description.txt Normal file
View File

@ -0,0 +1,10 @@
Use a deterministic finite-state automaton (FSA) engine from the previous task.
Create your own FSA description to check whether the word "macbeth" is in the given line.
Save it to fsa_description.arg file.
FSA alphabet is 'abcdefghijklmnopqrstuvwxyz '.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

217
TaskB09/fsa_description.arg Normal file
View File

@ -0,0 +1,217 @@
0 0 a
1 2 a
2 0 a
3 0 a
4 0 a
5 0 a
6 0 a
7 7 a
0 0 b
1 0 b
2 0 b
3 4 b
4 0 b
5 0 b
6 0 b
7 7 b
0 0 c
1 0 c
2 3 c
3 0 c
4 0 c
5 0 c
6 0 c
7 7 c
0 0 d
1 0 d
2 0 d
3 0 d
4 0 d
5 0 d
6 0 d
7 7 d
0 0 e
1 0 e
2 0 e
3 0 e
4 5 e
5 0 e
6 0 e
7 7 e
0 0 f
1 0 f
2 0 f
3 0 f
4 0 f
5 0 f
6 0 f
7 7 f
0 0 g
1 0 g
2 0 g
3 0 g
4 0 g
5 0 g
6 0 g
7 7 g
0 0 h
1 0 h
2 0 h
3 0 h
4 0 h
5 0 h
6 7 h
7 7 h
0 0 i
1 0 i
2 0 i
3 0 i
4 0 i
5 0 i
6 0 i
7 7 i
0 0 j
1 0 j
2 0 j
3 0 j
4 0 j
5 0 j
6 0 j
7 7 j
0 0 k
1 0 k
2 0 k
3 0 k
4 0 k
5 0 k
6 0 k
7 7 k
0 0 l
1 0 l
2 0 l
3 0 l
4 0 l
5 0 l
6 0 l
7 7 l
0 1 m
1 0 m
2 0 m
3 0 m
4 0 m
5 0 m
6 0 m
7 7 m
0 0 n
1 0 n
2 0 n
3 0 n
4 0 n
5 0 n
6 0 n
7 7 n
0 0 o
1 0 o
2 0 o
3 0 o
4 0 o
5 0 o
6 0 o
7 7 o
0 0 p
1 0 p
2 0 p
3 0 p
4 0 p
5 0 p
6 0 p
7 7 p
0 0 q
1 0 q
2 0 q
3 0 q
4 0 q
5 0 q
6 0 q
7 7 q
0 0 r
1 0 r
2 0 r
3 0 r
4 0 r
5 0 r
6 0 r
7 7 r
0 0 s
1 0 s
2 0 s
3 0 s
4 0 s
5 0 s
6 0 s
7 7 s
0 0 t
1 0 t
2 0 t
3 0 t
4 0 t
5 6 t
6 0 t
7 7 t
0 0 u
1 0 u
2 0 u
3 0 u
4 0 u
5 0 u
6 0 u
7 7 u
0 0 v
1 0 v
2 0 v
3 0 v
4 0 v
5 0 v
6 0 v
7 7 v
0 0 w
1 0 w
2 0 w
3 0 w
4 0 w
5 0 w
6 0 w
7 7 w
0 0 x
1 0 x
2 0 x
3 0 x
4 0 x
5 0 x
6 0 x
7 7 x
0 0 y
1 0 y
2 0 y
3 0 y
4 0 y
5 0 y
6 0 y
7 7 y
0 0 z
1 0 z
2 0 z
3 0 z
4 0 z
5 0 z
6 0 z
7 7 z
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 7
7

29
TaskB09/run.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import pandas as pd
import os
def automat_fun(recursive_df: pd.DataFrame):
first_row = recursive_df.iloc[0]
recursive_df = recursive_df.iloc[1:,:]
return lambda char, state: first_row[1] if state == first_row[0] and char == first_row[2] else automat_fun(recursive_df)(char, state)
def create_automat_from_file(file_path: str):
df = pd.read_csv(file_path, sep='\t', header=None)
accept_state = df.tail(1).iloc[0, 0]
df = df.iloc[:-1,:]
return accept_state, automat_fun(df)
file_path = os.path.join(os.path.dirname(__file__), 'fsa_description.arg')
accept_state, automat_function = create_automat_from_file(file_path)
txt = input('Write valid input: ')
while txt != 'exit':
state = 0
for c in txt:
if (c == '\n'):
break
state = automat_function(c, state)
print('YES' if state == accept_state else "NO")
txt = input('Write valid input: ')

File diff suppressed because it is too large Load Diff

3
TaskB09/simple.exp Normal file
View File

@ -0,0 +1,3 @@
NO
YES
YES

3
TaskB09/simple.in Normal file
View File

@ -0,0 +1,3 @@
macb
macbeth
xadadamacbethrff

12
TaskC00/description.txt Normal file
View File

@ -0,0 +1,12 @@
Read a description of a non-deterministic finite-state automaton in the AT&T format
(without weights) from the file in the first argument.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.
The program is invoked like this: python run.py test1.arg test1.in test1.out
Note that not all transitions must be included in description.
If no transition is given for the given state and letter, write NO.

4040
TaskC00/long.arg Normal file

File diff suppressed because it is too large Load Diff

7
TaskC00/long.exp Normal file
View File

@ -0,0 +1,7 @@
NO
NO
YES
YES
NO
NO
NO

7
TaskC00/long.in Normal file
View File

@ -0,0 +1,7 @@
aaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
xyz
aba
a

56
TaskC00/run.py Normal file
View File

@ -0,0 +1,56 @@
import pandas as pd
import os
import sys
import random
class Automat:
def __init__(self, df: pd.DataFrame, end_states: list):
self._df = df
self._end_states = end_states
def _consume_character(self, state: int, char: str):
filter = (self._df[0] == state) & (self._df[2] == char)
matching_rows = self._df[filter]
if matching_rows.empty:
return None
end_states = matching_rows.iloc[:,1].tolist()
return random.choice(end_states)
def consume_word(self, word: str):
prev_state = 0
state = 0
for char in word:
prev_state = state
state = self._consume_character(state, char)
if state is None:
return prev_state in self._end_states
return state in self._end_states
def create_automat_from_file(file_path: str):
automat_df = pd.read_csv(file_path, sep='\t', header=None)
end_states_condition = (automat_df[1].isnull()) & (automat_df[2].isnull())
end_states_df = automat_df[end_states_condition]
end_states = end_states_df.iloc[:,0].tolist()
automat_df = automat_df[~end_states_condition]
automat_df[2] = automat_df[2].astype(str)
return Automat(automat_df, end_states)
automat_path = os.path.join(os.path.dirname(__file__), 'test1.arg')
automat = create_automat_from_file(automat_path)
test_path = os.path.join(os.path.dirname(__file__), 'test1.in')
results = []
with open(test_path, 'r') as f:
for line in f:
results.append('YES' if automat.consume_word(line.strip()) else 'NO')
out_path = os.path.join(os.path.dirname(__file__), 'test1.out')
with open(out_path, 'w') as f:
for result in results:
f.write(result + '\n')

16
TaskC00/test1.arg Normal file
View File

@ -0,0 +1,16 @@
0 1 x
1 2 y
2 3 z
0 4 y
0 4 z
1 4 x
1 4 z
2 4 x
2 4 y
3 4 x
3 4 y
3 4 z
4 4 x
4 4 y
4 4 z
3

9
TaskC00/test1.exp Normal file
View File

@ -0,0 +1,9 @@
NO
YES
NO
NO
NO
NO
NO
NO
NO

9
TaskC00/test1.in Normal file
View File

@ -0,0 +1,9 @@
xxyz
xyz
xy
zz
xxy
yzx
x
xyzz

9
TaskC00/test1.out Normal file
View File

@ -0,0 +1,9 @@
NO
YES
NO
NO
NO
NO
NO
NO
NO

7
TaskC00/testnfa.arg Normal file
View File

@ -0,0 +1,7 @@
0 1 a
1 0 a
1 2 b
2 4 c
1 3 b
3
4

8
TaskC00/testnfa.exp Normal file
View File

@ -0,0 +1,8 @@
YES
YES
NO
NO
NO
YES
NO
YES

8
TaskC00/testnfa.in Normal file
View File

@ -0,0 +1,8 @@
abc
ab
abcd
aaaabc
aaaaaaaabc
aaaaaaabc
zzz
aaaaaaabc

11
TaskC01/description.txt Normal file
View File

@ -0,0 +1,11 @@
Use a non deterministic finite-state automaton (FSA) engine from the TaskC00.
Create your own non deterministic FSA description to check whether the string second letter
from right is 'b'.
Don't use external files like in TaskF00 (description should be included in run file).
The alphabet is "a", "b", "C"
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

48
TaskC01/run.py Normal file
View File

@ -0,0 +1,48 @@
import pandas as pd
import os
import sys
import random
class Automat:
def __init__(self, df: pd.DataFrame, end_states: list):
self._df = df
self._end_states = end_states
def _consume_character(self, state: int, char: str):
filter = (self._df[0] == state) & (self._df[2] == char)
matching_rows = self._df[filter]
if matching_rows.empty:
return None
end_states = matching_rows.iloc[:,1].tolist()
return random.choice(end_states)
def consume_word(self, word: str):
prev_state = 0
state = 0
for char in word:
prev_state = state
state = self._consume_character(state, char)
if state is None:
return prev_state in self._end_states
return state in self._end_states
def create_automat_from_file(file_path: str):
automat_df = pd.read_csv(file_path, sep=' ', header=None)
end_states_condition = (automat_df[1].isnull()) & (automat_df[2].isnull())
end_states_df = automat_df[end_states_condition]
end_states = end_states_df.iloc[:,0].tolist()
automat_df = automat_df[~end_states_condition]
automat_df[2] = automat_df[2].astype(str)
return Automat(automat_df, end_states)
automat_path = os.path.join(os.path.dirname(__file__), 'test.arg')
automat = create_automat_from_file(automat_path)
test_path = os.path.join(os.path.dirname(__file__), 'test.in')
txt = input('Write valid input: ')
while txt != 'exit':
print('YES' if automat.consume_word(txt) else 'NO')
txt = input('Write valid input: ')

5
TaskC01/test.arg Normal file
View File

@ -0,0 +1,5 @@
0 1 a
0 1 b
0 1 c
1 2 b
2

6
TaskC01/test.exp Normal file
View File

@ -0,0 +1,6 @@
YES
YES
NO
NO
NO
YES

6
TaskC01/test.in Normal file
View File

@ -0,0 +1,6 @@
abc
abbc
bca
b
abaa
aaacbb

6
TaskC01/test.out Normal file
View File

@ -0,0 +1,6 @@
YES
YES
NO
NO
YES
NO

11
TaskC02/description.txt Normal file
View File

@ -0,0 +1,11 @@
Use a non deterministic finite-state automaton (FSA) engine from the TaskC00.
Create your own non deterministic FSA description to check whether the string
ends with "ab"
Don't use external files like in TaskF00 (description should be included in run file).
The alphabet is "a", "b", "C"
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

46
TaskC02/run.py Normal file
View File

@ -0,0 +1,46 @@
import pandas as pd
import os
import sys
import random
class Automat:
def __init__(self, df: pd.DataFrame, end_states: list):
self._df = df
self._end_states = end_states
def _consume_character(self, state: int, char: str):
filter = (self._df[0] == state) & (self._df[2] == char)
matching_rows = self._df[filter]
if matching_rows.empty:
return None
end_states = matching_rows.iloc[:,1].tolist()
return random.choice(end_states)
def consume_word(self, word: str):
prev_state = 0
state = 0
for char in word:
prev_state = state
state = self._consume_character(state, char)
if state is None:
return prev_state in self._end_states
return state in self._end_states
def create_automat_from_file(file_path: str):
automat_df = pd.read_csv(file_path, sep=' ', header=None)
end_states_condition = (automat_df[1].isnull()) & (automat_df[2].isnull())
end_states_df = automat_df[end_states_condition]
end_states = end_states_df.iloc[:,0].tolist()
automat_df = automat_df[~end_states_condition]
automat_df[2] = automat_df[2].astype(str)
return Automat(automat_df, end_states)
automat_path = os.path.join(os.path.dirname(__file__), 'test.arg')
automat = create_automat_from_file(automat_path)
txt = input('Write valid input: ')
while txt != 'exit':
print('YES' if automat.consume_word(txt) else 'NO')
txt = input('Write valid input: ')

6
TaskC02/test.arg Normal file
View File

@ -0,0 +1,6 @@
0 0 a
0 0 b
0 0 c
0 1 a
1 2 b
2

6
TaskC02/test.exp Normal file
View File

@ -0,0 +1,6 @@
YES
NO
YES
NO
YES
NO

6
TaskC02/test.in Normal file
View File

@ -0,0 +1,6 @@
ab
a
abbab
bbbbb
ababaab
b

6
TaskC02/test.out Normal file
View File

@ -0,0 +1,6 @@
NO
NO
NO
NO
YES
NO

10
TaskC03/description.txt Normal file
View File

@ -0,0 +1,10 @@
Use a non deterministic finite-state automaton (FSA) engine from the TaskC00.
Create your own non deterministic FSA description to check whether the string
contains "abc"
Don't use external files like in TaskF00 (description should be included in run file).
The alphabet is "a", "b", "c"
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.

46
TaskC03/run.py Normal file
View File

@ -0,0 +1,46 @@
import pandas as pd
import os
import sys
import random
class Automat:
def __init__(self, df: pd.DataFrame, end_states: list):
self._df = df
self._end_states = end_states
def _consume_character(self, state: int, char: str):
filter = (self._df[0] == state) & (self._df[2] == char)
matching_rows = self._df[filter]
if matching_rows.empty:
return None
end_states = matching_rows.iloc[:,1].tolist()
return random.choice(end_states)
def consume_word(self, word: str):
prev_state = 0
state = 0
for char in word:
prev_state = state
state = self._consume_character(state, char)
if state is None:
return prev_state in self._end_states
return state in self._end_states
def create_automat_from_file(file_path: str):
automat_df = pd.read_csv(file_path, sep=' ', header=None)
end_states_condition = (automat_df[1].isnull()) & (automat_df[2].isnull())
end_states_df = automat_df[end_states_condition]
end_states = end_states_df.iloc[:,0].tolist()
automat_df = automat_df[~end_states_condition]
automat_df[2] = automat_df[2].astype(str)
return Automat(automat_df, end_states)
automat_path = os.path.join(os.path.dirname(__file__), 'test.arg')
automat = create_automat_from_file(automat_path)
txt = input('Write valid input: ')
while txt != 'exit':
print('YES' if automat.consume_word(txt) else 'NO')
txt = input('Write valid input: ')

13
TaskC03/test.arg Normal file
View File

@ -0,0 +1,13 @@
0 0 a
0 0 b
0 0 c
0 1 a
1 1 a
1 1 b
1 1 c
1 2 b
2 2 a
2 2 b
2 2 c
2 3 c
3

7
TaskC03/test.exp Normal file
View File

@ -0,0 +1,7 @@
YES
YES
YES
NO
NO
NO
NO

7
TaskC03/test.in Normal file
View File

@ -0,0 +1,7 @@
abc
acabc
acabccb
abbab
bbbbb
ababaab
bc

22
TaskC04/description.txt Normal file
View File

@ -0,0 +1,22 @@
Deterministic automaton III
===========================
Read a description of a finite-state automaton in the AT&T format
(without weights) from the file in the first argument. Then, read strings from the
standard input. If a string is
accepted by the automated, write YES, a space and the string on the
standard output, otherwise — write NO, a space and the string.
If there is a non-determinism in the automaton, the first transition should be chosen.
The automaton can contain epsilon transitions ("<eps>" instead of a
character). They should be interpreted as follows: an epsilon
transition can be used (without "eating" a character from the input),
if there is no other transition applicable. You can assume that there
is at most one epsilon transition from a given state and that there
are no cycles with epsilon transition.
Your program does not have to check whether the description is correct
and whether the automaton is deterministic. You can assume that the
automaton does not contain epsilon transitions.

8
TaskC04/eps.arg Normal file
View File

@ -0,0 +1,8 @@
0 1 a
1 0 a
1 2 b
2 4 c
1 3 <eps>
3 4 d
3
4

10
TaskC04/eps.exp Normal file
View File

@ -0,0 +1,10 @@
TRUE a
FALSE aa
TRUE aaa
TRUE abc
TRUE aaabc
FALSE aaabcd
FALSE aabc
FALSE abd
TRUE ad
FALSE aad

10
TaskC04/eps.in Normal file
View File

@ -0,0 +1,10 @@
a
aa
aaa
abc
aaabc
aaabcd
aabc
abd
ad
aad

4041
TaskC04/long.arg Normal file

File diff suppressed because it is too large Load Diff

7
TaskC04/long.exp Normal file
View File

@ -0,0 +1,7 @@
FALSE aaa
FALSE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
TRUE aaaa
TRUE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
xyz
aba
a

5
TaskC04/simple1.arg Normal file
View File

@ -0,0 +1,5 @@
# prosty automat akceptujący tylko napis "abc"
0 1 a
1 2 b
2 3 c
3

Some files were not shown because too many files have changed in this diff Show More