-
-
Save jwcobb/5786037 to your computer and use it in GitHub Desktop.
/** | |
* Symbols that could be used to replace letters | |
* | |
* @var string | |
*/ | |
protected $_grawlix = '[!@#$%&*-]'; | |
/** | |
* Associative array of replacements to make | |
* | |
* @var array | |
* @lol http://www.youtube.com/watch?v=vbZhpf3sQxQ | |
*/ | |
protected $_replacements = array( | |
'/S' . $this->_grawlix . '{2}T/' => 'SHIT', | |
'/([Ss])' . $this->_grawlix . '{2}t/' => "$1" . 'hit', | |
'/P' . $this->_grawlix . '{2}s/' => 'PISS', | |
'/([Ss])' . $this->_grawlix . '{2}s/' => "$1" . 'iss', | |
'/F' . $this->_grawlix . '{2}K/' => 'FUCK', | |
'/([Ff])' . $this->_grawlix . '{2}k/' => "$1" . 'uck', | |
'/F' . $this->_grawlix . '{3}ING/' => 'FUCK', | |
'/([Ff])' . $this->_grawlix . '{3}ing/' => "$1" . 'ucking', | |
'/C' . $this->_grawlix . '{2}T/' => 'CUNT', | |
'/([Cc])' . $this->_grawlix . '{2}T/' => "$1" . 'unt', | |
'/C' . $this->_grawlix . '{2}K/' => 'COCK', | |
'/([Cc])' . $this->_grawlix . '{2}k/' => "$1" . 'ock', | |
'/P' . $this->_grawlix . '{4}Y/' => 'PUSSY', | |
'/([Pp])' . $this->_grawlix . '{4}y/' => "$1" . 'ussy', | |
); |
My issue with that is that you don't know the capitalization of the final product.
I just landed and don't have net access except for on my phone, but I can send you a little test I did on the flight.
Basically, my idea was that given a list of final band names, you pass a grawlixed string and it returns the one it thinks it is. It would convert all of "the f**_ing champs", "the ***_ing champs" and "the ******* champs" all properly.
It does it via conversion of the grawlixed string to a regex and comparing down the list. It's ruby, but its only like 30 lines of code.
https://gist.github.com/spikegrobstein/5813363
just remembered that I needed to post this. had limited free time on my trip to get on here.
Let me know what you think of this concept... basically I think you need a file that contains known degrawlixed strings since I have seen cases of censored band names being more ambiguous.
There are some limitations in my example which would need to be addressed in a final library. For one, I there would need to be hard-coded known censored names. For instance for "God Below" and "God Forbid" which are frequently grawlixed as "G- Forbid" or "G. Forbid" or "G-- Forbid". Maybe the degrawlix.db
file could be a slightly better format than just lists of final names, but rather have support for regex for special cases or specific hard-coded transformations. I'm just kinda spitballing here.
Also, I like your implementation of a grawlix character better than mine. I was thinking about the best way to do that on the plane, but I would have used yours had I had access on the plane, but was just trying to get it working.
This seems to work pretty well