K eyword S cape: Visual Document Exploration using Contextualized Keyword Embeddings (2022)

Abstract: Although contextualized word embeddings have led to great improvements in automatic language understanding, their potential for practical applications in document exploration and visualization has been little explored. Common visualization techniques used for, e.g., model analysis usually provide simple scatter plots of token-level embeddings that do not provide insight into their contextual use. In this work, we propose KeywordScape, a visual exploration tool that allows to overview, summarize, and explore the semantic content of documents based on their keywords. While existing keyword-based exploration tools assume that keywords have static meanings, our tool represents keywords in terms of their contextualized embeddings. Our application visualizes these embeddings in a semantic landscape that represents keywords as islands on a spherical map. This keeps keywords with similar context close to each other, allowing for a more precise search and comparison of documents.

## introduction recent work in natural language processing (nlp) has brought great advances in the contextual modeling of word meanings in texts @xcite @xcite . when it comes to visualizing the meaning contained in a collection of documents, keywords still play an important role @xcite @xcite . keyword-based methods have a number of advantages because they are intuitive and easy to visualize, for example, in a bar chart showing the frequency of a keyword over different years in a document collection. however, one of the major limitations in existing approaches is that it assumes that a keyword has a static meaning across different texts and domains. this assumption is highly unrealistic @xcite . a term like training means something quite different in the context of machine learning than in psychology. there are tools for visualizing document collections at different levels of granularity. to get an overview of a set of texts, it is often beneficial to use visualizations that group texts on a high level according to their overarching meaning, also called topic. this is done by @xcite ; @xcite ; @xcite ; @xcite , e.g. to distinguish scientific texts on the topic of machine learning visually from texts from the field of psychology. to find documents that match a semantic query, e.g., a list of related keywords such as learning, curriculum, pre-training, low-level document exploration is required. here, users must evaluate the meaning of specific paragraphs, sentences, and keywords in a given context. current visual document exploration systems do not use contextualized neural representations and rely on topic models or frequency-based keyword clustering techniques @xcite @xcite @xcite . these allow highlevel comparison of documents but are unable to distinguish content based on low-level semantic meaning. in this work, we propose keywordscape, a tool that visualizes keywords in their semantic contexts as islands on a map to support meaning-driven document exploration. this makes it possible to explore the potential of contextualized word embeddings for visual document exploration by exploiting their strengths for disambiguation. in the following, we clarify how our work fits into the current research context. we demonstrate the applicability of contextualized keywords in a visualization system architecture, explain the user interactions it supports, and show its application in use cases that solve real-world problems. the main contributions of this paper include: ## related work visualization of text has been explored extensively in the vis community. this section refers to related work in the sub-field of visual document exploration, reviewing relevant methods and ideas for visualizing document collections. furthermore, we show how recent developments in the field of nlp, and in particular neural word embeddings, feed into these solutions. ## keywordscape system we propose a system architecture shown in figure 1 consisting of a nlp pipeline and a visualization pipeline. the first parses the documents into a map of contextualized representations based on bert @xcite and umap @xcite . the second is responsible for the visualization and is based on the d3 library @xcite , the html canvas element for rendering, and svg for additional data manipulation and information display. for a video demonstration of the system, visit https://youtu.be/6jaf7hipztk . ## user interaction keywordscape offers a number of interaction techniques, which are illustrated in figure 3 and explained below: projections. to create a projection a search query in form of a set of keywords is translated into a selection of embedding points. from the resulting set of points, a contour map is interpolated based on the density of the selected points in each region of the map. the contour map is then projected onto the contextualized keyword map. this makes it possible to visualize a user's search similar to rain showers on a weather map, as shown in figure 3 . filtering. filtering is used in combination with the projection function. the user can define queries to the system either via the text-based search or via predefined query selectors such as timestamps, keywords, authors, star ratings, or tags. the query is then translated into a projection condition and a visual expression of the query is projected onto the map so that the user can visually understand where within the semantic landscape of the document collection the query applies. for example, if the user selects a particular author as a query selector, all documents that the author has contributed to the corpus are filtered out, their keywords extracted and projected onto the keywordscape. with the help of this view, the user can easily see which semantic regions the author mainly focuses on. zooming. a filtered semantic map generates regions of interest that can be examined in detail using the zoom function. zooming in combination with adaptive region labeling makes it possible to examine the keywords of a context island with increasing granularity. brushing. brushing highlights a specific area of interest to find the documents with keywords in that area. visual islands characterized by a collection of keywords occurring in the same context are made visually tangible in this way and the documents containing these contexts are listed. an application of the brushing feature is shown in figure 3 . ranking. ranking allows the corpus to be adapted to personal interests. users award stars in a range from 0-5, making it possible to quickly filter out personally relevant documents, e.g. as support when writing a survey paper. tagging. assigning tags to the documents allows quick access to document sets. this can be combined with the projection function to visualize the map coverage of several selected documents. in addition, tagging and projection are used to visually compare documents by dividing them into different tag groups and projecting the similarities as well as the differences of the two tag groups against each other, as shown in figure 5 . hovering. the hovering interaction is applied to the document map and the paragraph map. the tool displays the corresponding document in the search bar when the mouse pointer hovers over its representation in the map. when clicked, a detailed document preview is displayed, containing meta-information such as title, author, date of publication as well as the most important keywords of the document and its abstract. the interaction techniques are evaluated in a user study. for a detailed description, please refer to the appendix a. ## use cases we apply the keywordscape tool to two different document data sets. to show the applicability of the tool for everyday use, e.g., to get an overview of the content of news articles, we visualize the reliable sources of the recovery corpus of @xcite in section 5.1. these include newspaper articles from trusted news outlets. to illustrate the tool's ability to decompose the semantic occurrence of keywords into different contexts, we visualize the food.com data set from @xcite , which is used to generate personalized recipes from user preferences in section 5.2. ## conclusion in this paper, we introduced keywordscape, a visualization tool that implements a novel method for visualizing contextualized keyword embeddings as visual islands. the tool takes advantage of the benefits that contextualized word embeddings bring in contrast to static word embeddings by applying them in a visually searchable contextualized keyword map -a keywordscape. we implemented a system architecture based on a bert transformer language model and its ability to represent word meanings. we explained the interaction capabilities that the visualization application provides to the user and illustrated its usability in real-world use cases. our results show that viewing the meaning of keywords in context leads to new and interesting insights into the document collection, as exemplified by newspapers or cooking recipes.