Build word tree