[2012-Oct-30] Nurble

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :?: :idea: :| (o~o) :geek: :[] :geek2: :][>:=~+:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [2012-Oct-30] Nurble

Re: [2012-October-30] Nurble

by 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

Re: [2012-October-30] Nurble

by 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

by 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))

Re: [2012-October-30] Nurble

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

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

Re: [2012-October-30] Nurble

by 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]
		else:
			result += [" nurble"]
	return "".join(result)[1:]
The guys from the Language Log also discussed this issue.

Re: [2012-October-30] Nurble

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

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

[2012-Oct-30] Nurble

by 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.

http://www.whitehouse.gov/the-press-off ... on-address

Top