Skip to content
/ hylang Public

A stupidly small and fast programming language detection model

License

Notifications You must be signed in to change notification settings

hyparam/hylang

Repository files navigation

HyLang

HyLang

workflow status mit license dependencies coverage

A stupidly small and fast programming language detection model.

Usage

import { detectLanguage } from 'hylang'

const input = `
  function square(x) {
    return x * x
  }
`
console.log(`Predicted language: ${detectLanguage(input)}`)

Accuracy

Hylang eval is sampled from the starcoderdata dataset.

Hylang is 30.4kb packed and achieves 74.5% accuracy.

Implementation

The language detector is implemented as a bag of words model trained on the starcoderdata dataset.

Training is done in python with torch. Model weights are exported to params.json so they can be used in javascript.