Emotion-Driven Melody Harmonization via Melodic Variation and Functional Representation