k4d3 commited on
Commit
ea62a47
1 Parent(s): 281a0f2

Signed-off-by: Balazs Horvath <[email protected]>

dataset_tools/Remove Commas from Caption Files.ipynb ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\03c67b009e6581e076615a4f9b71367b.caption\n",
13
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\0476f074c637d11afe8990707b1bd58b.caption\n",
14
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\0848e91ca8d354126a3f5ca1f27b823b.caption\n",
15
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\0a7c83cc86a819d9d7dc086f6b0f187c.caption\n",
16
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\10b4bd37a5593d5740365acd5e24c37a.caption\n",
17
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\121009814ce67aaffba55075a34feb06.caption\n",
18
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1951c9ae19851b1032ecb069aeff0c6c.caption\n",
19
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1aad2bcd835b573b55cb1ccd98b92d43.caption\n",
20
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1bd498638f0c7a588d4da253de471258.caption\n",
21
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1cc8ea9dd0f1f068014314fd15ed9ad9.caption\n",
22
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1d411b14dd22f24cb54a04fc07a85996.caption\n",
23
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1de149ed30600acf277e32a9c48e3879.caption\n",
24
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1e5dade6a65aeb3537e9eb5d49c2dd00.caption\n",
25
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1f2ddd50c22a314c3447f19206855410.caption\n",
26
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\24822d9ddaae7260c59553290400a79e.caption\n",
27
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\277361bdfaafac051885ee07c5416b63.caption\n",
28
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\289a0e858026ab8585df8e34c1aa6c35.caption\n",
29
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\29c13b2ea7279fbd66eea6a3bcee8c13.caption\n",
30
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\3245e9826b5f3fda0e020391f4be5463.caption\n",
31
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\3c2e90d1fe89319da13c4497124bb8aa.caption\n",
32
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\3fa84aa5dd2a408c1896ce701998787c.caption\n",
33
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\4d10005d667513f3b984c182c0a409d7.caption\n",
34
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5aefee29406f5b5db89a3df2ce343e0b.caption\n",
35
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5dd1d683386dafd3305f872c72354370.caption\n",
36
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5e46e26270e33a062282af82c8d31150.caption\n",
37
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5e60084e9ad3ca9f704f7b8963c9fa97.caption\n",
38
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5fd70c9088ebece61d9018b078f54db3.caption\n",
39
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\605bb58fb3f5c343d6db9c10cffbd577.caption\n",
40
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\6779aa12607f3a6b2bffa9e5ccb31bcf.caption\n",
41
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\67ba2ed39f13b60b3e73f1af2f96f966.caption\n",
42
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\67fb1251907898c6fdc08084c56d6f9e.caption\n",
43
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\6d8f57a3f0840b9fa5ff41cdae43ab01.caption\n",
44
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\6e073e3085e29e59f28e6984ac7663cc.caption\n",
45
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\7b939d638f70a638264b5b8eec3a6591.caption\n",
46
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\7c4c7e4f15a953c992d6435b36a815d4.caption\n",
47
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\7fd38428a8469124bf5f16055b68250b.caption\n",
48
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\847c60b16de80a7b4342111529502ed4.caption\n",
49
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\9afb78386c656d87d64f1d5635b34bf9.caption\n",
50
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\9e595a406ca31b7dc7c6be378c7448a4.caption\n",
51
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\9f7f1934ef62891808833802d78c51c9.caption\n",
52
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\a37c81dfb67551a0c0820d5a383cf7c4.caption\n",
53
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\ad7127ddca55e8d8c3958bc58a05685e.caption\n",
54
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b006b2e9995048da2fb6e328ee6cfcd8.caption\n",
55
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b27e0b7a5b4aa581da036792143046c4.caption\n",
56
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b3a55669d7f945c451358defda612e08.caption\n",
57
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b40f8b2fa0e877f8af8488953392cd30.caption\n",
58
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\bb5147e35feead82c04b03a84f07c144.caption\n",
59
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\c06c3afbd6e2ff687410eb37a3b16bcd.caption\n",
60
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\c16face7295c8333cac893ff62ba291c.caption\n",
61
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\c9c47f239426a6b5173f2c40fc678468.caption\n",
62
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\ca2edfcc56081be6c707b4c130941aaa.caption\n",
63
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\d5aa8f4d3ca3a45648b8bf2d8a3295c7.caption\n",
64
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\d9af3b50bd80b46c0436ac2b3d16d94b.caption\n",
65
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\dcc6b617c9d02b58ee7c97de5c9be7cb.caption\n",
66
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e32fbf97383c0d49f278b6d15c46dc25.caption\n",
67
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e6e23b1a04939a54a40c685e4b8616c8.caption\n",
68
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e76626932ef295c86180406b7a0d7030.caption\n",
69
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e791abb184a749ded632ec67dadaa852.caption\n",
70
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e80dc2531447d773540fe485d9bc26a5.caption\n",
71
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e89a1538e6332b45c11de5c76ff567f8.caption\n",
72
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\ed20a06beef0a0ae0fee6ea52eca6998.caption\n",
73
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f33c2d22a0ea5c0e3aecbbc641b66707.caption\n",
74
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f43c0d4787a957096e96a253c3f88f99.caption\n",
75
+ "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f6d85112d49064be65f1e5a2da898ee5.caption\n"
76
+ ]
77
+ }
78
+ ],
79
+ "source": [
80
+ "import os\n",
81
+ "\n",
82
+ "def remove_commas_from_caption_files(directory):\n",
83
+ " for root, dirs, files in os.walk(directory):\n",
84
+ " for file in files:\n",
85
+ " if file.endswith('.caption'):\n",
86
+ " filepath = os.path.join(root, file)\n",
87
+ " try:\n",
88
+ " with open(filepath, 'r') as f:\n",
89
+ " lines = f.readlines()\n",
90
+ " with open(filepath, 'w') as f:\n",
91
+ " for line in lines:\n",
92
+ " f.write(line.replace(',', ''))\n",
93
+ " print(f\"Removed commas from {filepath}\")\n",
94
+ " except Exception as e:\n",
95
+ " print(f\"Error processing file {filepath}: {e}\")\n",
96
+ "\n",
97
+ "if __name__ == \"__main__\":\n",
98
+ " directory = r'C:\\Users\\kade\\Desktop\\training_dir_staging'\n",
99
+ " remove_commas_from_caption_files(directory)"
100
+ ]
101
+ }
102
+ ],
103
+ "metadata": {
104
+ "kernelspec": {
105
+ "display_name": "base",
106
+ "language": "python",
107
+ "name": "python3"
108
+ },
109
+ "language_info": {
110
+ "codemirror_mode": {
111
+ "name": "ipython",
112
+ "version": 3
113
+ },
114
+ "file_extension": ".py",
115
+ "mimetype": "text/x-python",
116
+ "name": "python",
117
+ "nbconvert_exporter": "python",
118
+ "pygments_lexer": "ipython3",
119
+ "version": "3.12.2"
120
+ }
121
+ },
122
+ "nbformat": 4,
123
+ "nbformat_minor": 2
124
+ }