Word recognition with a hierarchical network