pvleopard 2.0.1__py3-none-any.whl → 2.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pvleopard/_util.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2022-2023 Picovoice Inc.
2
+ # Copyright 2022-2024 Picovoice Inc.
3
3
  #
4
4
  # You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5
5
  # file accompanying this source.
@@ -37,16 +37,21 @@ def _linux_machine():
37
37
 
38
38
  if '0xd03' == cpu_part:
39
39
  return 'cortex-a53' + arch_info
40
- elif '0xd07' == cpu_part:
41
- return 'cortex-a57' + arch_info
42
40
  elif '0xd08' == cpu_part:
43
41
  return 'cortex-a72' + arch_info
42
+ elif "0xd0b" == cpu_part:
43
+ return "cortex-a76" + arch_info
44
44
  else:
45
45
  raise NotImplementedError("Unsupported CPU: `%s`." % cpu_part)
46
46
 
47
47
 
48
- _RASPBERRY_PI_MACHINES = {'cortex-a53', 'cortex-a72', 'cortex-a53-aarch64', 'cortex-a72-aarch64'}
49
- _JETSON_MACHINES = {'cortex-a57-aarch64'}
48
+ _RASPBERRY_PI_MACHINES = {
49
+ "cortex-a53",
50
+ "cortex-a72",
51
+ "cortex-a76",
52
+ "cortex-a53-aarch64",
53
+ "cortex-a72-aarch64",
54
+ "cortex-a76-aarch64"}
50
55
 
51
56
 
52
57
  def default_library_path(relative):
@@ -59,15 +64,16 @@ def default_library_path(relative):
59
64
  linux_machine = _linux_machine()
60
65
  if linux_machine == 'x86_64':
61
66
  return os.path.join(os.path.dirname(__file__), relative, 'lib/linux/x86_64/libpv_leopard.so')
62
- elif linux_machine in _JETSON_MACHINES:
63
- return os.path.join(os.path.dirname(__file__), relative, 'lib/jetson/%s/libpv_leopard.so' % linux_machine)
64
67
  elif linux_machine in _RASPBERRY_PI_MACHINES:
65
68
  return os.path.join(
66
69
  os.path.dirname(__file__),
67
70
  relative,
68
71
  'lib/raspberry-pi/%s/libpv_leopard.so' % linux_machine)
69
72
  elif platform.system() == 'Windows':
70
- return os.path.join(os.path.dirname(__file__), relative, 'lib/windows/amd64/libpv_leopard.dll')
73
+ if platform.machine().lower() == 'amd64':
74
+ return os.path.join(os.path.dirname(__file__), relative, 'lib/windows/amd64/libpv_leopard.dll')
75
+ elif platform.machine().lower() == 'arm64':
76
+ return os.path.join(os.path.dirname(__file__), relative, 'lib/windows/arm64/libpv_leopard.dll')
71
77
 
72
78
  raise NotImplementedError('Unsupported platform.')
73
79
 
@@ -1,20 +1,18 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pvleopard
3
- Version: 2.0.1
3
+ Version: 2.0.4
4
4
  Summary: Leopard Speech-to-Text Engine.
5
5
  Home-page: https://github.com/Picovoice/leopard
6
6
  Author: Picovoice
7
7
  Author-email: hello@picovoice.ai
8
- License: UNKNOWN
9
8
  Keywords: Speech-to-Text,Speech Recognition,Voice Recognition,ASR,Automatic Speech Recognition
10
- Platform: UNKNOWN
11
9
  Classifier: Development Status :: 5 - Production/Stable
12
10
  Classifier: Intended Audience :: Developers
13
11
  Classifier: License :: OSI Approved :: Apache Software License
14
12
  Classifier: Operating System :: OS Independent
15
13
  Classifier: Programming Language :: Python :: 3
16
14
  Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
17
- Requires-Python: >=3.5
15
+ Requires-Python: >=3.8
18
16
  Description-Content-Type: text/markdown
19
17
 
20
18
  # Leopard Binding for Python
