StORMeD

16 May 2015 Library
Archived

Heterogeneous abstract syntax trees for Stack Overflow: a Scala development kit, a ready-made JSON dataset, and an island-parsing web service

Overview

The contents of a Stack Overflow discussion are inherently heterogeneous: natural language, source code, stack traces, and configuration files in XML or JSON, all intertwined in the same post. StORMeD — Stack Overflow Ready Made Data — models that mixture with a full-fledged heterogeneous island grammar, turning every discussion tagged with java into a Heterogeneous Abstract Syntax Tree (H-AST) that can be navigated across all of those languages at once, complemented with basic meta-information such as term frequency for natural language analyses.

StORMeD was released in three parts: the ready-made dataset, the development kit that reads and visits it, and a web service that exposes the island parser itself.

The Dataset

The dataset provides one H-AST per discussion in JSON format, so that the heterogeneous structure of a post — its Java fragments, JSON and XML snippets, and stack traces — is available without building an island parser or running the analysis infrastructure needed to produce one. It is built from the Stack Exchange Data Dump published on the Internet Archive, and the last published version covers discussions up to June 2017.

The Development Kit

The DevKit is a Scala library exposing the same H-AST model used to generate the dataset, so that discussions can be analyzed directly from the JSON files rather than loaded into a database first. Deserializing an artifact takes three lines, and the H-AST is then visited programmatically: the kit ships collecting visitors for identifiers, types, method invocations and declarators, imports, variable declarators, classes, interfaces, and enums, each of which accepts a filtering function (Visitable => Boolean) to skip parts of the tree — excluding identifiers declared inside method bodies, for instance. Custom collectors for node types without a built-in visitor are written by extending NodeAccumulatorVisitor with an extractor for the nodes of interest.

The kit was published for Scala 2.12 as ch.usi.inf.reveal.parsing:stormed-devkit and consumed from Maven or sbt through StORMeD’s own artifact repository. That repository no longer answers, so the DevKit is in practice only usable from a copy already in hand.

The Island Parsing Service

The island parsing technology behind the dataset is also exposed as a REST service, for callers who need to parse arbitrary text rather than the pre-parsed discussions. It offers two methods, both taking a JSON POST body carrying the text and a service key:

  • /parse returns the list of HASTNode objects produced by parsing the submitted text — the same H-AST nodes found in the dataset.
  • /tagger returns the submitted text with its code elements wrapped in <code> tags, either from plain text or from an already partially tagged input, in which case existing tags are preserved.

Both answer with a status of OK or ERROR: an error carries a message, and a success carries the parsing result along with quotaRemaining. Access is keyed: registration with a valid email address yields one personal key, good for a daily quota of 1000 requests that resets at midnight, with a recovery page for keys that get lost. The keying exists to identify callers and prevent abuse, not to charge for the service — it is free.

Technologies

Publications

16 May 2015 Paper
3330 words · 17 minutes

StORMeD: Stack Overflow Ready Made Data

Stack Overflow is the de facto Question and Answer (Q&A) website for developers, and it has been used in many approaches by software engineering researchers to mine useful data. However, the contents of a Stack Overflow discussion are inherently heterogeneous, mixing natural language, source code, stack traces and configuration files in XML or JSON format. We constructed a full island grammar capable of modeling the set of 700,000 Stack Overflow discussions talking about Java, building a heterogeneous abstract syntax tree (H-AST) of each post (question, answer or comment) in a discussion. The resulting dataset models every Stack Overflow discussion, providing a full H-AST for each type of structured fragment (i.e., JSON, XML, Java, Stack traces), and complementing this information with a set of basic meta-information like term frequency to enable natural language analyses. Our dataset allows the end-user to perform combined analyses of the Stack Overflow by visiting the H-AST of a discussion.

16 May 2015 Paper
4355 words · 22 minutes

Summarizing Complex Development Artifacts by Mining Heterogeneous Data

Summarization is hailed as a promising approach to reduce the amount of information that must be taken in by the person who wants to understand development artifacts, such as pieces of code, bug reports, emails, etc. However, existing approaches treat artifacts as pure textual entities, disregarding the heterogeneous and partially structured nature of most artifacts, which contain intertwined pieces of distinct type, such as source code, diffs, stack traces, human language, etc. We present a novel approach to augment existing summarization techniques (such as LexRank) to deal with the heterogeneous and multidimensional nature of complex artifacts. Our preliminary results on heterogeneous artifacts suggest our approach outperforms the current text-based approaches.

Summarizing Complex Development Artifacts by Mining Heterogeneous Data

Projects

1 April 2014 Project Postdoctoral Researcher

ESSENTIALS: People-centric Essentials for Software Evolution

Shifting the focus of software evolution research to the people-centric 'evolutionary essentials' that stakeholders need in their current working context.

ESSENTIALS: People-centric Essentials for Software Evolution