refactoring text2dataset using Underscore.js