sentence_input_batch.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef NLP_SAFT_OPENSOURCE_DRAGNN_IO_SENTENCE_INPUT_BATCH_H_
  2. #define NLP_SAFT_OPENSOURCE_DRAGNN_IO_SENTENCE_INPUT_BATCH_H_
  3. #include <string>
  4. #include <vector>
  5. #include "dragnn/core/interfaces/input_batch.h"
  6. #include "dragnn/io/syntaxnet_sentence.h"
  7. #include "syntaxnet/base.h"
  8. namespace syntaxnet {
  9. namespace dragnn {
  10. // Data accessor backed by a syntaxnet::Sentence object.
  11. class SentenceInputBatch : public InputBatch {
  12. public:
  13. SentenceInputBatch() {}
  14. // Translates from a vector of stringified Sentence protos.
  15. void SetData(
  16. const std::vector<string> &stringified_sentence_protos) override;
  17. // Translates to a vector of stringified Sentence protos.
  18. const std::vector<string> GetSerializedData() const override;
  19. // Get the underlying Sentences.
  20. std::vector<SyntaxNetSentence> *data() { return &data_; }
  21. private:
  22. // The backing Sentence protos.
  23. std::vector<SyntaxNetSentence> data_;
  24. };
  25. } // namespace dragnn
  26. } // namespace syntaxnet
  27. #endif // NLP_SAFT_OPENSOURCE_DRAGNN_IO_SENTENCE_INPUT_BATCH_H_