Word freq should always be digit

An if statement is added to check whether word frequencies are digits.
Added comments to make  function cut() easier to understand.