Learning In-context Learning for Named Entity Recognition