Upload 11 files
Browse files- filtered_posts_00.parquet +2 -2
- filtered_posts_01.parquet +2 -2
- filtered_posts_02.parquet +2 -2
- filtered_posts_03.parquet +2 -2
- filtered_posts_04.parquet +2 -2
- filtered_posts_05.parquet +2 -2
- filtered_posts_06.parquet +2 -2
- filtered_posts_07.parquet +2 -2
- filtered_posts_08.parquet +2 -2
- filtered_posts_09.parquet +2 -2
- filtering_posts.py +7 -3
filtered_posts_00.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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 |
-
"
|
| 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,
|
| 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 |
|