How usnistgov/sctk works
Project type and purpose
• SCTK is a monolithic, makefile-driven toolkit of CLI programs for scoring automatic speech recognition output (tools include sclite, asclite, sc_stats, rover, plus many Perl/shell utilities).
• It’s not a web or full-stack app: it’s a collection of executable components, libraries, scripts, documentation, and test suites.
File structure
• Top-level directories:
– src/ : source code subdirectories, one per tool or module (sclite, asclite, sc_stats, rover, plus dozens of filter/convert scripts).
– doc/ : documentation and manuals.
– test_suite & src/*/test : test data and self‐tests.
– Makefiles and Dockerfile at root.
• Each src/<tool> folder typically contains:
– C or C++ core modules (.c/.cpp + headers)
– Perl or shell wrapper scripts (.pl, .sh)
– makefile.in or config scripts for building that component.
README for additional insights
• Build process: make config (invokes src/sclite/config.sh), make all (compiles every tool), make check (runs tests), and make install.
• External dependencies (optional): GNU diffutils, CMU‐Cambridge SLM toolkit for language models, SGML parsers (OpenSP).
• Runtime flows: user invokes a CLI tool (e.g., sclite), passing reference and hypothesis files; sc_stats consumes sclite’s SGML output for statistical tests; other scripts convert and filter formats.
• Dockerfile wraps the entire build+runtime environment for cross‐platform usage.
Main components and their relationships
a. Build System
– config.sh & root/Makefile → generates per-component Makefiles → compiles C/C++, installs binaries under bin/
b. CLI Tools Suite
– sclite (C core + optional diff / SLM)
– asclite (C++ core library + wrapper scripts)
– sc_stats (Perl script)
– rover (Perl script)
– dozens of converter/filter scripts (ctmValidator, rttmValidator, align2html, etc.)
c. Core Libraries & Engines
– C/C++ modules under src/sclite and src/asclite/core
– Shared utility code (Levenshtein, graph algorithms, input parsers)
d. Scripts & Wrappers
– Perl and shell scripts in each src/*
– Orchestrate parsing of CTM, STM, RTTM, generation of SGML reports
e. Test Harness
– src/*/test and test_suite/ directories contain unit, regression, and example data tests
– “make check” drives them
f. External Services & Dependencies
– GNU diff (optional alignment method)
– CMU SLM for language‐model‐based word weighting
– SGML parser (nsgmls/OpenSP) for utf_filt
Architectural patterns and design principles
• Modular monorepo: each tool is self-contained under src/<tool>.
• Separation of concerns:
– Build/config layer vs. core engine layer vs. wrapper/orchestration layer vs. test layer
• CLI façade over lower-level libraries (C/C++ or Perl modules).
• Data-pipeline style at runtime: input formats → tool → output formats → next tool.
• Components by layers or domains:
– BUILD LAYER (Makefiles, config.sh, Dockerfile)
– SOURCE LAYER (src folders by tool)
– RUNTIME LAYER (executables under bin/; scripts)
– TEST & DOC LAYER (doc/, test_suite/)
– EXTERNAL DEPENDENCIES (diffutils, SLM, OpenSP)
– Blue rectangles for build components
– Green ovals for executables/scripts
– Yellow rectangles for core libraries