input_batch.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2017 Google Inc. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // =============================================================================
  15. #ifndef NLP_SAFT_OPENSOURCE_DRAGNN_CORE_INTERFACES_INPUT_BATCH_H_
  16. #define NLP_SAFT_OPENSOURCE_DRAGNN_CORE_INTERFACES_INPUT_BATCH_H_
  17. #include <string>
  18. #include <vector>
  19. #include "syntaxnet/base.h"
  20. namespace syntaxnet {
  21. namespace dragnn {
  22. // An InputBatch object converts strings into a given data type. It is used to
  23. // abstract DRAGNN internal data typing. Each internal DRAGNN data type should
  24. // subclass InputBatch, with a public accessor to the type in question.
  25. class InputBatch {
  26. public:
  27. virtual ~InputBatch() {}
  28. // Set the data to translate to the subclass' data type.
  29. virtual void SetData(const std::vector<string> &data) = 0;
  30. // Translate the underlying data back to a vector of strings, as appropriate.
  31. virtual const std::vector<string> GetSerializedData() const = 0;
  32. };
  33. } // namespace dragnn
  34. } // namespace syntaxnet
  35. #endif // NLP_SAFT_OPENSOURCE_DRAGNN_CORE_INTERFACES_INPUT_BATCH_H_