Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ final class PorcupineWakeWordEngine: WakeWordEngine {
// 5. Keyword path
let keywordPath: String
let keywordDir = resourceURL.appendingPathComponent("porcupine-keywords")
let builtinPath = keywordDir.appendingPathComponent(keyword.lowercased() + "_mac.ppn").path
let builtinPath = keywordDir.appendingPathComponent(self.keyword.lowercased() + "_mac.ppn").path
if FileManager.default.fileExists(atPath: builtinPath) {
keywordPath = builtinPath
} else if keyword.hasPrefix("/") && FileManager.default.fileExists(atPath: keyword) {
} else if self.keyword.hasPrefix("/") && FileManager.default.fileExists(atPath: self.keyword) {
// Treat keyword as an absolute path to a custom .ppn file
keywordPath = keyword
keywordPath = self.keyword
} else {
log.error("Keyword file not found: tried \(builtinPath) and absolute path \(keyword)")
log.error("Keyword file not found: tried \(builtinPath) and absolute path \(self.keyword)")
return
}

Expand All @@ -100,7 +100,7 @@ final class PorcupineWakeWordEngine: WakeWordEngine {
accessKey: accessKey,
modelPath: modelPath,
keywordPaths: [keywordPath],
sensitivities: [sensitivity]
sensitivities: [self.sensitivity]
)
} catch {
log.error("Failed to initialize Porcupine engine: \(error)")
Expand Down