In a large mixing bowl, mash the tofu with a fork. Now blend the walnuts in a food processor until finely chopped, and add them to the mixing bowl. Blend the mushrooms in the food processor, and add them to the mixing bowl. And lastly add the drained lentils to the mixing bowl. Mix the tofu, walnuts, mushrooms and lentils together and set aside. In a large frying pan, sauté the onion in the olive oil until soft. Then add the tofu, walnut, mushroom and lentil mix to the frying pan, along with the garlic, basil, oregano, cayenne pepper and soy sauce, and cook for a few minutes until the mixture is not too wet. Add the tomato paste and crushed tomatoes and fry for a few minutes longer, until you reach a bolognese consistency. Stir in the sugar and as much salt and pepper as you feel like. In the meantime, cook the spaghetti according to the package instructions. Serve with the bolognese mix on top of the spaghetti, or if you prefer, mixed together.