script for extracting topics to csv