sherpa-onnx C API 1.0
Public C API and C++ wrapper for sherpa-onnx
Loading...
Searching...
No Matches
sherpa_onnx::cxx::SpeakerEmbeddingManager Class Reference

RAII wrapper for speaker embedding management. More...

#include <cxx-api.h>

Inheritance diagram for sherpa_onnx::cxx::SpeakerEmbeddingManager:
Collaboration diagram for sherpa_onnx::cxx::SpeakerEmbeddingManager:

Public Member Functions

void Destroy (const SherpaOnnxSpeakerEmbeddingManager *p) const
 Destroy the wrapped C handle.
bool Add (const std::string &name, const float *v) const
 Add one enrollment embedding for a speaker.
bool AddList (const std::string &name, const float **v) const
 Add multiple enrollment embeddings for one speaker.
bool AddListFlattened (const std::string &name, const float *v, int32_t n) const
 Add multiple enrollment embeddings packed in one flat array.
bool Remove (const std::string &name) const
 Remove a speaker from the manager.
std::string Search (const float *v, float threshold) const
 Search for the best matching enrolled speaker.
std::vector< SpeakerMatch > GetBestMatches (const float *v, float threshold, int32_t n) const
 Return up to n best matches above a similarity threshold.
bool Verify (const std::string &name, const float *v, float threshold) const
 Verify whether a query embedding matches a named speaker.
bool Contains (const std::string &name) const
 Check whether a speaker is enrolled.
int32_t NumSpeakers () const
 Return the number of enrolled speakers.
int32_t Dim () const
 Return the embedding dimension.
std::vector< std::string > GetAllSpeakers () const
 Return all enrolled speaker names.
std::vector< float > GetEmbedding (const std::string &name) const
 Return a copy of the embedding of a speaker. Empty if missing.
Public Member Functions inherited from sherpa_onnx::cxx::MoveOnly< SpeakerEmbeddingManager, SherpaOnnxSpeakerEmbeddingManager >
 MoveOnly ()=default
 Construct an empty wrapper.
 ~MoveOnly ()
 Destroy the wrapped handle if present.
MoveOnly & operator= (const MoveOnly &)=delete
const SherpaOnnxSpeakerEmbeddingManager * Get () const
 Return the wrapped raw pointer without transferring ownership.
const SherpaOnnxSpeakerEmbeddingManager * Release ()
 Release ownership of the wrapped raw pointer.

Static Public Member Functions

static SpeakerEmbeddingManager Create (int32_t dim)
 Create a speaker embedding manager.

Additional Inherited Members

Protected Attributes inherited from sherpa_onnx::cxx::MoveOnly< SpeakerEmbeddingManager, SherpaOnnxSpeakerEmbeddingManager >
const SherpaOnnxSpeakerEmbeddingManager * p_

Detailed Description

Definition at line 2191 of file cxx-api.h.

Member Function Documentation

◆ Add()

bool sherpa_onnx::cxx::SpeakerEmbeddingManager::Add ( const std::string & name,
const float * v ) const

◆ AddList()

bool sherpa_onnx::cxx::SpeakerEmbeddingManager::AddList ( const std::string & name,
const float ** v ) const

◆ AddListFlattened()

bool sherpa_onnx::cxx::SpeakerEmbeddingManager::AddListFlattened ( const std::string & name,
const float * v,
int32_t n ) const

◆ Contains()

bool sherpa_onnx::cxx::SpeakerEmbeddingManager::Contains ( const std::string & name) const

◆ Create()

SpeakerEmbeddingManager sherpa_onnx::cxx::SpeakerEmbeddingManager::Create ( int32_t dim)
static

◆ Destroy()

void sherpa_onnx::cxx::SpeakerEmbeddingManager::Destroy ( const SherpaOnnxSpeakerEmbeddingManager * p) const

◆ Dim()

int32_t sherpa_onnx::cxx::SpeakerEmbeddingManager::Dim ( ) const

◆ GetAllSpeakers()

std::vector< std::string > sherpa_onnx::cxx::SpeakerEmbeddingManager::GetAllSpeakers ( ) const

◆ GetBestMatches()

std::vector< SpeakerMatch > sherpa_onnx::cxx::SpeakerEmbeddingManager::GetBestMatches ( const float * v,
float threshold,
int32_t n ) const

◆ GetEmbedding()

std::vector< float > sherpa_onnx::cxx::SpeakerEmbeddingManager::GetEmbedding ( const std::string & name) const

◆ NumSpeakers()

int32_t sherpa_onnx::cxx::SpeakerEmbeddingManager::NumSpeakers ( ) const

◆ Remove()

bool sherpa_onnx::cxx::SpeakerEmbeddingManager::Remove ( const std::string & name) const

◆ Search()

std::string sherpa_onnx::cxx::SpeakerEmbeddingManager::Search ( const float * v,
float threshold ) const

◆ Verify()

bool sherpa_onnx::cxx::SpeakerEmbeddingManager::Verify ( const std::string & name,
const float * v,
float threshold ) const

The documentation for this class was generated from the following file: