dialoguekit.participant.user_preferences¶
General representation of user preferences.
Preferences are given to key-value pairs in terms of real values in the range [-1,1].
Classes¶
Initializes the user's preference model. |
Module Contents¶
- class dialoguekit.participant.user_preferences.UserPreferences(user_id: str)¶
Initializes the user’s preference model.
- Parameters:
user_id – User ID.
- set_preference(key: str, value: str, preference: float) None ¶
Sets (or updates) preference for a given key-value pair.
- Parameters:
key – Key.
value – Value.
preference – Preference, represented as a float in [-1,1].
- Raises:
ValueError – Preference is outside the allowed range.
- get_preferences(key: str) Dict[str, float] | None ¶
Returns the preferences on all keys.
- Parameters:
key – Key.
- Returns:
Preferences as key-preference pairs in a dictionary (or None).
- get_preference(key: str, value: str) float | None ¶
Returns the preference on a key-value pair (or None).
- Parameters:
key – Key.
value – Value.
- Returns:
Preference, as a float in [-1,1] or None.