@@ -29,15 +27,15 @@ Leopard is an on-device speech-to-text engine. Leopard is:
29
27
  - [Accurate](https://picovoice.ai/docs/benchmark/stt/)
30
28
  - [Compact and Computationally-Efficient](https://github.com/Picovoice/speech-to-text-benchmark#rtf)
31
29
  - Cross-Platform:
32
- - Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
30
+ - Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
33
31
  - Android and iOS
34
32
  - Chrome, Safari, Firefox, and Edge
35
- - Raspberry Pi (4, 3) and NVIDIA Jetson Nano
33
+ - Raspberry Pi (3, 4, 5)
36
34
 
37
35
  ## Compatibility
38
36
 
39
- - Python 3.5+
40
- - Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (4, 3), and NVIDIA Jetson Nano.
37
+ - Python 3.8+
38
+ - Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).
41
39
 
42
40
  ## Installation
43
41
 
@@ -51,7 +49,7 @@ Leopard requires a valid Picovoice `AccessKey` at initialization. `AccessKey` ac
51
49
  You can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.
52
50
  Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.
53
51
 
54
- ### Usage
52
+ ## Usage
55
53
 
56
54
  Create an instance of the engine and transcribe an audio file:
57
55
 
@@ -60,23 +58,23 @@ import pvleopard
60
58
 
61
59
  leopard = pvleopard.create(access_key='${ACCESS_KEY}')
62
60
 
63
- transcript, words = leopard.process_file('${AUDIO_PATH}')
61
+ transcript, words = leopard.process_file('${AUDIO_FILE_PATH}')
64
62
  print(transcript)
65
63
  for word in words:
66
64
  print(
67
- "{word=\"%s\" start_sec=%.2f end_sec=%.2f confidence=%.2f}"
68
- % (word.word, word.start_sec, word.end_sec, word.confidence))
65
+ "{word=\"%s\" start_sec=%.2f end_sec=%.2f confidence=%.2f speaker_tag=%d}"
66
+ % (word.word, word.start_sec, word.end_sec, word.confidence, word.speaker_tag))
69
67
  ```
70
68
 
71
69
  Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://console.picovoice.ai/) and
72
- `${AUDIO_PATH}` to the path an audio file.
70
+ `${AUDIO_FILE_PATH}` to the path an audio file.
73
71
 
74
72
  Finally, when done be sure to explicitly release the resources:
75
73
  ```python
76
74
  leopard.delete()
77
75
  ```
78
76
 
79
- ## Language Model
77
+ ### Language Model
80
78
 
81
79
  The Leopard Python SDK comes preloaded with a default English language model (`.pv` file).
82
80
  Default models for other supported languages can be found in [lib/common](../../lib/common).
@@ -88,12 +86,19 @@ Pass in the `.pv` file via the `model_path` argument:
88
86
  ```python
