From f3b595d9b00d6dfdeff1dda21ade2f4b08c03da9 Mon Sep 17 00:00:00 2001 From: Daniel Hladek Date: Sat, 25 Jan 2020 13:19:32 +0100 Subject: [PATCH] link rename tool --- linker.py | 72 ++++++++++++++++++++++++++++++++++ pages/topics/chatbot/README.md | 38 ++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 linker.py create mode 100644 pages/topics/chatbot/README.md diff --git a/linker.py b/linker.py new file mode 100644 index 0000000000..957ecbcbc0 --- /dev/null +++ b/linker.py @@ -0,0 +1,72 @@ +import os +import sys +import re +import posixpath +import argparse + +linkre = re.compile(r"\[(.+?)\]\((.+?)\)") + +def normlink(link,start_link): + if link.startswith("http"): + return link + target = posixpath.normpath(link) + # Absolute path + if target[0] == "/": + return target + elif target.startswith("./"): + target = posixpath.normpath(start_link + target) + else: + target = posixpath.normpath(start_link + "/" + target) + #print(">>>>>>" + link + " " + target) + #print(target) + return target + +def process(lfrom,lto): + for root, dirs, files in os.walk("./pages", topdown=False): + for file_name in files: + if not file_name.endswith(".md"): + continue + full_file_name = root + "/"+ file_name + # strip README.md + page_name = full_file_name[7:-10] + #print(page_name) + def replink(match): + name = match.group(1) + target = normlink(match.group(2),page_name) + #print(lto) + #print(target) + out = match.group(0) + if target == lfrom: + print("match at" + page_name + ":" + name) + if lto: + out = "[{}]({})".format(name,lto) + #print("Replaced to " + out) + + return out + + content = [] + changed = False + with open(full_file_name) as f: + for l in f: + if re.search(linkre,l) is not None: + line = re.sub(linkre,replink,l) + if line != l: + print("replace") + print(l.rstrip()) + print(line.rstrip()) + answer = sys.stdin.readline().strip() + if len(answer) == 0 or answer[0] != "n": + l = line + changed = True + content.append(l) + if lto and changed: + with open(full_file_name,"w") as f: + f.write("".join(content)) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("lfrom") + parser.add_argument("-r","--replace",type=str) + args = parser.parse_args() + process(args.lfrom,args.replace) + diff --git a/pages/topics/chatbot/README.md b/pages/topics/chatbot/README.md new file mode 100644 index 0000000000..9af1ecb92d --- /dev/null +++ b/pages/topics/chatbot/README.md @@ -0,0 +1,38 @@ +--- +title: chatbot +--- + +# Chatbot + +Ciele: Vytvorenie demonštračnej aplikácie pre interaktívnu komunikáciu s +automatom + +## Zdroje + + - + - + +### Prostriedky + + - [RASA toolbox](https://rasa.com/) + - Slack() - ako rozhranie + +## Riešitelia + + - Dmytro Ushatenko (Daniel Hládek), 19/20 + - Jozef Olekšák (Stanislav Ondáš) 18/19 Riadenie dialógu na báze + štatických metód + +## Existujúce riešenia + + - [KEMT Bot](https://kemt.fei.tuke.sk) + - + +## Riešiteľ 1 + +Zadanie: + +1. Vypracujte úvod do problematiky systémov pre riadenie dialógu +2. Vypracujte prehľad používaných metód riadenia dialógu +3. Navrhnite a implementujte agenta pre zisťovanie informácií o katedre + KEM