Text this: Dual optimization approach in discrete Hopfield neural network