]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
node : add language detection support (#3190)
authorDaniel Bevenius <redacted>
Mon, 2 Jun 2025 12:58:05 +0000 (14:58 +0200)
committerGitHub <redacted>
Mon, 2 Jun 2025 12:58:05 +0000 (14:58 +0200)
commitb5055396706a0a597b6de6d8d9e15be6da5f75a6
treed12f3e1037b2790fd0574d38a2884dd010e21a11
parent7fd6fa809749078aa00edf945e959c898f2bd1af
node : add language detection support (#3190)

This commit add support for language detection in the Whisper Node.js
addon example. It also updates the node addon to return an object
instead of an array as the results.

The motivation for this change is to enable the inclusion of the
detected language in the result, in addition to the transcription
segments.

For example, when using the `detect_language` option, the result will
now be:
```console
{ language: 'en' }
```

And if the `language` option is set to "auto", it will also return:
```console
{
  language: 'en',
  transcription: [
    [
      '00:00:00.000',
      '00:00:07.600',
      ' And so my fellow Americans, ask not what your country can do for you,'
    ],
    [
      '00:00:07.600',
      '00:00:10.600',
      ' ask what you can do for your country.'
    ]
  ]
}
```
examples/addon.node/__test__/whisper.spec.js
examples/addon.node/addon.cpp
examples/addon.node/index.js