chungimungi commited on
Commit
0fcf8aa
·
verified ·
1 Parent(s): 975ce32

Upload 2 files

Browse files
.gitattributes CHANGED
@@ -53,3 +53,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
+ arxiv-metadata-oai-snapshot.json filter=lfs diff=lfs merge=lfs -text
arxiv-metadata-oai-snapshot.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:414cf4bd956183fc08e6855634b3a7f4754e24eabb2294be1f2dd52485b13bbd
3
+ size 4242818654
categories.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from tqdm import tqdm
3
+
4
+ _CATEGORIES = "categories"
5
+
6
+ def get_unique_categories(json_file_path):
7
+ categories = set()
8
+
9
+ with open(json_file_path, encoding="utf8") as f:
10
+ for entry in tqdm(f, desc="Processing papers"):
11
+ data = json.loads(entry)
12
+ if _CATEGORIES in data:
13
+ categories.update(data[_CATEGORIES].split())
14
+
15
+ return categories
16
+
17
+ def save_unique_categories(categories, output_file_path):
18
+ categories_list = sorted(categories)
19
+
20
+ with open(output_file_path, 'w', encoding='utf8') as f:
21
+ json.dump(categories_list, f, ensure_ascii=False, indent=4)
22
+
23
+ json_file_path = 'arxiv-metadata-oai-snapshot.json'
24
+ output_file_path = 'categories.json'
25
+
26
+ unique_categories = get_unique_categories(json_file_path)
27
+
28
+ save_unique_categories(unique_categories, output_file_path)
29
+
30
+ print(f"Unique categories saved to {output_file_path}")