Ephraim was the ancestor of the largest tribe in Israel. His name is a metonym for the people of Israel. AT: "I have certainly heard the descendants of Ephraim sorrowing" or "I have certainly heard the people of Israel sorrowing" (See: [[rc://en/ta/man/translate/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. AT: "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/translate/figs-parallelism]] and [[rc://en/ta/man/translate/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/translate/figs-simile]])