allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.75k stars 2.25k forks source link

provide simple examples for each module? #5358

Closed seyeeet closed 3 years ago

seyeeet commented 3 years ago

Hello I found that examples are missing from the provided documents. would it be apoosible to provide a simple examples for the models so we can use them while using the modules? for example, I am interested in learning NER with CRF, but I am not sure how I can do it and I cannot find any exmples in your website that shows me the size/structure of inputs. Thanks

dirkgr commented 3 years ago

It takes a little bit of work, but you can start from the demo, and look at the parts from there. We have a NER demo here: https://demo.allennlp.org/named-entity-recognition/fine-grained-ner

It includes instructions of how to run the model, and how to train it. You can also check out how the components work together. The training config for this model is here: https://github.com/allenai/allennlp-models/blob/main/training_config/tagging/fine-grained-ner.jsonnet

You can see that it uses the "ontonotes_ner" reader, which lives at https://github.com/allenai/allennlp-models/blob/main/allennlp_models/tagging/dataset_readers/ontonotes_ner.py and is documented at https://docs.allennlp.org/models/v2.6.0/models/tagging/dataset_readers/ontonotes_ner/.

For the model, it uses "crf_tagger", which lives at https://github.com/allenai/allennlp-models/blob/main/allennlp_models/tagging/models/crf_tagger.py and is documented at https://docs.allennlp.org/models/v2.6.0/models/tagging/models/crf_tagger/.

Similarly, you can find the code and documentation for the other components.

If that is too detailed, I recommend the AllenNLP guide at https://guide.allennlp.org. It won't talk specifically about NER, but it will introduce many important AllenNLP concepts.