dialoguekit.core.recsys.item

Represents an item.

Classes

Item

Create recsys item.

Module Contents

class dialoguekit.core.recsys.item.Item(item_id: str, name: str, properties: Dict[str, Any] = None)

Create recsys item.

Creates an item, which minimally has an ID and a canonical name, and can optionally have any number of properties, which are represented as key-value pairs.

Parameters:
  • item_id – Item ID.

  • name – Item name.

  • properties – Dictionary of item properties (key-value pairs). Defaults to None.

property id: str

Return the item id.

property name: str

Return the item name.

get_property(key: str) Any

Returns a given item property.

Parameters:

key – Name of property.

Returns:

Value of property or None.

set_property(key: str, value: Any) None

Sets the value of a given item property.

If the item property exists it will be overwritten.

Parameters:
  • key – Property name.

  • value – Property value.