towhee.functional.entity.Entity¶
- class towhee.functional.entity.Entity(**kwargs)[source]¶
Bases:
object
Entity is the basic data type in DataCollection.
Users can create an Entity with free schema, which means there is no limit on attribute name and type.
- Exampels:
>>> from towhee import Entity >>> e = Entity(a=1, b=2) >>> e <Entity dict_keys(['a', 'b'])> >>> e.a 1 >>> e.b 2
Methods
Combine entities.
Create an Entity from a dict.
- __repr__()[source]¶
Define the representation of the Entity.
- Returns (str):
The repr of the entity.
Examples
>>> from towhee import Entity >>> e = Entity(a = 1, b = 2) >>> e <Entity dict_keys(['a', 'b'])>
- combine(*entities)[source]¶
Combine entities.
- Parameters:
entities (Entity) – The entities to be added into self.
Examples
>>> from towhee import Entity >>> e = Entity(a = 1, b = 2) >>> b = Entity(c = 3, d = 4) >>> c = Entity(e = 5, f = 6) >>> e.combine(b, c) >>> str(e) "{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6}"