Building Web-Interfaces for Vector Semantic Models with the WebVectors Toolkit

Andrey Kutuzov, Elizaveta KuzmenkoEacl (software Demonstrations) 2017

TL;DR

This paper introduces WebVectors, an open-source toolkit that simplifies the creation of web interfaces for distributional semantic models (word embeddings). It addresses the challenge of making these powerful NLP tools accessible to researchers and the public, enabling easy querying, visualization, and comparison of word relationships without requiring deep technical expertise.

What Problem Does This Paper Address?

Distributional semantic models, like word2vec and GloVe, represent word meanings as dense vectors derived from their co-occurrence patterns in large text corpora. These models have proven incredibly useful across various NLP tasks, from sentiment analysis to machine translation. However, a significant hurdle exists: the complexity of building user-friendly interfaces to interact with these models. Researchers who train custom models for specific corpora or languages often struggle to share their findings or make them accessible to a broader audience, especially those in fields like digital humanities who may not have extensive programming backgrounds. This paper aims to bridge that gap by providing a straightforward toolkit for deploying these models via web services.

Methods

The core of WebVectors is built upon two key components:

  • Gensim library: This is the workhorse for interacting with the actual distributional semantic models. It handles the heavy lifting of loading models and performing operations like finding semantic associates or calculating similarity scores.
  • Python Flask framework: This framework is used to build the web interface. It can run as a standalone service or be integrated with a standard web server like Apache. Flask communicates with Gensim via sockets, allowing for efficient, simultaneous processing of multiple user queries.

The architecture prioritizes speed by keeping models loaded in memory, thus avoiding the time-consuming loading process for each query. WebVectors also supports advanced features like:

  • Semantic Associate Finding: Identifying words semantically closest to a query word.
  • Exact Semantic Similarity Calculation: Computing cosine similarity between word pairs.
  • Algebraic Operations on Word Vectors: Enabling analogical reasoning (e.g., "king - man + woman = queen").
  • Visualization: Using t-SNE to project high-dimensional word embeddings into a 2D space for visual exploration of semantic relationships.
  • API Access: Providing a simple API for programmatic querying of models.
  • Part-of-Speech (PoS) Tagging: The system can leverage PoS tags (if available in the model) to filter results, allowing for more nuanced queries. It defaults to using Stanford CoreNLP for lemmatization and PoS tagging.

Datasets

The paper highlights the use of several datasets for training the models that are made available through their live demos:

  • English Wikipedia: A dump from September 2016.
  • Gigaword: A large corpus of English news text.
  • British National Corpus (BNC): A widely used corpus of British English.
  • Google News: A pre-trained model from the word2vec project.
  • Norsk aviskorpus: A corpus of Norwegian news texts.
  • Russian National Corpus (RNC): Including versions concatenated with Russian Wikipedia and a collection of Russian web pages.

The authors emphasize that WebVectors is designed to be flexible and can be used with any distributional model trained on any corpus, as long as it can be represented as a list of word vectors.

Key Insights and Ideas

  • Democratizing NLP: The most significant idea is making advanced NLP techniques accessible to a wider audience. By abstracting away the complexities of model deployment and interface development, WebVectors empowers researchers and enthusiasts who might not be core NLP experts.
  • Visualizing the Abstract: The integration of t-SNE for visualizing word relationships is crucial. It transforms abstract vector spaces into understandable visual maps, offering intuitive insights into semantic proximity and analogies.
  • Flexibility and Customization: The toolkit's ability to handle various models, corpora, and even custom labels (beyond PoS tags) makes it highly adaptable for diverse research needs.
  • Comparative Analysis: The feature to display results from multiple models side-by-side is invaluable for researchers comparing different embedding techniques or models trained on varied data.

Key Results

The paper primarily focuses on the functionality and ease of use of the WebVectors toolkit. While specific quantitative performance metrics (like accuracy improvements) are not the main focus, the key results are:

  • Successful Deployment of Live Demos: The authors showcase live web services for English, Norwegian, and Russian models, demonstrating the toolkit's practical application.
  • Ease of Use: The toolkit is designed to be "easy to use" and "works out-of-the-box" for administrators, requiring minimal setup.
  • Simultaneous Query Processing: The architecture allows for fast, simultaneous processing of multiple users, indicating good performance for web-based access.
  • API Functionality: The availability of a simple API allows for programmatic integration, extending its utility beyond interactive web use.

Limitations and Future Work

  • PoS Tagging Dependency: The effectiveness of PoS filtering is contingent on the underlying model being trained on a PoS-tagged corpus. If not, an external tagger is required, adding a dependency.
  • Visualization Limitations: While t-SNE is effective, it's a projection technique, and the paper acknowledges that it's a "2-dimensional version of this map," implying potential information loss from the original high-dimensional space.
  • Future Work: The authors plan to:
  • Add support for more embedding algorithms like GloVe and fastText.
  • Incorporate features for sentence similarity, text classification, and cross-model correlation analysis.
  • Regularly update their live demo models with newer data.

Summary updated

BibTeX
@inproceedings{kutuzov2017building,
  author = {Andrey Kutuzov and Elizaveta Kuzmenko},
  title = {{Building Web-Interfaces for Vector Semantic Models with the WebVectors Toolkit}},
  booktitle = {Eacl (software Demonstrations)},
  year = {2017},
  doi = {10.18653/v1/e17-3025},
}
Figure