Created
June 14, 2013 23:21
-
-
Save jwcobb/5786037 to your computer and use it in GitHub Desktop.
Attempting to convert [MonkeyFighter](https://github.com/TeamOneTickets/Monkey-Fighter) to dynamically handle all grawlix replacements in order to un-censor words.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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', | |
); |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.