Using language as data
By: Danielle Boccelli
Tags: Data Science, Data Analytics, Language, Writing, Data

Using language as data

The inherent difficulty of balancing algorithms and design

Language is always situated, i.e., it is uttered in a specific situation at a particular place and time, and by an individual speaker with all the characteristics outlined above. All of these factors can therefore leave an imprint on the utterance. [1]

I have a bit of an obsession with language and communication that is difficult to summarize with a pithy list, but I will try: At any given time, I am reading between 5 and 25 books, and I am learning between 1 and 4 languages, with varying degrees of success; I am growing a note of phrases I find pleasing (it includes gems such as ‘tumble and lollop,’ ‘the nudge of loveliness,’ and ‘tech-savvy pseudo-hippies’); when I rebelled against my chosen field of data science, it wasn’t to backpack across Europe, but to be a freelance writer and editor, and when I returned to said field, in an attempt to tame my unwieldy interests, I began studying natural language processing with a passion that could only be contained by the responsibilities associated with being the working mother of an infant son; I enjoy complex sentences wrangled by thoughtful punctuation and the slant-usage of words; and while I don’t write anymore, not really — just the spare article here and there — I still dabble in what I refer to as “abstract poetry” (but don’t hold your breath waiting for the publication of my e-chapbook — I have chosen instead to have ribbon-bound pages found or forever lost after my death).

So when I (virtually) attended Future Data 2020, a conference about the next generation of data systems, I was more than a little excited about the talk given by Marti Hearst, Professor at the University of California, Berkeley, entitled the Intersection of Language, Algorithms, and Design (available here).

Language, algorithms, and design

Three seemingly disparate words, but each describes a human attempt to organize and ascribe meaning to an infinitely complex world. To consider these topics together, as Professor Hearst does in her talk, is to explore human cognition, with algorithms as logical processes that can be translated into computer code to process inputs and produce outputs, language as a verbal representation used for inter-human communication of facts, falsehoods, fantasies, and figments, and design as a visual alternative to algorithmic and textual representations that can facilitate (or, if wielded improperly, muddle) human understanding.

Professor Hearst’s talk more deeply discusses the three topics than I will here, as I want to focus on these topics with language as the fulcrum — with algorithms used to process language data and design used to convey the results of an analysis.

But before I talk about the use of language as data, I want to talk about the use of quantitative data to serve as a comparison.

Quantitative data

Humans create all data; however, certain characteristics of a research object (herein defined as any item or group of items, abstract or concrete, that is analyzed to better understand a phenomenon) are more easily transformed into data than others. For example, the length, width, height, etc. of an object can be recorded as numerical data by using a standard unit of length, such as the meter, as a basis. While a meter may have different implications for different applications, it is always the same unit of length, regardless of the object being measured, the instrument used for measurement, and the person collecting the data. Of course, all measurements are subject to irreducible errors and measurement biases, which propagate throughout the algorithm used for analysis, but these errors can be acknowledged via statistical methods.

Therefore, when employing a standard basis of measurement such as the meter, the analysis of quantitative data is fairly simple. Sure, depending on the data available, the algorithm may require concepts from linear algebra, calculus, numerical methods, and magic, all of which can get out of control if left unattended. But even so, when the factors under consideration can be easily represented as numerical data with known units, the analyst can focus on choices related to algorithm and design, rather than the standardization of the data.

This aspect of quantitative data, i.e., the basis, may seem somewhat arbitrary, but let us now consider qualitative data.

Qualitative data

If quantitative data are dependent on the use of a number system, then analogously, qualitative data are dependent on the use of a language system. However, there are several reasons why a language system does not facilitate analysis as well as a numerical system.

First, because the number system is based on an ordered relationship among members, certain mathematical properties hold true over the entire system, and these properties hold true for any subset of the system. In comparison, because there is no ordered relationship among the words of a language, a language system does not have simple, universal properties comparable to those of a numerical system. There are certain tendencies to language, such as a verb following a noun in English, but there are many cases that do not exhibit such tendencies. For this reason, language does not easily lend itself to datafication, and so to generate analyzable data from language, many algorithms rely on counts and probabilities.

