#ifndef _READ_NLP_SAMPLE_H_
#define _READ_NLP_SAMPLE_H_
#include "myXPU.h"
#include "myHead.h"
#include "myType.h"
#include "commStruct.h"
#include "globalMemPoolFloat.h"
#include "tensor.h"

class ReadNlpSample {
    public:
        ReadNlpSample();
        virtual ~ReadNlpSample();
        void SetDim(int iDim, int oDim);
        MemType GetMemType();

        int GetPADIndex();
        int GetSOSIndex();
        int GetEOSIndex();
        int GetSampleOffset();

        int GetWordIndex(float *iArr);
        char *Index2Word(int indexOfWord);
        
        struct RNNDataInfo *ReadRNNInputData(const char *fileName, int inDim, int seqNum, int batchNum);
        void SaveToRetRNNLabel(float *resultData, char *str, int inDim, int batchNum, int bIndex, int subBatchIndex);        
        void SaveToRetRNNInput(float *resultData, char *str, int inDim, int batchNum, int seqNum, int bIndex, int subBatchIndex, int subSeqIndex);
                                      
        static void RealeaseRNNDDataStruct(struct RNNDataInfo *p);
        void LoadSeqNumSampleAndLablel(const char *sampleName, const char *labelName, int *size, \
                                       int *&dataBuff, int *&seqArr, int *&labelBuff, int *&labelSeqArr);
        int GetDictDim(const char *fineName);
        void PrintBatchSeqInfo(int *dataBuff, int *seqArr, int len);
        int GetMaxSeqFromDataSeqArr(int *dataBuff, int len);
        void SetSOSIndexTensorData(TensorData *mSOSHandle, int sosIndex, int bNum, int dim);
                
    private:
        void SetInputDim(int iDim);
        void SetOutputDim(int oDim);
        void InitPointStatus();
        int mInDim;
        int mOutDim;
        int mPADIndex;
        int mSOSIndex;
        int mEOSIndex;
};

#endif