def forward(self, data):
        '''Processing a batch of data.

        Arguments:
            data (dict): A dict at least contains the following keys:

                {MetricBase.FORWARD_REFERENCE_ALLVOCABS_ARGUMENTS}
                {MetricBase.FORWARD_GEN_ARGUMENTS}

                Here is an example for data:
                    >>> # all_vocab_list = ["<pad>", "<unk>", "<go>", "<eos>", "I", "have",
                    >>> #   "been", "to", "China"]
                    >>> data = {
                    ...     reference_allvocabs_key: [[2,4,3], [2,5,6,3]]
                    ...        gen_key: [[4,5,3], [6,7,8,3]]
                    ... }
        '''
        super().forward(data)
        gen = data[self.gen_key]
        resp = data[self.reference_allvocabs_key]

        if not isinstance(gen, (np.ndarray, list)):
            raise TypeError("Unknown type for gen.")
        if not isinstance(resp, (np.ndarray, list)):
            raise TypeError("Unknown type for resp")

        if len(resp) != len(gen):
            raise ValueError("Batch num is not matched.")

        relevant_data = []
        for gen_sen, resp_sen in zip(gen, resp):
            self.hyps.append(self.dataloader.trim(gen_sen))
            reference = list(self.dataloader.trim(resp_sen[1:]))
            relevant_data.append(reference)
            self.refs.append([reference])
        self._hash_relevant_data(relevant_data)
Processing a batch of data.

        Arguments:
            data (dict): A dict at least contains the following keys:

                {MetricBase.FORWARD_REFERENCE_ALLVOCABS_ARGUMENTS}
                {MetricBase.FORWARD_GEN_ARGUMENTS}

                Here is an example for data:
                    >>> # all_vocab_list = ["<pad>", "<unk>", "<go>", "<eos>", "I", "have",
                    >>> #   "been", "to", "China"]
                    >>> data = {
                    ...     reference_allvocabs_key: [[2,4,3], [2,5,6,3]]
                    ...        gen_key: [[4,5,3], [6,7,8,3]]
                    ... }
        
benchmark/LM/myCoTK/metric/bleu.py