Melt the butter in a large, heavy-based saucepan over a low heat. Add the onion and sage and cook, stirring occasionally, for 6–8 minutes until the onion is softened.
Cut the pumpkin or squash into 1 cm (½ inch) pieces, add to the pan and season with salt and pepper. Cook for 12–15 minutes until the pumpkin is very tender.
Meanwhile, cook the pasta in a large saucepan of salted boiling water according to the packet instructions until al dente. Drain.
Toss the pasta in the sauce with the Parmesan and the ricotta. Serve the pasta immediately, scattered with the flaked almonds.