Skip to content

file_extension

The community/core/file_extension directory provides a way to speak file extensions using Talon. It defines a list of file extensions that can be used in other Talon scripts.

The core logic is in file_extension.py. This file defines a Talon module that declares a list named file_extension. This list is populated with key-value pairs read from file_extensions.csv or, if that file does not exist, default values specified in the _file_extensions_defaults dictionary. The keys in the dictionary are the spoken forms of the file extensions, and the values are the actual file extensions themselves. The @track_csv_list decorator automatically creates a file_extensions.csv to allow users to add or change the file extensions.

The file_extension.talon file defines a simple Talon rule that allows users to speak the file extension. The rule {user.file_extension}: "{file_extension}" states that when a user speaks a phrase from the user.file_extension list, the corresponding file extension will be inserted into the text field. The user.file_extension list is populated by the file_extension.py script.