[2012-Oct-30] Nurble

Blame Quintushalls for this.

Moderators: NeatNit, Kimra

[2012-Oct-30] Nurble

Postby t-dawg » Tue Oct 30, 2012 6:46 pm

I love this idea!! But, I don't think that program is very thorough/accurate, unfortunately. It looks like it has problems with plurals, possessive nouns, and pronouns? I imagine that he meant to at LEAST include the plurals...

I was shocked at how few nouns there were in the State of the Union so I went to compare, and a lot of nouns are nurbled. For example, in the first few paragraphs in the comic, it leaves out "achievements" and "America's" and "Forces" and "institutions" and "expectations" ... etc.

Here's the link to the State of the Union text.

User avatar
Posts: 2
Joined: Tue Oct 30, 2012 5:57 pm

Re: [2012-October-30] Nurble

Postby pandawaffle » Tue Oct 30, 2012 7:26 pm

I think Zach should spell out his name in his chesthair when does pictures like that.

Re: [2012-October-30] Nurble

Postby L3viathan » Tue Oct 30, 2012 9:15 pm

I wrote a 15-line python script which does the job using the NTLK.
Code: Select all
import ntlk
def nurbleize(sentence):
   allowed = ["NNP","NNS","NN"]
   punct = [".",","]
   result = []
   tk = nltk.word_tokenize(sentence)
   tg = tltk.pos_tag(tk)
   for (w,p) in tg:
      if p in allowed:
         result += [" "+w.upper()]
      elif p in punct:
         result += [w]
         result += [" nurble"]
   return "".join(result)[1:]

The guys from the Language Log also discussed this issue.

Re: [2012-October-30] Nurble

Postby sotic » Wed Oct 31, 2012 3:27 am

All I got out of this comic was a reminder of how awful PHP is.
Wind catches lily / Scatt'ring petals to the wind: / Segmentation fault
User avatar
[Insert Here]
Posts: 325
Joined: Thu Aug 04, 2011 5:55 am
Location: Wisconsin

Re: [2012-October-30] Nurble

Postby Alfe » Wed Oct 31, 2012 2:12 pm

sotic wrote:All I got out of this comic was a reminder of how awful PHP is.

Right so. Come on — PHP?? Get decent. Use Python:

Code: Select all
#!/usr/bin/env python

import re, sys

with open('part-of-speech.txt') as posFile:
  wordKind = dict(line.strip().split('\t') for line in posFile)

def nurble(word):
  return word if 'N' in wordKind.get(word, '') else 'nurble'

for line in sys.stdin:
  sys.stdout.write(re.sub(r'[a-zA-Z]+', lambda x: nurble(x.group()), line))
Posts: 1
Joined: Wed Oct 31, 2012 11:45 am

Re: [2012-October-30] Nurble

Postby guest1 » Thu Nov 01, 2012 6:11 am

sotic wrote:All I got out of this comic was a reminder of how awful PHP is.

PHP is a pretty decent templating engine, which is what it was designed for.

Re: [2012-October-30] Nurble

Postby Ripounet » Fri Nov 02, 2012 7:27 pm

Server-side nurbling is quite limited because it nurbles only a set of texts on 1 server.
I suggest as general-purpose web nurbling techniques :
  • either use the server as a proxy : take any URL as a GET parameter, let the server fetch the page, nurble it, and render it
  • or create a browser plugin that nurbles everything before rendering

Return to Latest Comic Discussion 3: Revenge of the Son of Latest Comic Discussion 2

Who is online

Users browsing this forum: No registered users and 97 guests