예제 #1
0
    def __init__(self, cfg, commands, asr_hypotheses_in, slu_hypotheses_out,
                 close_event):
        """
        Initialises an SLU object according to the configuration (cfg['SLU']
        is the relevant section), and stores ends of pipes to other processes.

        Arguments:
            cfg: a Config object specifying the configuration to use
            commands: our end of a pipe (multiprocessing.Pipe) for receiving
                commands
            asr_hypotheses_in: our end of a pipe (multiprocessing.Pipe) for
                receiving audio frames (from ASR)
            slu_hypotheses_out: our end of a pipe (multiprocessing.Pipe) for
                sending SLU hypotheses

        """

        multiprocessing.Process.__init__(self)

        # Save the configuration.
        self.cfg = cfg

        # Save the pipe ends.
        self.commands = commands
        self.asr_hypotheses_in = asr_hypotheses_in
        self.slu_hypotheses_out = slu_hypotheses_out
        self.close_event = close_event

        # Load the SLU.
        self.slu = slu_factory(cfg)
예제 #2
0
파일: thub.py 프로젝트: tkraut/alex
    def __init__(self, cfg, tts_preproc_output=False):
        super(TextHub, self).__init__(cfg)

        self.slu = None
        self.dm = None
        self.nlg = None
        self.tts = None

        self.slu = slu_factory(cfg)

        dm_type = get_dm_type(cfg)
        self.dm = dm_factory(dm_type, cfg)
        self.dm.new_dialogue()

        nlg_type = get_nlg_type(cfg)
        self.nlg = nlg_factory(nlg_type, cfg)

        if tts_preproc_output:
            tts_type = get_tts_type(cfg)
            self.tts = tts_factory(tts_type, cfg)
예제 #3
0
파일: thub.py 프로젝트: AoJ/alex
    def __init__(self, cfg, tts_preproc_output=False):
        super(TextHub, self).__init__(cfg)

        self.slu = None
        self.dm = None
        self.nlg = None
        self.tts = None

        self.slu = slu_factory(cfg)

        dm_type = get_dm_type(cfg)
        self.dm = dm_factory(dm_type, cfg)
        self.dm.new_dialogue()

        nlg_type = get_nlg_type(cfg)
        self.nlg = nlg_factory(nlg_type, cfg)

        if tts_preproc_output:
            tts_type = get_tts_type(cfg)
            self.tts = tts_factory(tts_type, cfg)
예제 #4
0
파일: explore.py 프로젝트: thanhlct/alex
def get_slu_dialogue_acts():
    slu = slu_factory(cfg)
    das = {}
    da_types = set()
    slots = set()
    for clser in slu.parsed_classifiers:
        da = slu.parsed_classifiers[clser]
        da_types.add(da.dat)
        da.name = str(da.name)
        slots.add(da.name)
        if da.dat in das:
            if da.name not in das[da.dat]:
                das[da.dat].append(da.name)
        else:
            das[da.dat] = [da.name]
    with open('dialogue_acts_slots.csv', 'w') as f:
        f.write('%s\n'%','.join(da_types))
        f.write('%s\n\n'%','.join(slots))
        for k in das:
            f.write('%s, %s\n'%(k, ', '.join(das[k])))
    pdb.set_trace()