dariusk / NaNoGenMo-2015

National Novel Generation Month, 2015 edition.
340 stars 21 forks source link

Hodor! #131

Open brentroady opened 8 years ago

brentroady commented 8 years ago

Generate a novel based on one of George RR Martin's A Song of Ice and Fire books, replacing all of the words with the appropriate length "hodor".

This should not be too difficult, but I could not find any examples of this in searching the 2013 or 2014 issues.

Hodor!

dariusk commented 8 years ago

Something similar @hugovk did:

https://github.com/hugovk/meow.py

greg-kennedy commented 8 years ago
#!/bin/sh
perl -pne '$_=join(" ",map{sub a{$_[0]^lc($_[0])^($_[1] x length($_[0]));}if($_=~m/^(\W*)(\w)(\w*?)(\w)?(\w)?(\w)?(\W*)$/){join("",$1,a($2,"h"),a($3,"o"),a($4,"d"),a($5,"o"),a($6,"r"),$7)}else{$_;}}split(/\s/,$_))."\n";' 1342.txt