Set-theoretic solutions to the Yang–Baxter equation and generalized semi-braces