Adding Metadata to a Text File

David Such
6 min readFeb 26, 2024

Metadata refers to data that provides information about other data. It serves as a summary or description that can make finding and working with particular instances of data easier. Metadata can be divided into different types based on its content, purpose, or use. The file metadata most people think of is for things like file type, permissions, tags, creation and last edited dates. These are called regular attributes. Photos typically include a set of metadata that provides detailed information about how, when, and where they were taken, along with technical details about the photo itself. However, metadata can be just about anything.

Figure 1. Stylistic Vision of Metadata [Image Credit: DALL-E]

We are writing a Python app which assists with Copy Editing a document. Our app highlights potential spelling and grammar issues and one of the options a user has is to ignore the app suggestion (Figure 2). The problem is we want our program to remember if a user has already ignored an issue in their document. To do this we need to persist the information somehow — cue metadata.

Figure 2. The Reefwing Copy Editor App

Text Files and Metadata

In a traditional sense, text files (.txt) do not support embedded metadata like modern file formats (e.g., PDF, DOCX, or image…

--

--

David Such

Reefwing Software · Embedded Systems Engineer · iOS & AI Development · Robotics · Drones · Arduino · Raspberry Pi · Flight Control