I wrote a script that attempts to answer recent Yahoo Questions with sentences from the Stanford Encyclopedia of Philosophy. Here are some of the results:
Q: Onion juice in hair what do you think?
A: Often, when there is a reason for you to do something, it is the kind of thing to motivate you to do it.
Q: how are e-ciggs?do you feel better with them than reg.ciggs?
A: The ultimate success of Hollywood blockbusters is dependent upon repeat viewings.
Q: Is there a problem with Yahoo tonight 8:00 EST?
A: Omnipotence is maximal power.
Q: I heard that Daca is qualified for Medicaid?
A: Children are young human beings.
Q: How much friends do you have on facebook?
A: It is common in epistemology to distinguish among three kinds of knowledge.
Q: How do I tell them I don’t want to work for them?
A: Speech acts are a staple of everyday communicative life, but only became a topic of sustained investigation, at least in the English-speaking world, in the middle of the Twentieth Century.
Q: Is Daniel Bryan really stronger and more powerful then Batista?
A: At a broad level, a Creationist is someone who believes in a god who is absolute creator of heaven and earth, out of nothing, by an act of free will.
Q: I’m emotionally numb and i dont know what to do?
A: Human knowledge is expressed in language.
Q: American Ninja movie remake. Will they ever make one?
A: The philosophy of film is a rapidly growing subfield of contemporary philosophy of art.
Q: Would you live in a universe where: skinny jeans, vests, cheap sunglasses, and belly-button tattoos are cool?
A: Time travel has been a staple of science fiction.
Q: Has anyone had bad luck with stuff made in china?
A: Some people appear to be worse off than others partly because they have had bad luck.
Q: Why I cant login to yahoo mail?
A: Fundamental to biology are (1) defining the characteristics of identity, which distinguish individual organisms from those of similar kind, and (2) describing the mechanisms that defend organisms from their predators.
Q: Only can play Minecraft demo?
A: Compatibilism offers a solution to the free will problem.
Q: how do i delete contact from yahoo that isnt in my contact list on my samsung galaxy s4 that keeps popping up?
A: What is space? What is time? Do they exist independently of the things and processes in them?
Q: Top 10 most famous people alive?
A: Delusions are a symptom of psychiatric disorders such as dementia and schizophrenia, and they also characterize delusional disorders.
———————
Here’s the code…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import sys import re import urllib from bs4 import BeautifulSoup questions = [] def soupify(url): html = urllib.urlopen(url) return BeautifulSoup(html.read()) def get_yahoo_questions(page=1): soup = soupify("http://answers.yahoo.com/?tab=recent&filter=lang&page=" + str(page)) return [q.string for q in soup.select('#yan-questions h3')] def get_some_answers(query): base_url = "http://plato.stanford.edu" soup = soupify(base_url + "/search/searcher.py?query=" + urllib.quote_plus(query)) titles = soup.select('.result_title a') if len(titles) > 0: new_url = base_url + titles[0].get('href')[2:] soup = soupify(new_url) answers = soup.select("#aueditable p") temp = " ".join(answers[0].stripped_strings) temp = temp.replace("\n", " ") sentences = temp.split(".") answer = sentences[0] + "." else: answer = "No answer." return answer get_some_answers("How to help someone who has lost someone") for i in range(1, 2): questions += get_yahoo_questions(i) for q in questions: print "Q: " + q print "A: " + get_some_answers(q) print "--------------------" |