Event Streak Trigger

event_streak

class EventStreakTrigger(streak_timeout_sec: float, event_count: int, counting_event_trigger: gramhopper.triggers.basic_triggers.BaseTrigger, resetting_event_trigger: Optional[gramhopper.triggers.basic_triggers.BaseTrigger] = None)

Event-streak trigger. This is used to trigger a rule in a case of a streak of events, for example when a certain phrase is written a few times in a row.

This trigger gets a defined trigger as a “counting” event and optionally another one as a “resetting” event (to stop counting). It also gets the count of events to be considered a streak, and the timeout of the streak (the allowed time period between the first event and the last event in the streak.

__init__(streak_timeout_sec: float, event_count: int, counting_event_trigger: gramhopper.triggers.basic_triggers.BaseTrigger, resetting_event_trigger: Optional[gramhopper.triggers.basic_triggers.BaseTrigger] = None)

Constructs the trigger.

Parameters:
  • streak_timeout_sec – The allowed time period between the first event and the last event in the streak
  • event_count – The count of events to be considered a streak
  • counting_event_trigger – A trigger to identify an event that counts towards the streak
  • resetting_event_trigger – A trigger to identify an event that resets the streak