|
@@ -140,14 +140,16 @@ class Kaylee:
|
140
|
140
|
|
141
|
141
|
def recognizer_finished(self, recognizer, text):
|
142
|
142
|
confidence_heap = queue.PriorityQueue()
|
|
143
|
+ min_confidence = self.options['minimum_confidence']
|
143
|
144
|
# Add plugins to the heap
|
144
|
145
|
for index, plugin in enumerate(self.plugins):
|
145
|
146
|
# Get plugin confidence
|
146
|
147
|
confidence = plugin.confidence(text)
|
147
|
148
|
# Clamp confidence to [0, 1]
|
148
|
149
|
confidence = min(max(confidence, 0), 1)
|
149
|
|
- # TODO: Only add items if they meet minimum confidence
|
150
|
|
- if confidence > 0:
|
|
150
|
+ # If the plugin meets minimum confidence
|
|
151
|
+ if ((min_confidence is not None and confidence >= min_confidence)
|
|
152
|
+ or (min_confidence is None and confidence > 0)):
|
151
|
153
|
# Add a triple to the heap, so plugins are sorted first by
|
152
|
154
|
# confidence, then by index to break ties
|
153
|
155
|
confidence_heap.put_nowait((1 - confidence, index, plugin))
|