User:Golubjevaite/2proto: Difference between revisions
Golubjevaite (talk | contribs) No edit summary |
Golubjevaite (talk | contribs) |
||
Line 127: | Line 127: | ||
<br>[[File:webfilter1.png|600px|thumb|left|rgbSplit]] | <br>[[File:webfilter1.png|600px|thumb|left|rgbSplit]] | ||
== IRC bot == | == IRC bot == |
Revision as of 14:07, 24 November 2020
MONDAYS
{ V }
>>>> pad / link
>>BashImageGallery > / link
1. Create the POS index from my source text
import nltk
from random import choice
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
source = open("source.txt").read()
tokens = nltk.word_tokenize(source)
pos = nltk.pos_tag(tokens)
index = {}
# index["DT"] = ["THE", ]
# index["NNP"] = ["OF", "PETER", "RABBIT", ...]
for word, tag in pos:
# print (word, "is", tag)
if tag not in index:
index[tag] = []
index[tag].append(word)
2. Use the index to transform text
i = input()
tokens = nltk.word_tokenize(i)
pos = nltk.pos_tag(tokens)
new = []
for word, tag in pos:
# print (word,tag)
# replace word with a random choice from the "hat" of words for the tag
if tag not in index:
# print ("no replacement")
new.append(word)
else:
newword = choice(index[tag])
new.append(newword)
# print ("replace with", newword)
print (' '.join(new))
{ IV }
>>>> pad / link
{ III }
> kiwi on sandbox / link
{ II }
>>>> pad / link
> Jupyter Lab
> /sandbox/~mmurtaugh/botswaller.html
> irc for Python / link
> installing KIWI IRC on the sandbox
sudo ./kiwiirc
> tmux bot
chgrp publicweb /tmp/bot sudo rm /tmp/bot
//////
notes:
> helps with lib pip3 instalations on mac
sudo -H pip3 install something
{ I }
IRC with Michael
@ https://webchat.freenode.net/
> ##xpub channel
> pad / link
> Infobot
git clone https://git.xpub.nl/XPUB/infobot.git
to see the config file
ident > bot name > xpubbot
join_channels > ##xpub
cd info bot cat conf/infobot.config nano conf/infobot.config
run the script
./infobot
> reading and copy-pasting "Infobots and Purl" by Kevin Lenzo
> GIT / python-irc-bots
HACKPACT
This is just the prototyping I did to get familliar with tools.
getUserMedia
> Webcam filters
> Take photo button + clear button
> Canvas
> rgbSplit
> Javascript
> navigator.mediaDevices.getUserMedia() / link
// Get media stream navigator.mediaDevices.getUserMedia({video: true, audio: false})
IRC bot
> Using Michaels reverse bot as a base / link
import irc.bot
> Downloading an img from a url into a folder
import requests # to get image from the web import shutil # to save it locally import re
image blend with PIL
# alpha-blend the images with varying values of alpha alphaBlended1 = Image.blend(image5, image6, alpha=.8) alphaBlended2 = Image.blend(image5, image6, alpha=.2)