About "Custom Slot Types"

Hello everyone, I have a tough problem. When I define two custom slots (not the same round of conversation,So can’t write together a function), because the entities marked in the training data are all numbers, the recognition of the two entities will be confusing. Details are as follows

class MoneySlot1(Slot):

def feature_dimensionality(self):
    return 2

def as_feature(self):
    r = [0.0] * self.feature_dimensionality()
    if self.value:
        if int(self.value) <= 10000:
            r[0] = 1.0
        else:
            r[1] = 1.0
    return r

class MoneySlot2(Slot):

def feature_dimensionality(self):
    return 2

def as_feature(self):
    r = [0.0] * self.feature_dimensionality()
    if self.value:
        if int(self.value) <= 20000:
            r[0] = 1.0
        else:
            r[1] = 1.0
    return r

I need to compare with 20,000 in a certain round of dialogue, when enter a number, it will mistake the entity to compare with another custom slot type(Compare with 10,000). My story has already been saved correct dialogue. Even if I test it completely according to the story, there will be errors, so how to distinguish between two types of slots that are compared with different values.Any suggestions would be greatly appreciated

I’m just throwing ideas into the mix here. So, bear with me!

The simplest solution will be to create only one MoneySlot with feature dimensionality of, say, 3. And then featurize it as follows:

Value Features
x <= 10000 (1, 0, 0)
10000 < x <= 2000 (0, 1, 0)
20000 < x (0, 0, 1)

Another way would be to capture the context somehow. In any case, a slot should be independent.

Thank you, I tried this idea before, but if you want to compare more values, the effect may not be too good, thank you again for your reply.

I don’t particularly understand the use case. I don’t think increasing the dimensionality will be a problem. Do you have multiple such steps? If so, how many? How is multi-slot approach more scalable than multi-dimension approach?