User:Lidia.Pereira/SDR/SF: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 6: Line 6:
Ukrainian President Viktor Yanukovych sat on a couch, with both sitting either side of him kissing his neck, each with one hand stroking his inner thighs.  
Ukrainian President Viktor Yanukovych sat on a couch, with both sitting either side of him kissing his neck, each with one hand stroking his inner thighs.  
Meanwhile, in the room next door, Prince Harry claimed his brother the Duke of Cambridge is "jealous" of his charity trek to the South Pole. To blow off some steam, he begins to stroke the large bulge he found in Angela Merkel's trousers.
Meanwhile, in the room next door, Prince Harry claimed his brother the Duke of Cambridge is "jealous" of his charity trek to the South Pole. To blow off some steam, he begins to stroke the large bulge he found in Angela Merkel's trousers.
'''First Experiences:'''
<syntaxhighlight lang="python">
import urllib2, feedparser, pickle, nltk
from nltk.corpus import PlaintextCorpusReader
url = "http://feeds.bbci.co.uk/news/rss.xml"
searchwords= ["president","minister","cameron","presidential","european","obama","angela","barroso","pm","chancellor"]
rawFeed = feedparser.parse(url)
def convert (file):
    corpus_root = '/Applications/Talvezseja/PZI/SelfDirectedResearch/RSSfeedsslashfiction'
    texts = PlaintextCorpusReader(corpus_root, '.*')
    feed = texts.words (file)
    return nltk.Text (feed)
superSumario = " "
for i in rawFeed.entries:
    sumario = i["summary"].lower()
    for w in searchwords:
        if w in sumario.strip():
            superSumario = superSumario + sumario
            out = (open("filtertest.txt", "w"))
            pickle.dump(superSumario,out)
           
textrss = open('filtertest.txt').read()
textslash = open('harrypotterslash.txt').read()
both = textrss.strip() + textslash.strip()
upa = (open("concatenatedtest.txt", "w"))
pickle.dump(both,upa)
puff = convert("concatenatedtest.txt")
herpDerp = str(puff.generate(700))
</syntaxhighlight>
Small extract from the result:
David cameron's panties which were becoming damp and got wetter with every slow movement . Tentatively he moved the lacy fabric
aside and his mind drifted and it was Harry she was after " and "Great game Ron " as they passed in the glasgow helicopter crash both
feature . david cameron's whole body shivered with pleasure.

Revision as of 14:49, 2 December 2013

The idea of generating slash fiction from RSS feeds brings into play ideas of promiscuity as deeply connected to power structures.

Small mockup for RSS feed slash fiction:

French Foreign Minister Laurent Fabius muttered quietly that some EU sanctions on Iran could be lifted next month, as part of a nuclear deal with world powers. "What?" Japan PM Shinzo Abe asked, while smoothly caressing his partner's nipples. Ukrainian President Viktor Yanukovych sat on a couch, with both sitting either side of him kissing his neck, each with one hand stroking his inner thighs. Meanwhile, in the room next door, Prince Harry claimed his brother the Duke of Cambridge is "jealous" of his charity trek to the South Pole. To blow off some steam, he begins to stroke the large bulge he found in Angela Merkel's trousers.

First Experiences:

import urllib2, feedparser, pickle, nltk
from nltk.corpus import PlaintextCorpusReader

url = "http://feeds.bbci.co.uk/news/rss.xml"
searchwords= ["president","minister","cameron","presidential","european","obama","angela","barroso","pm","chancellor"]
rawFeed = feedparser.parse(url)

def convert (file):
    corpus_root = '/Applications/Talvezseja/PZI/SelfDirectedResearch/RSSfeedsslashfiction'
    texts = PlaintextCorpusReader(corpus_root, '.*')
    feed = texts.words (file)
    return nltk.Text (feed)

superSumario = " "
for i in rawFeed.entries:
    sumario = i["summary"].lower()
    for w in searchwords:
        if w in sumario.strip():
            superSumario = superSumario + sumario
            out = (open("filtertest.txt", "w"))
            pickle.dump(superSumario,out) 
            
textrss = open('filtertest.txt').read()
textslash = open('harrypotterslash.txt').read()

both = textrss.strip() + textslash.strip()

upa = (open("concatenatedtest.txt", "w"))
pickle.dump(both,upa)

puff = convert("concatenatedtest.txt")
herpDerp = str(puff.generate(700))

Small extract from the result: David cameron's panties which were becoming damp and got wetter with every slow movement . Tentatively he moved the lacy fabric aside and his mind drifted and it was Harry she was after " and "Great game Ron " as they passed in the glasgow helicopter crash both feature . david cameron's whole body shivered with pleasure.