Word segmentation based on a dictionary and word frequencies