Beispiel #1
0
 def __init__(self):
     self.dst = RuleDST()
     self.nlu = OneNetLU(
         archive_file='models/onenet.tar.gz',
         cuda_device=-1,
         model_file=
         'https://convlab.blob.core.windows.net/models/onenet.tar.gz')
Beispiel #2
0
class NLU_DST:
    def __init__(self):
        self.dst = RuleDST()
        self.nlu = OneNetLU(
            archive_file='models/onenet.tar.gz',
            cuda_device=-1,
            model_file=
            'https://convlab.blob.core.windows.net/models/onenet.tar.gz')

    def update(self, action, observation):
        # update history
        self.dst.state['history'].append([str(action)])

        # NLU parsing
        input_act = self.nlu.parse(observation,
                                   sum(self.dst.state['history'],
                                       [])) if self.nlu else observation

        # state tracking
        self.dst.update(input_act)

        # update history
        self.dst.state['history'][-1].append(str(observation))
        return self.dst.state

    def reset(self):
        self.dst.init_session()
        self.dst.state['history'].append(['null'])
Beispiel #3
0
from convlab.modules.nlu.multiwoz.onenet.nlu import OneNetLU

input1 = input("Enter your name: ")
#There is a movie at 10:15 on wednesday .
print(input1)

oneNetLU = OneNetLU(
    model_file='https://convlab.blob.core.windows.net/models/onenet.tar.gz')

print(oneNetLU.parse(input1))
Beispiel #4
0
from convlab.modules.nlu.multiwoz.onenet.nlu import OneNetLU
from convlab.modules.nlu.multiwoz.milu.nlu import MILU

oneNetLU = OneNetLU(model_file='https://convlab.blob.core.windows.net/models/onenet.tar.gz')
miLU = MILU(model_file='https://convlab.blob.core.windows.net/models/milu.tar.gz')

print(oneNetLU.parse('I want Indian food at 10:15 on wednesday .'))
print(miLU.parse('There is a train leaving at 10:15 on wednesday .'))