Ephraim was the ancestor of the largest tribe in Israel. His name is a metonym for the people of Israel. Alternate translation: "I have certainly heard the descendants of Ephraim sorrowing" or "I have certainly heard the people of Israel sorrowing" (See: [[rc://en/ta/man/jit/figs-metonymy]])
The speaker repeats the phrase to show either that Yahweh punished him severely or that Ephraim learned what Yahweh wanted to teach him through punishing him. The words "I have been punished" can be translated in active form. Alternate translation: "You punished me. Yes, you punished me severely" or "You punished me, and I learned from you when you punished me" (See: [[rc://en/ta/man/jit/figs-parallelism]] and [[rc://en/ta/man/jit/figs-activepassive]])
When people train calves, they strike them and otherwise cause them to suffer. Yahweh had caused the people of Israel to suffer. (See: [[rc://en/ta/man/jit/figs-simile]])