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?
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.
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
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.
maybe - do not attempt to store each clip seperately, instead, do a similarity match to the target number you wish to learn say maybe a dozen... so in comes a sound - you match to the closest one of the dozen you are tracking - and when you find a sufficient pattern match to one of those, you average this new sound into the stored version - giving a new version...
if the incoming sound does not match anything stored - throw it away.
the bootstrap would be the toughest part - distinguishing the initial number of target phrases...
anyhow - off the top of my head. hth
精彩评论