Turning Character Yaw Rotation into a 0-1.0 alpha for a Lerp

I need some help transforming the yaw rotation on my character collision into a 0-1.0 float (for a lerp). The typical way you do this sort of thing doesn’t quite give me what I need. I attached an image with a visual as to what I am getting vs. what I need. I suspect it is an easy fix but not sure what it is. Basically the current method sharply turns the alpha off because 1 goes right back into 0. I need 0 and 1 to be attached to 0 and 180 of the 360 degree rotation.

Calculate dot product between UP vector of your object and [0,0,1] vector. That gives you cosine of angle. You may need use ABS (i am not sure of that).
Also Cosine is not linear function, so you may need to calculate arccosinus (get degrees) then fit that into 0…1 range.