In short yes and no. The food you eat does directly affect any taste associated with semen. People who eat more fruits and veggies will have a sweeter taste while people who eat more meat will have a bitter taste. The exception is asparagus. This veggie will result in a very unpleasant taste.

However, to change your taste you must eat a consistent diet. Just eating some pineapple will have little effect on the taste.