Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Markovian Opinions
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tom O'Brien
February 04, 2014
Programming
48
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Markovian Opinions
Probabilistic generation of comment-section-worthy opinions
Tom O'Brien
February 04, 2014
Other Decks in Programming
See All in Programming
Event is what happens
moro
2
780
SREの越境 / SRE Collaboration
y0hgi
2
310
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
270
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
ActionController meets Protocol Buffers
sorah
0
520
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
JIS keyboard support in Omarchy
lef237
0
110
Jetpack Compose Mechanisms
skydoves
3
820
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
Mind Mapping
helmedeiros
1
400
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
300
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Navigating Weather and Climate Data
rabernat
0
560
The Cost Of JavaScript in 2023
addyosmani
55
10k
Why Our Code Smells
bkeepers
PRO
340
58k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
520
Done Done
chrislema
187
17k
A Soul's Torment
seathinner
8
3.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Transcript
Markovian Opinions Tom O’Brien
Markov Chains
Memoryless State Machines Fixed probability of moving from one state
to the next. The evolution of the system depends only on its current state.
Basically Everywhere Web Pages (PageRank) Genetics Boardgames Text Prediction and
Generation
None
Generating Text
n-grams A sequence of n words in a sentence. (defn
n-grams [n s] (partition n 1 (clojure.string/split s #"\s+"))) ! (n-grams 2 "The quick brown fox") => (("The" "quick") ("quick" "brown") ("brown" "fox"))
(defn next-states [unigrams bigrams term] (->> (for [[[_ next] y]
(bigram-term-frequencies bigrams term) :when y] [next (/ y (unigram-term-frequencies unigrams term))]) (sort-by last)))
(defn choose-at [p [[term q] & rest]] (when q (if
(and q (< p q)) term (recur (- p q) rest)))) ! (defn next-term [unigrams bigrams term] (choose-at (rand) (next-states unigrams bigrams term))) ! (defn markov-text [unigrams bigrams initial-term] (iterate (partial next-term unigrams bigrams) initial-term))
Twitter Scraping
Harvesting Links Building a web crawler: too ambitious. (defn dailym-dot-ai-url?
[url] (if url (= "dailym.ai" (.getHost (URI. url))) false)) ! ;; timeline is lazy, built with twitter-api (defn article-urls [screen-name] (filter dailym-dot-ai-url? (map expanded-url (remove retweet? (timeline screen-name)))))
Scraping with Hickory (require '[hickory.select :as s]) ! (defn url->hickory-response
[url & {:as params}] (as-hickory (parse (:body (http/get url params))))) ! (defn article-url->comments [article-url] (map (comp parse-text :content) (s/select (s/child (s/class :comment-text)) (url->hickory-response article-url))))
Generating Tweets
Opinionate! http://twitter.com/mailonline_bot (loop [] (let [message (make-tweet (rand-nth screen-names))] (println
(str "Tweeting: " message)) (update-status! mailonline-oauth-creds message) (Thread/sleep 30000) (recur)))
Thanks! Twitter: @_tobrien / @mailonline_bot GitHub: t-ob/markov