Expose DeepSpeechTokenMetadata fields
Currently, attempting to access member fields DeepSpeechTokenMetadata objects output from intermediateDecodeWithMetadata causes a crash. Changing these lines makes the object work as (I assume) intended.
This commit is contained in:
parent
93c7d1d5dc
commit
28ddc6b0e0
@ -119,13 +119,13 @@ private func evaluateErrorCode(errorCode: Int32) throws {
|
|||||||
/// Stores text of an individual token, along with its timing information
|
/// Stores text of an individual token, along with its timing information
|
||||||
public struct DeepSpeechTokenMetadata {
|
public struct DeepSpeechTokenMetadata {
|
||||||
/// The text corresponding to this token
|
/// The text corresponding to this token
|
||||||
let text: String
|
public let text: String
|
||||||
|
|
||||||
/// Position of the token in units of 20ms
|
/// Position of the token in units of 20ms
|
||||||
let timestep: Int
|
public let timestep: Int
|
||||||
|
|
||||||
/// Position of the token in seconds
|
/// Position of the token in seconds
|
||||||
let startTime: Float
|
public let startTime: Float
|
||||||
|
|
||||||
internal init(fromInternal: TokenMetadata) {
|
internal init(fromInternal: TokenMetadata) {
|
||||||
text = String(cString: fromInternal.text)
|
text = String(cString: fromInternal.text)
|
||||||
@ -139,7 +139,7 @@ public struct DeepSpeechTokenMetadata {
|
|||||||
*/
|
*/
|
||||||
public struct DeepSpeechCandidateTranscript {
|
public struct DeepSpeechCandidateTranscript {
|
||||||
/// Array of DeepSpeechTokenMetadata objects
|
/// Array of DeepSpeechTokenMetadata objects
|
||||||
private(set) var tokens: [DeepSpeechTokenMetadata] = []
|
public private(set) var tokens: [DeepSpeechTokenMetadata] = []
|
||||||
|
|
||||||
/** Approximated confidence value for this transcript. This corresponds to
|
/** Approximated confidence value for this transcript. This corresponds to
|
||||||
both acoustic model and language model scores that contributed to the
|
both acoustic model and language model scores that contributed to the
|
||||||
@ -159,7 +159,7 @@ public struct DeepSpeechCandidateTranscript {
|
|||||||
/// An array of DeepSpeechCandidateTranscript objects computed by the model
|
/// An array of DeepSpeechCandidateTranscript objects computed by the model
|
||||||
public struct DeepSpeechMetadata {
|
public struct DeepSpeechMetadata {
|
||||||
/// Array of DeepSpeechCandidateTranscript objects
|
/// Array of DeepSpeechCandidateTranscript objects
|
||||||
private(set) var transcripts: [DeepSpeechCandidateTranscript] = []
|
public private(set) var transcripts: [DeepSpeechCandidateTranscript] = []
|
||||||
|
|
||||||
internal init(fromInternal: UnsafeMutablePointer<Metadata>) {
|
internal init(fromInternal: UnsafeMutablePointer<Metadata>) {
|
||||||
let md = fromInternal.pointee
|
let md = fromInternal.pointee
|
||||||
|
Loading…
x
Reference in New Issue
Block a user