Text this: Efficient approach for optimizing couplers in traveling-wave accelerating and deflecting structures