$ show TellinaTool/nl2bash
This repository is a research artifact from the NL2Bash project (LREC 2018), providing a dataset and neural semantic parser for translating natural language descriptions into Bash one-liners. The core contributions include a parallel corpus of ~10k NL–Bash pairs, TensorFlow-based sequence-to-sequence models with attention and copy mechanisms, a custom Bash command parser (bashlint) that normalizes commands using a grammar extracted from man pages, and evaluation tools including tree edit distance and manual judgment pipelines. The codebase is primarily a research prototype with pre-trained model checkpoints, data preprocessing scripts, and evaluation files. While the dataset and parser are valuable, the dependency on TensorFlow 1.x, JavaCC, and Python 2/3 compatibility indicates significant drift. The repository is no longer actively maintained, but the documented methodology and reusable components (e.g., tree edit distance, statistical spell checker) remain relevant for similar NL-to-code tasks.
The LLM identified 3 files worth highlighting for reuse:
Implements the Zhang-Shasha tree edit distance algorithm, a foundational algorithm for comparing rooted ordered trees. This module is fully self-contained, with no dependencies on the rest of the repository, and can be extracted and reused in any project requiring tree similarity measurement (e.g., AST diff, code clone detection). It provides a clean API with functions for tree construction, distance computation, and metric verification.
A statistical spell checker based on the noisy channel model, using a precomputed frequency dictionary (most_common.tar.xz). It corrects words by generating candidate edits (insertion, deletion, substitution, transposition) and scoring them with a simple language model. The module is isolated, requires only standard Python libraries, and can be reused for any text normalization task, especially in domain-specific command-line contexts.
A modified version of the PLY (Python Lex-Yacc) parser generator, adapted for the specific needs of bash command grammar. It provides LALR(1) and SLR parser table generation from a grammar specification. While based on PLY, it includes customizations for token types and error handling. This module is relatively self-contained and could be used as a base for custom parser generators in other projects, though it requires understanding of the modifications.