rapidata 1.0.0__py3-none-any.whl → 1.1.0__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.
- rapidata/rapidata_client/dataset/validation_set_builder.py +12 -14
- rapidata/rapidata_client/order/rapidata_order_builder.py +38 -11
- {rapidata-1.0.0.dist-info → rapidata-1.1.0.dist-info}/METADATA +2 -1
- {rapidata-1.0.0.dist-info → rapidata-1.1.0.dist-info}/RECORD +6 -6
- {rapidata-1.0.0.dist-info → rapidata-1.1.0.dist-info}/WHEEL +1 -1
- {rapidata-1.0.0.dist-info → rapidata-1.1.0.dist-info}/LICENSE +0 -0
|
@@ -160,8 +160,8 @@ class ValidationSetBuilder:
|
|
|
160
160
|
self,
|
|
161
161
|
asset: MediaAsset | TextAsset,
|
|
162
162
|
question: str,
|
|
163
|
-
transcription:
|
|
164
|
-
|
|
163
|
+
transcription: str,
|
|
164
|
+
truths: list[int],
|
|
165
165
|
strict_grading: bool | None = None,
|
|
166
166
|
metadata: list[Metadata] = [],
|
|
167
167
|
):
|
|
@@ -171,9 +171,9 @@ class ValidationSetBuilder:
|
|
|
171
171
|
asset (MediaAsset | TextAsset): The asset for the rapid.
|
|
172
172
|
question (str): The question for the rapid.
|
|
173
173
|
transcription (list[str]): The transcription for the rapid.
|
|
174
|
-
|
|
175
|
-
strict_grading (bool | None, optional): The strict grading
|
|
176
|
-
metadata (list[Metadata], optional): The metadata for the rapid.
|
|
174
|
+
truths (list[int]): The list of indices of the true word selections.
|
|
175
|
+
strict_grading (bool | None, optional): The strict grading for the rapid. Defaults to None.
|
|
176
|
+
metadata (list[Metadata], optional): The metadata for the rapid.
|
|
177
177
|
|
|
178
178
|
Returns:
|
|
179
179
|
ValidationSetBuilder: The ValidationSetBuilder instance.
|
|
@@ -183,16 +183,14 @@ class ValidationSetBuilder:
|
|
|
183
183
|
"""
|
|
184
184
|
transcription_words = [
|
|
185
185
|
TranscriptionWord(word=word, wordIndex=i)
|
|
186
|
-
for i, word in enumerate(transcription)
|
|
186
|
+
for i, word in enumerate(transcription.split())
|
|
187
187
|
]
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
for
|
|
191
|
-
if
|
|
192
|
-
raise ValueError(f"
|
|
193
|
-
|
|
194
|
-
TranscriptionWord(word=word, wordIndex=transcription.index(word))
|
|
195
|
-
)
|
|
189
|
+
true_words = []
|
|
190
|
+
for idx in truths:
|
|
191
|
+
if idx > len(transcription_words) - 1:
|
|
192
|
+
raise ValueError(f"Index {idx} is out of bounds")
|
|
193
|
+
true_words.append(transcription_words[idx])
|
|
196
194
|
|
|
197
195
|
payload = TranscriptionPayload(
|
|
198
196
|
_t="TranscriptionPayload", title=question, transcription=transcription_words
|
|
@@ -200,7 +198,7 @@ class ValidationSetBuilder:
|
|
|
200
198
|
|
|
201
199
|
model_truth = TranscriptionTruth(
|
|
202
200
|
_t="TranscriptionTruth",
|
|
203
|
-
correctWords=
|
|
201
|
+
correctWords=true_words,
|
|
204
202
|
strictGrading=strict_grading,
|
|
205
203
|
)
|
|
206
204
|
|
|
@@ -13,6 +13,9 @@ from rapidata.api_client.models.create_order_model_workflow import (
|
|
|
13
13
|
CreateOrderModelWorkflow,
|
|
14
14
|
)
|
|
15
15
|
from rapidata.api_client.models.country_user_filter_model import CountryUserFilterModel
|
|
16
|
+
from rapidata.api_client.models.language_user_filter_model import (
|
|
17
|
+
LanguageUserFilterModel,
|
|
18
|
+
)
|
|
16
19
|
from rapidata.rapidata_client.feature_flags import FeatureFlags
|
|
17
20
|
from rapidata.rapidata_client.metadata.base_metadata import Metadata
|
|
18
21
|
from rapidata.rapidata_client.dataset.rapidata_dataset import RapidataDataset
|
|
@@ -58,6 +61,7 @@ class RapidataOrderBuilder:
|
|
|
58
61
|
self._validation_set_id: str | None = None
|
|
59
62
|
self._feature_flags: FeatureFlags | None = None
|
|
60
63
|
self._country_codes: list[str] | None = None
|
|
64
|
+
self._language_codes: list[str] | None = None
|
|
61
65
|
self._selections: list[Selection] = []
|
|
62
66
|
self._rapids_per_bag: int = 2
|
|
63
67
|
self._priority: int = 50
|
|
@@ -80,22 +84,32 @@ class RapidataOrderBuilder:
|
|
|
80
84
|
if self._referee is None:
|
|
81
85
|
print("No referee provided, using default NaiveReferee.")
|
|
82
86
|
self._referee = NaiveReferee()
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
user_filters = []
|
|
89
|
+
|
|
90
|
+
if self._country_codes is not None:
|
|
91
|
+
user_filters.append(
|
|
92
|
+
CreateOrderModelUserFiltersInner(
|
|
93
|
+
CountryUserFilterModel(
|
|
94
|
+
_t="CountryFilter", countries=self._country_codes
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
if self._language_codes is not None:
|
|
100
|
+
user_filters.append(
|
|
101
|
+
CreateOrderModelUserFiltersInner(
|
|
102
|
+
LanguageUserFilterModel(
|
|
103
|
+
_t="LanguageFilter", languages=self._language_codes
|
|
104
|
+
)
|
|
105
|
+
)
|
|
88
106
|
)
|
|
89
107
|
|
|
90
108
|
return CreateOrderModel(
|
|
91
109
|
_t="CreateOrderModel",
|
|
92
110
|
orderName=self._name,
|
|
93
111
|
workflow=CreateOrderModelWorkflow(self._workflow.to_model()),
|
|
94
|
-
userFilters=
|
|
95
|
-
[CreateOrderModelUserFiltersInner(country_filter)]
|
|
96
|
-
if country_filter
|
|
97
|
-
else []
|
|
98
|
-
),
|
|
112
|
+
userFilters=user_filters,
|
|
99
113
|
referee=CreateOrderModelReferee(self._referee.to_model()),
|
|
100
114
|
validationSetId=self._validation_set_id,
|
|
101
115
|
featureFlags=(
|
|
@@ -241,7 +255,7 @@ class RapidataOrderBuilder:
|
|
|
241
255
|
|
|
242
256
|
def country_filter(self, country_codes: list[str]) -> "RapidataOrderBuilder":
|
|
243
257
|
"""
|
|
244
|
-
Set the target country codes for the order.
|
|
258
|
+
Set the target country codes for the order. E.g. `country_codes=["DE", "CH", "AT"]` for Germany, Switzerland, and Austria.
|
|
245
259
|
|
|
246
260
|
Args:
|
|
247
261
|
country_codes (list[str]): The country codes to be set.
|
|
@@ -252,6 +266,19 @@ class RapidataOrderBuilder:
|
|
|
252
266
|
self._country_codes = country_codes
|
|
253
267
|
return self
|
|
254
268
|
|
|
269
|
+
def language_filter(self, language_codes: list[str]) -> "RapidataOrderBuilder":
|
|
270
|
+
"""
|
|
271
|
+
Set the target language codes for the order. E.g. `language_codes=["de", "fr", "it"]` for German, French, and Italian.
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
language_codes (list[str]): The language codes to be set.
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
|
|
278
|
+
"""
|
|
279
|
+
self._language_codes = language_codes
|
|
280
|
+
return self
|
|
281
|
+
|
|
255
282
|
def aggregator(self, aggregator: AggregatorType) -> "RapidataOrderBuilder":
|
|
256
283
|
"""
|
|
257
284
|
Set the aggregator for the order.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rapidata
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Rapidata package containing the Rapidata Python Client to interact with the Rapidata Web API in an easy way.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: Rapidata AG
|
|
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
15
|
Requires-Dist: pillow (>=10.4.0,<11.0.0)
|
|
15
16
|
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
|
|
16
17
|
Requires-Dist: pyjwt (>=2.9.0,<3.0.0)
|
|
@@ -287,7 +287,7 @@ rapidata/rapidata_client/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
287
287
|
rapidata/rapidata_client/dataset/rapidata_dataset.py,sha256=Rwt7sM5T74HT7gbtfjmdF9tDaPqHfpMLggIWOsYCgYU,3205
|
|
288
288
|
rapidata/rapidata_client/dataset/rapidata_validation_set.py,sha256=Y7iaThkLxDyHJuKA34rgPkIQ3_8l-hJyZwfomzOyUqk,10096
|
|
289
289
|
rapidata/rapidata_client/dataset/validation_rapid_parts.py,sha256=uzpOZFqQu8bG6vmjcWWUNJPZsRe28OmnyalRE6ry8tk,2317
|
|
290
|
-
rapidata/rapidata_client/dataset/validation_set_builder.py,sha256=
|
|
290
|
+
rapidata/rapidata_client/dataset/validation_set_builder.py,sha256=MhIG6to34Sjt2q7hkWJOFVZzmz0_aI2jRrESlmsljyg,7957
|
|
291
291
|
rapidata/rapidata_client/feature_flags/__init__.py,sha256=IYkcK_bZCl5RfyQFiWjjUdz4y0jipiW9qfeopq4EjQQ,40
|
|
292
292
|
rapidata/rapidata_client/feature_flags/feature_flags.py,sha256=hcS9YRzpsPWpZfw-3QwSuf2TaVg-MOHBxY788oNqIW4,3957
|
|
293
293
|
rapidata/rapidata_client/metadata/__init__.py,sha256=qMmo4wqScUCAJ6YXRWxvJLmbFA5YRbK39p9_exV1d50,246
|
|
@@ -298,7 +298,7 @@ rapidata/rapidata_client/metadata/public_text_metadata.py,sha256=LTiBQHs6izxQ6-C
|
|
|
298
298
|
rapidata/rapidata_client/metadata/transcription_metadata.py,sha256=THtDEVCON4UlcXHmXrjilaOLHys4TrktUOPGWnXaCcc,631
|
|
299
299
|
rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
300
300
|
rapidata/rapidata_client/order/rapidata_order.py,sha256=DCfw_xH7Ja8KURlJYaxVuX6dM81sUF7HLyX4iTfqqZc,3098
|
|
301
|
-
rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=
|
|
301
|
+
rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=E879fYGbdkTfELfuWxy87tmRtrLSmIndevKujRlH8gE,11964
|
|
302
302
|
rapidata/rapidata_client/rapidata_client.py,sha256=s3TlhYlvMuxcyEDIFDqpwRsP0SIi9b158uIHLUyV1gY,4699
|
|
303
303
|
rapidata/rapidata_client/referee/__init__.py,sha256=Ow9MQsONhF4sX2wFK9jbvSBrpcJgtq3OglIQMkBUdIY,167
|
|
304
304
|
rapidata/rapidata_client/referee/base_referee.py,sha256=bMy7cw0a-pGNbFu6u_1_Jplu0A483Ubj4oDQzh8vu8k,493
|
|
@@ -325,7 +325,7 @@ rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5
|
|
|
325
325
|
rapidata/service/openapi_service.py,sha256=-vrM2jEzQxr9KAerOYkVhpvMEeHwjzRwm9L_VFyzOT0,1537
|
|
326
326
|
rapidata/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
327
327
|
rapidata/utils/image_utils.py,sha256=TldO3eJWG8IhfJjm5MfNGO0mEDm1mQTsRoA0HLU1Uxs,404
|
|
328
|
-
rapidata-1.
|
|
329
|
-
rapidata-1.
|
|
330
|
-
rapidata-1.
|
|
331
|
-
rapidata-1.
|
|
328
|
+
rapidata-1.1.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
329
|
+
rapidata-1.1.0.dist-info/METADATA,sha256=OEWHxhQ0JHX20wGLRT9ISppda18KuLHBLLicZfwKxeE,1012
|
|
330
|
+
rapidata-1.1.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
331
|
+
rapidata-1.1.0.dist-info/RECORD,,
|
|
File without changes
|