xlin 0.1.22__tar.gz → 0.1.24__tar.gz
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.
- {xlin-0.1.22 → xlin-0.1.24}/PKG-INFO +1 -1
- {xlin-0.1.22 → xlin-0.1.24}/pyproject.toml +1 -1
- {xlin-0.1.22 → xlin-0.1.24}/xlin/jsonl.py +8 -3
- {xlin-0.1.22 → xlin-0.1.24}/xlin/statistic.py +1 -1
- {xlin-0.1.22 → xlin-0.1.24}/LICENSE +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/README.md +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/__init__.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/ischinese.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/metric.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/multiprocess_mapping.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/read_as_dataframe.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/timing.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/util.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/xls2xlsx.py +0 -0
- {xlin-0.1.22 → xlin-0.1.24}/xlin/yaml.py +0 -0
@@ -224,11 +224,16 @@ def generator_from_paths(paths: List[Path], load_data: Callable[[Path], List[Dic
|
|
224
224
|
|
225
225
|
|
226
226
|
|
227
|
-
def append_to_json_list(data: list[dict], file_path: str):
|
227
|
+
def append_to_json_list(data: list[dict], file_path: Union[str, Path]):
|
228
228
|
"""Append a list of dictionaries to a JSON file."""
|
229
|
-
|
229
|
+
file_path = Path(file_path)
|
230
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
231
|
+
if file_path.exists() and file_path.is_dir():
|
232
|
+
print(f"{file_path} is a directory, not a file.")
|
233
|
+
return
|
234
|
+
with open(file_path, "a", encoding="utf-8") as f:
|
230
235
|
for item in data:
|
231
|
-
f.write(json.dumps(item) + "\n")
|
236
|
+
f.write(json.dumps(item, ensure_ascii=False, separators=(",", ":")) + "\n")
|
232
237
|
|
233
238
|
|
234
239
|
def row_to_json(row: dict) -> dict:
|
@@ -199,7 +199,7 @@ def generate_classification_report(predictions: List[str], labels: List[str]) ->
|
|
199
199
|
p = class_df["precision"].values.tolist() + [None]
|
200
200
|
tail = pd.DataFrame([p], index=["precision"], columns=confusion_matrix.columns)
|
201
201
|
confusion_matrix = pd.concat([confusion_matrix, tail], axis=0)
|
202
|
-
confusion_matrix.index.name = "True \\
|
202
|
+
confusion_matrix.index.name = "True \\ Pred"
|
203
203
|
report["confusion_matrix"] = confusion_matrix
|
204
204
|
|
205
205
|
micro_precision = micro_tp / (micro_tp + micro_fp) if (micro_tp + micro_fp) > 0 else 0
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|