optimized way of generating factorie vectors