Solution 1:

They are differentiated by spelling:

  • Yay [ jɛi ] (as opposed to, say, boo) is for joy and exultation;
  • Yeah [ jæ ] (synonym of yes, opposite of nah) is for ordinary assent; and
  • Yea [ jɛi ] (opposite of nay) is for formal assent during a vote.

It's just that many people type yea (or even just ya) when they mean yeah.

Outside of the U.S., yeh [ jɛ ] is also common.