If you mean throw away all the Yamaha electronic/electrical parts except the motor, then all you need are the three motor phase wires (wire lead 3 4 5 in your diagram) and the 5 way connector marked encoder at the bottom in your diagram, which are the hall sensor wires and their power supply. It is just a brushless motor like any other, so those wires will connect it to an ebike controller in the same way as the big wire coming out of a hub motor.