89
87
  leopard = pvleopard.create(
90
88
  access_key='${ACCESS_KEY}',
91
- model_path='${MODEL_PATH}')
89
+ model_path='${MODEL_FILE_PATH}')
92
90
  ```
93
91
 
92
+ ### Word Metadata
93
+
94
+ Along with the transcript, Leopard returns metadata for each transcribed word. Available metadata items are:
95
+
96
+ - **Start Time:** Indicates when the word started in the transcribed audio. Value is in seconds.
97
+ - **End Time:** Indicates when the word ended in the transcribed audio. Value is in seconds.
98
+ - **Confidence:** Leopard's confidence that the transcribed word is accurate. It is a number within `[0, 1]`.
99
+ - **Speaker Tag:** If speaker diarization is enabled on initialization, the speaker tag is a non-negative integer identifying unique speakers, with `0` reserved for unknown speakers. If speaker diarization is not enabled, the value will always be `-1`.
100
+
94
101
  ## Demos
95
102
 
96
103
  [pvleoparddemo](https://pypi.org/project/pvleoparddemo/) provides command-line utilities for processing audio using
97
104
  Leopard.
98
-
99
-
@@ -2,9 +2,8 @@ pvleopard/LICENSE,sha256=ZurJwSSRHw99lGaJP88vQREqtZmIABuVKd_rK7k7U70,11344
2
2
  pvleopard/__init__.py,sha256=OCI_7jgscvkzJMwT02SfB85_xOoQC8eb1e52HR_GKgo,577
3
3
  pvleopard/_factory.py,sha256=1ZotcV9xdcJLRAYajFwFHfB0tV3_9bSi15_cjhedMnM,2075
4
4
  pvleopard/_leopard.py,sha256=U6eNGzgQfpKaQxnDaOKHBDi2Kj_ysEHhF3SdVojbmhE,12741
5
- pvleopard/_util.py,sha256=TQ3fXjUNUDerUbXdC6ntjMXaYD_B5udi__xp41zL9lE,3113
5
+ pvleopard/_util.py,sha256=FMHEdBOG_p7psMl50X60-dRTSC62zAM-gLTUFmXUFOw,3179
6
6
  pvleopard/lib/common/leopard_params.pv,sha256=8jsCUfmOuuTD2MXLduV17hD1vHXuO-wscyJobYCsbfs,37699432
7
- pvleopard/lib/jetson/cortex-a57-aarch64/libpv_leopard.so,sha256=y431wzz9NuRsOXnhk7ciZ9s6Lc3v9lr5mWdbkqC1bXE,1300032
8
7
  pvleopard/lib/linux/x86_64/libpv_leopard.so,sha256=UhcGHHjCnR1Y-AMHVgVIbRoR_yjgRlw7SpcV86JwkX8,1415360
9
8
  pvleopard/lib/mac/arm64/libpv_leopard.dylib,sha256=o4WF9nzDvF5K9_AKppz-avXsk-wApmRVKQuUArbvxSc,1545072
10
9
  pvleopard/lib/mac/x86_64/libpv_leopard.dylib,sha256=Qwnh-0EI-VSWTjbSXnfmkxmYU8Z1ow-fFkCUQ2K9slc,1697720
@@ -12,8 +11,11 @@ pvleopard/lib/raspberry-pi/cortex-a53/libpv_leopard.so,sha256=DEnIu2Jpe_w9sviYNC
12
11
  pvleopard/lib/raspberry-pi/cortex-a53-aarch64/libpv_leopard.so,sha256=FBqYYJbmtOu4AAD532__IfuJo6O9MnkP933CYK4pF3g,1312320
13
12
  pvleopard/lib/raspberry-pi/cortex-a72/libpv_leopard.so,sha256=ALyBJ2I5B_nKQ2Vr7cTrPiFSnxIxsTPhOhcIWp3SOOg,1288048
14
13
  pvleopard/lib/raspberry-pi/cortex-a72-aarch64/libpv_leopard.so,sha256=Kn5Ricawg62MGrzL6ZS-bcPOarlSU0PcwSQ-WG7k-Uo,1300032
14
+ pvleopard/lib/raspberry-pi/cortex-a76/libpv_leopard.so,sha256=YoZZp2c6NmNhKI7Gc2PpjxBHpdZB74t3CBWr3qvVZ_w,1288048
15
+ pvleopard/lib/raspberry-pi/cortex-a76-aarch64/libpv_leopard.so,sha256=CV575luBomZCR6rACismqXhmFSSvrEoNzUhXo5l3F4c,1300032
15
16
  pvleopard/lib/windows/amd64/libpv_leopard.dll,sha256=hM6eYFgcQ6p8ZIe8BFw0Yxm3enA2rPSRBCysVzFC8kQ,1524736
16
- pvleopard-2.0.1.dist-info/METADATA,sha256=hloxBn0p8TABCghj9eSzSBIZxNNK-q1G_MyHR5yoOaY,3141
17
- pvleopard-2.0.1.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
18
- pvleopard-2.0.1.dist-info/top_level.txt,sha256=DAhlor-zWSROmsQCFWDsx_IJSE62zlgJ3sE4quxhEPw,10
19
- pvleopard-2.0.1.dist-info/RECORD,,
17
+ pvleopard/lib/windows/arm64/libpv_leopard.dll,sha256=-RE83R0QjwtKdDN-sXy60a1tMbiqcIcxBRKfbViKy_4,1566720
18
+ pvleopard-2.0.4.dist-info/METADATA,sha256=lXiSgMkOgXwEOtFIw-_a9s8ZupuMtLWdhw5nveLT5PM,3812
19
+ pvleopard-2.0.4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
20
+ pvleopard-2.0.4.dist-info/top_level.txt,sha256=DAhlor-zWSROmsQCFWDsx_IJSE62zlgJ3sE4quxhEPw,10
21
+ pvleopard-2.0.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.34.2)
2
+ Generator: bdist_wheel (0.37.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5