link rename tool

This commit is contained in:
Daniel Hladek 2020-01-25 13:19:32 +01:00
parent 40eb490b6b
commit f3b595d9b0
2 changed files with 110 additions and 0 deletions

72
linker.py Normal file
View File

@ -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)

View File

@ -0,0 +1,38 @@
---
title: chatbot
---
# Chatbot
Ciele: Vytvorenie demonštračnej aplikácie pre interaktívnu komunikáciu s
automatom
## Zdroje
- <https:%%//%%chatbotslife.com/how-you-can-build-your-first-chatbot-using-rasa-in-under-15-minutes-ce557ea52f2f>
- <https:%%//%%medium.com/analytics-vidhya/building-a-simple-chatbot-in-python-using-nltk-7c8c8215ac6e>
### Prostriedky
- [RASA toolbox](https://rasa.com/)
- Slack(<https:%%//%%slack.com>) - 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)
- <https:%%//%%jobothq.slack.com/>
## 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