See Clark Elliott Dissertation on Computing Emotions. This is an older link.