How can I use multifield input in allennlp? For a nlp task, adding non-text features such as part-of-speech tags or even word length may improve the performance. Does allennlp support this? Could you please provide an example?
Yes, it does! If you make sure that the Token classes that come from your DatasetReader contain POS tags, or whatever other feature you need, you can then use it in the model.
The constituency parser does this with POS tags:
In the case of the constituency parser, it's mostly automatic. The DatasetReader puts the POS tags into the Tokens, and the TextFieldEmbedder does the rest.
Actually, this is a better example: https://github.com/allenai/allennlp/blob/v0.9.0/allennlp/tests/fixtures/encoder_decoder/simple_seq2seq/experiment.json
Note that this changed in master with #3826, but the principle remains the same.
This issue is being closed due to lack of activity. If you think it still needs to be addressed, please comment on this thread 馃憞
* Training config: https://github.com/allenai/allennlp/blob/master/training_config/constituency_parser.jsonnet * Model: https://github.com/allenai/allennlp/blob/master/allennlp/models/constituency_parser.py
Hi, is this example still available? The link's outdated.
The other example also looks really helpful!
Yes, our models have moved to https://github.com/allenai/allennlp-models.
Most helpful comment
Actually, this is a better example: https://github.com/allenai/allennlp/blob/v0.9.0/allennlp/tests/fixtures/encoder_decoder/simple_seq2seq/experiment.json
Note that this changed in
masterwith #3826, but the principle remains the same.