In addition, although the number system includes an infinite number of numbers, it is possible to imagine the full breadth of this system as a one-dimensional line that extends continuously from the largest possible negative number to the largest possible positive number. With a language system, while certain concepts can be considered to exist along a continuum, each word has a discreet definition, and there are discontinuities that exist, even between synonyms.

Furthermore, while a number has a precise, static meaning, a word offers an imprecise description that is dependent on context and the vocabulary of the speaker. As mentioned, all quantitative data are subject to errors related to the measurement instrument (instrument limitations) and the person collecting the data (personal limitations). However, with language, the parallels for these errors can lead to complications that cannot be easily addressed with statistical methods. For example, a language may lack a word for a certain phenomenon, and such a lack can be considered as an instrument limitation. Moreover, a text is limited by the writer’s vocabulary (a personal limitation), the words of which may be biased by connotation or subject to malapropism.

Clearly, qualitative data is not as straightforward to work with as quantitative data, and therefore, when working with text, some decisions must be made regarding the datafication of the text in relation to the research question.

Words in bags and clouds

Whenever I mention my interest in text to someone who works in or around data, their eyes light up, as the potential of such a rich source of data is undeniable. I think the enthusiasm for such a complex data source is why word clouds and the bag of words algorithm, both of which rely on word counts and thus the disruption of the order of a text, are so popular.

As mentioned, in many cases, text corpora do not allow for straightforward analyses or interpretations, and for this reason, it is imperative to keep in mind the following question asked by Professor Hearst in her talk:

How often do we have the designs we want versus those our algorithms can (easily) make?

In terms of algorithm and design, with regard to text data, a bag of words and word clouds are low-hanging fruit. Such methods, of course, are not without merit, but their indiscriminate application can be criticized as lacking consideration of the purpose they are to serve. Further, it is important to keep in mind that, because language exists with linearity, it is difficult to get to the core of what a text says by disrupting that linearity. For this reason, probabilistic language models, such as n-gram models, are often applied for predictive purposes. However, these methods, too, are limited, as they are highly dependent on the corpora used to create them and they do not inherently consider the flexibility of language.

But my goal here is neither to convince anyone to avoid certain methods nor to suggest methods for improving the algorithmic and design methodologies commonly used for text analysis. Instead, I am suggesting that text data receive due respect, as all data deserve, during the development of text analytics projects. What I say are words and meaning, urgency and emotion, the culmination of each day lived through, each sentence read, and everything I do not or cannot understand — no less. So if I use a word, the next can be described by a Markovian process, yes, but it is not independent of myself, my audience, or my mood.

Lacking a consistent basis of measurement, context is key.

The importance of text analysis

This point is the subject of much debate, but it seems as if human beings primarily differ from other animals in their ability to cooperate, which is greatly aided by their ability to communicate abstract ideas. However, while spoken language is thought to have come into existence around the same time as modern homo sapiens, written language was not invented until long after, and so it can be argued (and it is at some length by Steven Pinker in How the Mind Works) that the human brain did not evolve to read.

But still, humans have a certain fondness for their complex patterns of strange symbols, so much so that there is something inviting and communal about a written message — whether that message is etched in stone, backlit sans serif on a screen, or scrawled quickly on a piece of scrap paper in the quintessential cursive of your late mother whom you miss — and this inexplicable something is so innate and regardless of the conveyed belief that we tend to let our sameness as humans fade into the background, overtaken by perceived differences. So while one can agree or disagree with a message or misunderstand its intended meaning, still language serves as the shared basis on which we agree or disagree, and that is lovely, to be given the opportunity to express oneself and to understand another.

I think that is why people are drawn to word clouds, sort of moth-to-flame-like, even if they do not make it clear what individual words represent, separated from their parent texts as they are. We know that words are ours, the collective invention of mankind and our common heritage, that they serve a purpose and let us into the secret world of another’s mind; so we pay attention, each of us still the child reading each word on each sign once learning how.

There is incredible potential to use text to reach a better understanding of humanity. And while, as a data scientist, I believe in the incredible power of information to solve problems, as a linguaphile, I believe that language, when treated as data, should be handled with great care and consideration. To analyze a text corpus is to try to infer the aggregate thoughts, beliefs, and feelings of human beings, and to do so, the whole cannot be simply represented as the sum of its parts.