Exemplo n.º 1
0
    def parse_nblist(self, obs, verbose=False, *args, **kwargs):
        """
        Parses n-best list by parsing each item on the list and then merging
        the results.
        """

        utterance_list = obs['utt_nbl']
        if len(utterance_list) == 0:
            raise DAILRException("Empty utterance N-best list.")

        return self.parse_X(utterance_list, verbose)
Exemplo n.º 2
0
    def get_features(self, obs, fvc, fvcs):
        """
        Generate utterance features for a specific utterance given by utt_idx.

        :param obs: the utterance being processed in multiple formats
        :param fvc: a form, value category tuple describing how the utterance should be abstracted
        :return: a set of features from the utterance
        """

        if isinstance(obs, Utterance):
            return self.get_features_in_utterance(obs, fvc, fvcs)
        elif isinstance(obs, UtteranceNBList):
            return self.get_features_in_nblist(obs, fvc, fvcs)
        elif isinstance(obs, UtteranceConfusionNetwork):
            return self.get_features_in_confnet(obs, fvc, fvcs)
        else:
            raise DAILRException("Unsupported observations.")
Exemplo n.º 3
0
    def get_fvc(self, obs):
        """
        This function returns the form, value, category label tuple for any of the following classses

        - Utterance
        - UttranceNBList
        - UtteranceConfusionNetwork

        :param obs: the utterance being processed in multiple formats
        :return: a list of form, value, and category label tuples found in the input sentence
        """

        if isinstance(obs, Utterance):
            return self.get_fvc_in_utterance(obs)
        elif isinstance(obs, UtteranceNBList):
            return self.get_fvc_in_nblist(obs)
        elif isinstance(obs, UtteranceConfusionNetwork):
            return self.get_fvc_in_confnet(obs)
        else:
            raise DAILRException("Unsupported observations.")