Language detection: switch to go-enry with hint-seeded classifier (#41)
- Add github.com/go-enry/go-enry/v2 dependency to go.mod - guessLang: JSON fast path, then enry strategies (shebangs, XML, modelines, content heuristics), then enry's Linguist-trained Bayesian classifier over regex-hint candidate languages; curated dropdown expanded with typescript, html, css, xml, php, ruby, perl, lua, dockerfile, toml, ini, diff, csharp - enry display names normalized to lowercase stored ids (Dockerfile->dockerfile, Shell->bash, C#->csharp); unsupported languages render unhighlighted - Tests: existing languages, all new languages, magic markers (enry shebang/ DOCTYPE/FROM/diff handling), canonical mapping
This commit is contained in:
@@ -4,12 +4,14 @@ go 1.27.1
|
||||
|
||||
require (
|
||||
github.com/go-chi/chi/v5 v5.3.2
|
||||
github.com/go-enry/go-enry/v2 v2.9.6
|
||||
golang.org/x/crypto v0.39.0
|
||||
modernc.org/sqlite v1.58.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/go-enry/go-oniguruma v1.2.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.24 // indirect
|
||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||
|
||||
Reference in New Issue
Block a user