jupo-ai commited on
Commit
58c86aa
·
verified ·
1 Parent(s): f6d6600

Upload 11 files

Browse files
filtered_posts_00.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a20649a82cd216ed29f099db0592acc4f82bbfb3aefcd75cd2fce2d02f87bcb7
3
- size 139855430
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ecaa392fe5bb4016059ff205f75fa0819cca40bff9db7b53c17da1a5680e4f08
3
+ size 124794808
filtered_posts_01.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5a9ac9231ff264623c4eec5e579336bd652dd2faaf7057ac4c9ded612884e150
3
- size 150317853
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2cb4ed571791732a1cf5450fd471636195fd6feab871be8a27791a88e9004ae
3
+ size 136037536
filtered_posts_02.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bdfea4d7939984b71ae8cbd9cc86279263ada7bbb2a1449c0c81f527d6dc973a
3
- size 174731307
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c68b1d60817219177769b7f8a353c5ccc4b273bf6775ba65fdccae66f530bc8e
3
+ size 159366747
filtered_posts_03.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8f5d5263c64340eac0f0c5f0f4f39b9f51b90bc1ec82a6c8f711744e6ade1f1b
3
- size 188514338
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02dc7f03e9b563bae847d8be72618b1472d18b13175c85aa8023f15671d45b01
3
+ size 173072594
filtered_posts_04.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0d70d9ec0be4e7bc0d5366f6b075b9ee828c5ced4e12006f11c8626ce6dc6f75
3
- size 187978429
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d2fba212a2d808483e7ea27a9fb005f5002413845ddd860c8c31a0845b49d17
3
+ size 173352082
filtered_posts_05.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eb8b50d9b3e3962994cb1424bdc113b47a4e20d7b7ae870df7f4b2bf547b77ef
3
- size 191133878
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e44f6698d73903f55bba0617a43afe83bdd05425e0789e0525b7b877befe0a0
3
+ size 177758097
filtered_posts_06.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:78b7bd09399e96688ad4bc17d5788cb238743bc4076067d94dc180c8181f7c05
3
- size 196892555
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5923c80044d8ab312a8f2cb4af56c9199430eac7258d91b5b6cc2a92430aa1b2
3
+ size 183783563
filtered_posts_07.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:26d7a22325720122070be348d3bdf9126575283d831ab973c09b1f9d97ef49a8
3
- size 197269344
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7aa50c6e2027ea8fa555f2e6832ee7eee913db76e1ae8894bfd98f4a75801766
3
+ size 184374813
filtered_posts_08.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:469a685e81a8079be79aafd74df3e86edf00a2575998fc378f36f5401196180a
3
- size 196729347
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:084cb2a7a8090ebbc02f0788512347c10ef66b6e78de5270ef9b2fcae3555ced
3
+ size 184127656
filtered_posts_09.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e93577a8598288bfeaf8fa7596c7b8260576437366c524f2e06f539d5545ca2e
3
- size 190839401
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05165bd1409208613269cc963096f2a66b6e8877f2a315ebb8ec1a3f812f1368
3
+ size 177839956
filtering_posts.py CHANGED
@@ -23,6 +23,7 @@ MIN_TAG_COUNT = 5
23
  # フィルタリングに必要なカラム
24
  NEED_COLUMNS = [
25
  "id",
 
26
  "md5",
27
  "score",
28
  "rating",
@@ -51,7 +52,7 @@ TAG_COLUMNS = [
51
  # 出力時に必要なカラム
52
  OUTPUT_COLUMNS = [
53
  "id",
54
- "md5",
55
  "score",
56
  "rating",
57
  "image_width",
@@ -61,9 +62,12 @@ OUTPUT_COLUMNS = [
61
  "tag_string_general",
62
  "tag_string_character",
63
  "tag_string_copyright",
 
64
  "file_url",
65
  ]
66
 
 
 
67
  console = Console()
68
 
69
 
@@ -122,7 +126,7 @@ def build_filter_mask(data: pd.DataFrame, ban_tag_pattern: re.Pattern[str] | Non
122
 
123
  def filter_posts(data: pd.DataFrame, ban_tag_pattern: re.Pattern[str] | None) -> pd.DataFrame:
124
  mask = build_filter_mask(data, ban_tag_pattern)
125
- return data.loc[mask, OUTPUT_COLUMNS].reset_index(drop=True)
126
 
127
 
128
  def filter_post_file(path: Path, ban_tag_pattern: re.Pattern[str] | None) -> tuple[pd.DataFrame, int, int]:
@@ -155,7 +159,7 @@ def save_split_files(data: pd.DataFrame, part_count: int) -> list[tuple[Path, in
155
 
156
  for index, (start, end) in enumerate(split_ranges(len(data), part_count)):
157
  output_path = OUTPUT_DIR / f"filtered_posts_{index:0{digits}d}.parquet"
158
- part = data.iloc[start:end].reset_index(drop=True)
159
  part.to_parquet(output_path, index=False)
160
  outputs.append((output_path, len(part)))
161
 
 
23
  # フィルタリングに必要なカラム
24
  NEED_COLUMNS = [
25
  "id",
26
+ "created_at",
27
  "md5",
28
  "score",
29
  "rating",
 
52
  # 出力時に必要なカラム
53
  OUTPUT_COLUMNS = [
54
  "id",
55
+ "created_at",
56
  "score",
57
  "rating",
58
  "image_width",
 
62
  "tag_string_general",
63
  "tag_string_character",
64
  "tag_string_copyright",
65
+ "tag_string_artist",
66
  "file_url",
67
  ]
68
 
69
+ INTERNAL_COLUMNS = ["md5", *OUTPUT_COLUMNS]
70
+
71
  console = Console()
72
 
73
 
 
126
 
127
  def filter_posts(data: pd.DataFrame, ban_tag_pattern: re.Pattern[str] | None) -> pd.DataFrame:
128
  mask = build_filter_mask(data, ban_tag_pattern)
129
+ return data.loc[mask, INTERNAL_COLUMNS].reset_index(drop=True)
130
 
131
 
132
  def filter_post_file(path: Path, ban_tag_pattern: re.Pattern[str] | None) -> tuple[pd.DataFrame, int, int]:
 
159
 
160
  for index, (start, end) in enumerate(split_ranges(len(data), part_count)):
161
  output_path = OUTPUT_DIR / f"filtered_posts_{index:0{digits}d}.parquet"
162
+ part = data.iloc[start:end].loc[:, OUTPUT_COLUMNS].reset_index(drop=True)
163
  part.to_parquet(output_path, index=False)
164
  outputs.append((output_path, len(part)))
165