Allennlp: use multifield input in allenlp

Created on 18 Feb 2020  路  5Comments  路  Source: allenai/allennlp

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?

stale

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 master with #3826, but the principle remains the same.

All 5 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ncammarata picture ncammarata  路  4Comments

matt-gardner picture matt-gardner  路  3Comments

tokestermw picture tokestermw  路  4Comments

flyaway1217 picture flyaway1217  路  4Comments

2509dk picture 2509dk  路  3Comments