cockney-rhyming-slang
v1.0.0
Published
Given a word, try to make up a cockney rhyming slang about it
Downloads
6
Readme
cockney-rhyming-slang
TODO: um i guess it could listen for toots, find one that has a slang, and reply to it? hmmm.
tool to help you come up with cockney rhyming slang
EXAMPLE
"We're in Barney" means "we're in trouble" because trouble rhymes with Barney Rubble.
var crs = require('cockney-rhyming-slang')
var slang = crs('cat')
=> { word: 'Doff', rhyme: 'hat', phrase: 'Doff your hat' }
console.log('my ' + slang.word + ' knocked over my glass of water for no reason')
console.log('GET IT? cuz cat rhymes with ' + slang.rhyme + ' and ' + slang.phrase)
// auto-replace everything you can in a big text, without explanation:
a_huge_text.split(" ").map(function(word){
var match
if(match = crs(word)){
return match.word
} else {
return word
}
}).join(" ")
API
cockneyRhymingSlang(word)
=> if it can't find any words that rhyme with the given word, returns false
=> if it can't find any of the rhyming words in any of the phrases it knows about, returns false
=> otherwise, it returns an object that looks like:
{
word: 'the_word_to_replace_the_given_word_with',
rhyme: 'the_word_that_rhymed_with_the_given_word',
phrase: 'the_phrase_that_contains_both_the_word_and_rhyme'
}