pvleopard 1.1.5__py3-none-any.whl → 1.2.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
pvleopard/_leopard.py CHANGED
@@ -189,9 +189,17 @@ class Leopard(object):
189
189
 
190
190
  self._sample_rate = library.pv_sample_rate()
191
191
 
192
- self._pv_free = library.pv_free
193
- self._pv_free.argtypes = [c_void_p]
194
- self._pv_free.restype = None
192
+ self._transcript_delete_func = library.pv_leopard_transcript_delete
193
+ self._transcript_delete_func.argtypes = [
194
+ c_char_p
195
+ ]
196
+ self._transcript_delete_func.restype = None
197
+
198
+ self._words_delete_func = library.pv_leopard_words_delete
199
+ self._words_delete_func.argtypes = [
200
+ POINTER(self.CWord)
201
+ ]
202
+ self._words_delete_func.restype = None
195
203
 
196
204
  Word = namedtuple('Word', ['word', 'start_sec', 'end_sec', 'confidence'])
197
205
 
@@ -221,6 +229,9 @@ class Leopard(object):
221
229
  if status is not self.PicovoiceStatuses.SUCCESS:
222
230
  raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
223
231
 
232
+ transcript = c_transcript.value.decode('utf-8')
233
+ self._transcript_delete_func(c_transcript)
234
+
224
235
  words = list()
225
236
  for i in range(num_words.value):
226
237
  word = self.Word(
@@ -230,10 +241,9 @@ class Leopard(object):
230
241
  confidence=c_words[i].confidence)
231
242
  words.append(word)
232
243
 
233
- if num_words.value > 0:
234
- self._pv_free(c_words)
244
+ self._words_delete_func(c_words)
235
245
 
236
- return c_transcript.value.decode('utf-8'), words
246
+ return transcript, words
237
247
 
238
248
  def process_file(self, audio_path: str) -> Tuple[str, Sequence[Word]]:
