User:AvitalB/thesis prototyping: Difference between revisions
(→05/10) |
|||
Line 73: | Line 73: | ||
[https://whoosh.readthedocs.io/en/latest/intro.html '''Whooshe''']- a preexisting library we can use to make the bot | [https://whoosh.readthedocs.io/en/latest/intro.html '''Whooshe''']- a preexisting library we can use to make the bot | ||
'''NLTK'''- a library for handling texts | |||
==Python== | ==Python== |
Revision as of 11:37, 5 October 2020
Infobot
Created by Kevin Lenzo
Bots can bridge between different systems (like we did in implicancies)
what's interesting about IRC is that it's like this social interface that then has the ability to have different kinds of "non-human" programs (bots) running alongside the users
it's very different from say a traditional server setup (like CGI or PHP, or a framework)
IRC doesn’t have a log- you can’t see what was written before you joined the chat, but it is more private
Config the infobot
ls conf
The main configuration file in infobot.config inside the conf folder
nano conf/infobot.config
1. In the top of the file you can set a name for the bot (should probably be unique) Rooms in IRC are channels
2. In the file you can configure the rooms this bot will join at join_channles line
3. Setting the server- there are many IRC servers webchat.freenode.net is a "HTTP gateway" or portal that provides an HTML interface to the IRC http://irc.freenode.net:6667/ this should be the address of the sever using an irc client. probably it doesn't work because nowadays most people don't have IRC clients installed, or their systems aren't setup to handle the links. but the design of the URL was such to "bridge" these different systems, so it was supposed to work. many people still use IRC and IRC clients are alive and well. the pizza (poi chat) webchat is another software that gives a "portal" or "gateway" view of an XMPP channel in a web page
4. After we set the channel we need to run the program. In the folder we run the command ./infobot
5. When its running we see the log in terminal
DNS- domain name system
A mix between teaching the bot in the context of a chatroom, and then the fact that the bot builds a database that you could share with other.
so I used a command called update_db to update it with the techdict.facts file here: [1]
infobot says: I heard a computer was Technically, this is anything that inputs data, processes it in some way, and outputs it
what's novel about the infobot is that it's actually a read/write interface to a database that taps into chatrooms
or many of it's features now resemble what Google does with a search
or what Alexa, Siri, etc aims to do
the infobot is interesting because it's relatively simple and transparent
the database are simply files that it creates
if we quit the bot, you can see that a number of files are created
05/10
Notebook
With this tool we can combine markdown with code (python)
notebook server- can be interactive to one user and not a shared interface, but we can copy generated html pages for example.
Making a bot
Server-side programming-
CGI(common gateway interface) script- simplest translation of a shell script. python script translated to html pages. ex: if I write a script in python, add it to a server and trigger it by a url. This is used a lot by forms, when you submit a form it runs a script. Now with AJAX (javascript) it used to ways to send and receive stuff to and from server while inside a page rather than reloading.
IRC- Its like a parallel universe. It's a protocol which used IRC server and the you have clients (firefox, chrome, Kiwi) written in different languages. The IRC universe used just plain text (not html).
HTTP is not very sociable- it take a request and get one response (page) and then hangup.
Whooshe- a preexisting library we can use to make the bot
NLTK- a library for handling texts
Python
urlopen- like curl
parse- wrapper
libraries- this is what you work with in python
html5lib- a third party library you need to install
the ElementTree- you can compare it to the inspect mode in html