Javascript for calculating costs per sentence is done