239
249
  """
@@ -264,6 +274,9 @@ class Leopard(object):
264
274
  )
265
275
  raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
266
276
 
277
+ transcript = c_transcript.value.decode('utf-8')
278
+ self._transcript_delete_func(c_transcript)
279
+
267
280
  words = list()
268
281
  for i in range(num_words.value):
269
282
  word = self.Word(
@@ -273,10 +286,9 @@ class Leopard(object):
273
286
  confidence=c_words[i].confidence)
274
287
  words.append(word)
275
288
 
276
- if num_words.value > 0:
277
- self._pv_free(c_words)
289
+ self._words_delete_func(c_words)
278
290
 
279
- return c_transcript.value.decode('utf-8'), words
291
+ return transcript, words
280
292
 
281
293
  def delete(self) -> None:
282
294
  """Releases resources acquired by Leopard."""
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pvleopard
3
- Version: 1.1.5
3
+ Version: 1.2.0
4
4
  Summary: Leopard Speech-to-Text Engine.
5
5
  Home-page: https://github.com/Picovoice/leopard
6
6
  Author: Picovoice
@@ -70,6 +70,21 @@ Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://con
70
70
  `${AUDIO_PATH}` to the path an audio file. Finally, when done be sure to explicitly release the resources using
71
71
  `handle.delete()`.
72
72
 
73
+ ## Language Model
74
+
75
+ The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
76
+ Default models for other supported languages can be found in [lib/common](../../lib/common).
77
+
78
+ Create custom language models using the [Picovoice Console](https://console.picovoice.ai/). Here you can train
79
+ language models with custom vocabulary and boost words in the existing vocabulary.
80
+
81
+ Pass in the `.pv` file via the `model_path` argument:
82
+ ```python
83
+ handle = pvleopard.create(
84
+ access_key='${ACCESS_KEY}',
85
+ model_path='${MODEL_PATH}')
86
+ ```
87
+
73
88
  ## Demos
74
89
 
75
90
  [pvleoparddemo](https://pypi.org/project/pvleoparddemo/) provides command-line utilities for processing audio using
@@ -0,0 +1,10 @@
1
+ pvleopard/LICENSE,sha256=ZurJwSSRHw99lGaJP88vQREqtZmIABuVKd_rK7k7U70,11344
2
+ pvleopard/__init__.py,sha256=OCI_7jgscvkzJMwT02SfB85_xOoQC8eb1e52HR_GKgo,577
3
+ pvleopard/_factory.py,sha256=WzrCwUlU_TCXkzZKPFd0ag4sAdiuwRlpOM6HYl1M-t0,1746
4
+ pvleopard/_leopard.py,sha256=qk9kf7aRETnbEyBOrZ7sg_ESgKm3NEow_6nnQjjl-ms,10366
5
+ pvleopard/_util.py,sha256=blfsGbVyqTjdHaj7RmU0DEc6fxab47w7EApDWCxKML8,3061
6
+ pvleopard/lib/common/leopard_params.pv,sha256=CBoaZ8kach9nVD-I-SJakBvbVi2EfxpiumH9Bk_DKCU,19850729
7
+ pvleopard-1.2.0.dist-info/METADATA,sha256=c_cUFkQUw7npZTyj9bSmob4XGpDx480NWYg_XcrWhCQ,3102
8
+ pvleopard-1.2.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
9
+ pvleopard-1.2.0.dist-info/top_level.txt,sha256=DAhlor-zWSROmsQCFWDsx_IJSE62zlgJ3sE4quxhEPw,10
10
+ pvleopard-1.2.0.dist-info/RECORD,,
Binary file
Binary file
@@ -1,19 +0,0 @@
1
- pvleopard/LICENSE,sha256=ZurJwSSRHw99lGaJP88vQREqtZmIABuVKd_rK7k7U70,11344
2
- pvleopard/__init__.py,sha256=OCI_7jgscvkzJMwT02SfB85_xOoQC8eb1e52HR_GKgo,577
3
- pvleopard/_factory.py,sha256=WzrCwUlU_TCXkzZKPFd0ag4sAdiuwRlpOM6HYl1M-t0,1746
4
- pvleopard/_leopard.py,sha256=NaDB7xPB-5sJiAZJ79JAcAIhG7L_OZc8o9ZIJGYtk7g,9961
5
- pvleopard/_util.py,sha256=blfsGbVyqTjdHaj7RmU0DEc6fxab47w7EApDWCxKML8,3061
6
- pvleopard/lib/common/leopard_params.pv,sha256=kH9sOC_szGMkbHzSTRbmre-helqNFKXWmroAUK4FUcc,19139221
7
- pvleopard/lib/jetson/cortex-a57-aarch64/libpv_leopard.so,sha256=3JdoCvpp-d1Ih6cA9KE2kOQ1cAuNmJsRiX2Zm5thzEk,1274464
8
- pvleopard/lib/linux/x86_64/libpv_leopard.so,sha256=8FW1Ssktd9P7tgjbrkBmgAPG0zcUPaw4Q6wb3iLOzFE,1369208
9
- pvleopard/lib/mac/arm64/libpv_leopard.dylib,sha256=tnaN0GAIO3asFBJz6T1bCXxBVWesysY78jzNrSU9GKw,1496704
10
- pvleopard/lib/mac/x86_64/libpv_leopard.dylib,sha256=Tl7bDk89QjGKpvvbWIi0B-itAgjpZlu-Zf7BLFNmn7Y,1649744
11
- pvleopard/lib/raspberry-pi/cortex-a53/libpv_leopard.so,sha256=w066F-s2zMwRg-iBCFIAZegH0xBxvoYoS-vQ0YSJEXg,1234356
12
- pvleopard/lib/raspberry-pi/cortex-a53-aarch64/libpv_leopard.so,sha256=sCtOQMMO0Dvkyb_g3T9q6QU1e6uQViF33pOTLzTmx9k,1278648
13
- pvleopard/lib/raspberry-pi/cortex-a72/libpv_leopard.so,sha256=omvbYIrPa8dOUFe4Nnyr_AwcpQ2IwbHY7wltYGPWX8U,1246644
14
- pvleopard/lib/raspberry-pi/cortex-a72-aarch64/libpv_leopard.so,sha256=KgezrVHCLspnXPaBgle_qAbPO49mk-Z6pS_YldJo67Y,1266360
15
- pvleopard/lib/windows/amd64/libpv_leopard.dll,sha256=dWuDulgUuhJDWgTd8cJu_vCGK2CJLJES0JoRNKrrJog,1608192
16
- pvleopard-1.1.5.dist-info/METADATA,sha256=DdK-_Bj2NxMEsUK2oYSDBz6vU_1rJLw_uJ9bCwFtZcs,2541
17
- pvleopard-1.1.5.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
18
- pvleopard-1.1.5.dist-info/top_level.txt,sha256=DAhlor-zWSROmsQCFWDsx_IJSE62zlgJ3sE4quxhEPw,10
19
- pvleopard-1.1.5.dist-info/RECORD,,