k2py 0.2.1__cp311-cp311-win_amd64.whl → 0.2.4__cp311-cp311-win_amd64.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.
k2py/__init__.py
CHANGED
|
@@ -35,7 +35,18 @@ class AlignedToken:
|
|
|
35
35
|
|
|
36
36
|
class OnlineDenseIntersecter(_OnlineDenseIntersecter):
|
|
37
37
|
"""Wrapper around C++ OnlineDenseIntersecter to produce Python-friendly results."""
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
def get_partial_labels(self) -> List[int]:
|
|
40
|
+
"""Get partial per-frame labels for streaming confidence calculation.
|
|
41
|
+
|
|
42
|
+
Returns per-frame token IDs from the current lattice state.
|
|
43
|
+
Used for computing emission-based confidence scores in streaming mode.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
List of token IDs, one per frame.
|
|
47
|
+
"""
|
|
48
|
+
return list(super().get_partial_labels())
|
|
49
|
+
|
|
39
50
|
def finish(self) -> Tuple[List[List["AlignedToken"]], List[List[int]]]:
|
|
40
51
|
"""Finish decoding and return results including AlignedToken objects.
|
|
41
52
|
|
|
@@ -69,9 +80,10 @@ def AlignSegments(
|
|
|
69
80
|
min_active_states: int,
|
|
70
81
|
max_active_states: int,
|
|
71
82
|
use_double_scores: bool = True,
|
|
83
|
+
allow_partial: bool = True,
|
|
72
84
|
) -> Tuple[List[List["AlignedToken"]], List[List[int]]]:
|
|
73
85
|
"""Align segments using offline dense intersection.
|
|
74
|
-
|
|
86
|
+
|
|
75
87
|
Args:
|
|
76
88
|
graph_result: Dictionary returned by CreateFsaVecFromStr
|
|
77
89
|
scores: Numpy array of scores (rows, cols)
|
|
@@ -80,14 +92,16 @@ def AlignSegments(
|
|
|
80
92
|
min_active_states: Minimum active states
|
|
81
93
|
max_active_states: Maximum active states
|
|
82
94
|
use_double_scores: Whether to use double precision for scores
|
|
83
|
-
|
|
95
|
+
allow_partial: If True, treat all states on last frame as final
|
|
96
|
+
when no final state is active. Default True.
|
|
97
|
+
|
|
84
98
|
Returns:
|
|
85
99
|
A tuple containing:
|
|
86
100
|
- results: List of List of AlignedToken objects (wrapped in list for batch consistency)
|
|
87
101
|
- labels: List of List of timestamps (wrapped in list for batch consistency)
|
|
88
102
|
"""
|
|
89
103
|
from ._k2 import AlignSegments as _AlignSegments
|
|
90
|
-
|
|
104
|
+
|
|
91
105
|
final_result = _AlignSegments(
|
|
92
106
|
graph_result,
|
|
93
107
|
scores,
|
|
@@ -95,7 +109,8 @@ def AlignSegments(
|
|
|
95
109
|
output_beam,
|
|
96
110
|
min_active_states,
|
|
97
111
|
max_active_states,
|
|
98
|
-
use_double_scores
|
|
112
|
+
use_double_scores,
|
|
113
|
+
allow_partial,
|
|
99
114
|
)
|
|
100
115
|
|
|
101
116
|
# Convert to AlignedToken objects
|
k2py/_k2.cp311-win_amd64.pyd
CHANGED
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
k2py/__init__.py,sha256=KR-D9Luea5f6G6-O9pHsQoJTPH7kn2zLwuFXSIDs-M8,4741
|
|
2
|
+
k2py/_k2.cp311-win_amd64.pyd,sha256=FlDsozTi0J5e71-WjgJAlxMZgNhsvm-Jo8mipsm2akg,677376
|
|
3
|
+
k2py-0.2.4.dist-info/METADATA,sha256=YZxTxwdJp7Hawm0YeUP1tPYebyv0Lbc17TB2hjgO8OY,2306
|
|
4
|
+
k2py-0.2.4.dist-info/WHEEL,sha256=oXhHG6ewLm-FNdEna2zwgy-K0KEl4claZ1ztR4VTx0I,106
|
|
5
|
+
k2py-0.2.4.dist-info/RECORD,,
|
k2py-0.2.1.dist-info/RECORD
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
k2py/__init__.py,sha256=fD-0RgkT-0zda8QSVWiDkTnRqyvgv3t9ZejCFdB4qRU,4151
|
|
2
|
-
k2py/_k2.cp311-win_amd64.pyd,sha256=BJV8gEloWl8xI6PolsxaKhBKuyr8THPoEXP1vh1gz6c,673280
|
|
3
|
-
k2py-0.2.1.dist-info/METADATA,sha256=WZj7TvtzS_CVPsCWiQexJhu2JIE727HBgur1ZuCBatw,2306
|
|
4
|
-
k2py-0.2.1.dist-info/WHEEL,sha256=oXhHG6ewLm-FNdEna2zwgy-K0KEl4claZ1ztR4VTx0I,106
|
|
5
|
-
k2py-0.2.1.dist-info/RECORD,,
|
|
File without changes
|