コード例 #1
0
def getInformNoMoreVenues(acceptanceList, entities, numFeats):
    '''**Method for global inform action:** returns inform(name=none, other than x and y, with constraints w and z) act   

        :param acceptanceList: (dict) of slots with value:prob mass pairs 
        :param entities: (list) of database entity dicts
        :param numFeats: (int) number of constraints
        :returns: (str) inform() action
    '''

    ans = 'inform(name=none,'

    for ent in entities:
        ans += 'name!="' + ent['name'] + '",'

    feats = {}
    for count, slot in enumerate(acceptanceList):
        if count >= numFeats:
            break

        if slot == 'name':
            continue

        (value, belief) = acceptanceList[slot]
        if value == 'dontcare':
            continue

        feats[slot] = value

    ans += agentutils.convertFeatsToStr(feats) + ')'
    return ans
コード例 #2
0
def getInformAcceptedSlotsAboutEntity(acceptanceList, ent, numFeats):
    '''**Method for global inform action:** returns filled out inform() string
    need to be cleaned (Dongho)
    
    :param acceptanceList: (dict) of slots with value:prob mass pairs 
    :param ent: (dict) slot:value properties for this entity
    :param numFeats: (int) result of domainUtil.db.entity_by_features(acceptedValues)
    :returns: (str) filled out inform() act
    '''

    ans = 'inform('
    feats = {'name': ent['name']}

    for i, slot in enumerate(acceptanceList):
        if i >= numFeats:
            break
        if slot == 'name':
            continue

        (value, belief) = acceptanceList[slot]
        if value == 'dontcare' and slot in ent:
            feats[slot] = ent[slot]
        else:
            if slot in ent:
                feats[slot] = value
            else:
                logger.debug('Slot %s is not found in data for entity %s' %
                             (slot, ent['name']))

    ans += agentutils.convertFeatsToStr(feats) + ')'
    return ans
コード例 #3
0
def getInformNoMoreVenues(acceptanceList, entities, numFeats):
    '''**Method for global inform action:** returns inform(name=none, other than x and y, with constraints w and z) act   

        :param acceptanceList: (dict) of slots with value:prob mass pairs 
        :param entities: (list) of database entity dicts
        :param numFeats: (int) number of constraints
        :returns: (str) inform() action
    '''

    ans = 'inform(name=none,'

    for ent in entities:
        ans += 'name!="' + ent['name'] + '",'

    feats = {}
    for count, slot in enumerate(acceptanceList):
        if count >= numFeats:
            break

        if slot == 'name':
            continue

        (value, belief) = acceptanceList[slot]
        if value == 'dontcare':
            continue

        feats[slot] = value

    ans += agentutils.convertFeatsToStr(feats) + ')'
    return ans
コード例 #4
0
def getInformAcceptedSlotsAboutEntity(acceptanceList, ent, numFeats):
    '''**Method for global inform action:** returns filled out inform() string
    need to be cleaned (Dongho)
    
    :param acceptanceList: (dict) of slots with value:prob mass pairs 
    :param ent: (dict) slot:value properties for this entity
    :param numFeats: (int) result of domainUtil.db.entity_by_features(acceptedValues)
    :returns: (str) filled out inform() act
    '''

    ans = 'inform('
    feats = {'name': ent['name']}

    for i, slot in enumerate(acceptanceList):
        if i >= numFeats:
            break
        if slot == 'name':
            continue

        (value, belief) = acceptanceList[slot]
        if value == 'dontcare' and slot in ent:
            feats[slot] = ent[slot]
        else:
            if slot in ent:
                feats[slot] = value
            else:
                logger.debug('Slot %s is not found in data for entity %s' % (slot, ent['name']))

    ans += agentutils.convertFeatsToStr(feats) + ')'
    return ans
コード例 #5
0
def getInformNoneVenue(acceptedValues, domainUtil):
    '''**Method for global inform action:** creates inform(name=none,...) act

        :param acceptedValues: (dict) of accepted values
        :param domainUtil: (instance) of :class:`DomainUtils.DomainUtils`
        :returns: (str) inform(name=none,...) act
    '''
    feats = findMinimalAcceptedSetForNoEntities(acceptedValues, domainUtil)
    return 'inform(name=none, ' + agentutils.convertFeatsToStr(feats) + ')'
コード例 #6
0
def getInformNoneVenue(acceptedValues, domainUtil):
    '''**Method for global inform action:** creates inform(name=none,...) act

        :param acceptedValues: (dict) of accepted values
        :param domainUtil: (instance) of :class:`DomainUtils.DomainUtils`
        :returns: (str) inform(name=none,...) act
    '''
    feats = findMinimalAcceptedSetForNoEntities(acceptedValues, domainUtil)
    return 'inform(name=none, '+agentutils.convertFeatsToStr(feats)+')'