Skip to content

Module speechlight.base

Contains the base class.

Class BaseSpeech(ABC)

The base interface that Speech inherits from.

Source code in speechlight/base.py
class BaseSpeech(ABC):
	"""The base interface that Speech inherits from."""

	@abstractmethod
	def braille(self, text: str) -> None:
		"""
		Brailles text.

		Args:
			text: The text to be brailled.
		"""

	@abstractmethod
	def output(self, text: str, *, interrupt: bool = False) -> None:
		"""
		Speaks and brailles text.

		Args:
			text: The output text.
			interrupt: True if the speech should be silenced before speaking.
		"""

	@abstractmethod
	def say(self, text: str, *, interrupt: bool = False) -> None:
		"""
		Speaks text.

		Args:
			text: The text to be spoken.
			interrupt: True if the speech should be silenced before speaking.
		"""

	@abstractmethod
	def silence(self) -> None:
		"""Cancels speech and flushes the speech buffer."""

	@abstractmethod
	def speaking(self) -> bool:
		"""
		Determines if text is currently being spoken.

		Returns:
			True if text is currently being spoken, False otherwise.
		"""

Method braille(self, text)

Brailles text.

Parameters:

Name Type Description Default
text str

The text to be brailled.

required
Source code in speechlight/base.py
@abstractmethod
def braille(self, text: str) -> None:
	"""
	Brailles text.

	Args:
		text: The text to be brailled.
	"""

Method output(self, text, *, interrupt=False)

Speaks and brailles text.

Parameters:

Name Type Description Default
text str

The output text.

required
interrupt bool

True if the speech should be silenced before speaking.

False
Source code in speechlight/base.py
@abstractmethod
def output(self, text: str, *, interrupt: bool = False) -> None:
	"""
	Speaks and brailles text.

	Args:
		text: The output text.
		interrupt: True if the speech should be silenced before speaking.
	"""

Method say(self, text, *, interrupt=False)

Speaks text.

Parameters:

Name Type Description Default
text str

The text to be spoken.

required
interrupt bool

True if the speech should be silenced before speaking.

False
Source code in speechlight/base.py
@abstractmethod
def say(self, text: str, *, interrupt: bool = False) -> None:
	"""
	Speaks text.

	Args:
		text: The text to be spoken.
		interrupt: True if the speech should be silenced before speaking.
	"""

Method silence(self)

Cancels speech and flushes the speech buffer.

Source code in speechlight/base.py
@abstractmethod
def silence(self) -> None:
	"""Cancels speech and flushes the speech buffer."""

Method speaking(self)

Determines if text is currently being spoken.

Returns:

Type Description
bool

True if text is currently being spoken, False otherwise.

Source code in speechlight/base.py
@abstractmethod
def speaking(self) -> bool:
	"""
	Determines if text is currently being spoken.

	Returns:
		True if text is currently being spoken, False otherwise.
	"""