Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What algorithm would you use to code a parrot?

A parrot learns the most commonly uttered words and phrases in its vicinity so it can repeat them at inappropriate moments. So how would you create a software version? Assuming it has access to a microphone and can record sound at will, how would you code it without requiring infinite resources?

The best I can imagine is to divide the stream using silences in the sound, and then use some pattern recognition to encode each one as a list of tokens, storing new ones as you meet them. Hashing the token sequences and counting occurrences in a database, you could build up a picture of the most frequently uttered phrases. But given the huge variety in phrases, how do you prevent this just becoming a huge list? And the sheer number of pairs to match would surely generate lot of false positives from the combinatorial nature of matching.

Would you use a neural net, since that's how a real parrot manages it? Or is there another, cleverer way of matching large-scale patterns in analogue data?

like image 399
Phil H Avatar asked May 11 '10 11:05

Phil H


3 Answers

It's been done, sorta.

Edit: OK, since furbys are out, I'm going to suggest a Gordian-knot type of solution. Wire up a box with a speaker and a microphone, and stick an actual parrot in it. It'll work great for the demo, and then once you have your hands on some venture capital you can start work on your neural net version. Neural nets (as they've been implemented up to this point) are virtually useless, but they should be good enough to get you through the second-round demo, and by that point you'll be too big to fail.

like image 105
MusiGenesis Avatar answered Oct 22 '22 16:10

MusiGenesis


I would probably use Markov chains to emulate that.

If you haven't use markov chains to generate natural random text (or speech) before, check out Fun With Markov Chains

like image 2
Nick Dandoulakis Avatar answered Oct 22 '22 14:10

Nick Dandoulakis


how do you prevent this just becoming a huge list?

I suppose you could maintain one finite list of recent words, and one infinite list of frequent words. If the parrot hears a word it hasn't heard before, it gets stored in its "short term memory". If it hears the word again, it can move the word to the list of frequent words and store it indefinitely. Once in a while, you could purge the list of recent words which contains only words or sounds that the parrot has only heard once.

like image 2
KaptajnKold Avatar answered Oct 22 '22 15:10

KaptajnKold