WebAssembly bindings for hs-predict.
Exposes three APIs:
classify_smiles(smiles)— SMILES → functional groups + HS heading hintclassify_product(product_json)— full rule-based pipeline (Priorities 1–3)WasmSession— Akinator-style interactive session
Build with:
JavaScript usage
import init from './pkg/hs_predict_wasm.js';
await ;
// 1. SMILES classification
const r = ;
// → { organic_class: "organic", functional_groups: ["CarboxylicAcid"],
// heading_hint: { chapter: 29, heading: 2915, confidence: 0.6, rationale: "..." } }
// 2. Rule-based pipeline
const pred = ;
// → { hs_code: "281511", confidence: 1.0, ... }
// 3. Interactive session
const session = ;
const q1 = session.;
// → { step: "Identifier", prompt: "Please enter a CAS number...", type: "text" }
const r1 = session.;
// → { type: "NeedMoreInfo", next_question: { step: "IsMixture", ... } }