jonsaadfalcon commited on
Commit
64d4080
1 Parent(s): 5f084e3

updated lotte_passages.py

Browse files
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
Generate_JSON_From_Collection_TSV.py CHANGED
@@ -10,6 +10,30 @@ for directory in directories:
10
 
11
  for file_type in ["dev", "test"]:
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  current_jsonl = []
14
  loaded_file = pd.read_csv('data/' + directory + "/" + file_type + "/collection.tsv", sep='\t', header=0)
15
 
@@ -17,6 +41,7 @@ for directory in directories:
17
 
18
  current_jsonl.append({
19
  "doc_id": row,
 
20
  "text": loaded_file.iloc[row][1]
21
  })
22
 
@@ -25,4 +50,4 @@ for directory in directories:
25
  os.mkdir(directory)
26
 
27
  with open(directory + "/" + file_type + "_collection.jsonl", 'w', encoding="utf-8") as fout:
28
- json.dump(current_jsonl, fout)
 
10
 
11
  for file_type in ["dev", "test"]:
12
 
13
+ if directory != 'pooled':
14
+
15
+ with open('data/' + directory + "/" + file_type + "/metadata.jsonl", 'r', encoding="utf-8") as json_file:
16
+ metadata = list(json_file)
17
+
18
+ post_id_to_author = {}
19
+
20
+ for json_str in metadata:
21
+ current_row = json.loads(json_str)
22
+ current_post_ids = current_row['post_ids']
23
+ current_post_authors = current_row['post_authors']
24
+
25
+ for post_id, author in zip(current_post_ids, current_post_authors):
26
+ post_id_to_author[post_id] = author
27
+
28
+ else:
29
+
30
+ from collections import defaultdict
31
+ def default_value():
32
+ return ""
33
+ post_id_to_author = defaultdict(default_value)
34
+
35
+ #####################################################################################
36
+
37
  current_jsonl = []
38
  loaded_file = pd.read_csv('data/' + directory + "/" + file_type + "/collection.tsv", sep='\t', header=0)
39
 
 
41
 
42
  current_jsonl.append({
43
  "doc_id": row,
44
+ "author": post_id_to_author[row],
45
  "text": loaded_file.iloc[row][1]
46
  })
47
 
 
50
  os.mkdir(directory)
51
 
52
  with open(directory + "/" + file_type + "_collection.jsonl", 'w', encoding="utf-8") as fout:
53
+ json.dump(current_jsonl, fout)
lifestyle/dev_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4a5d305409daa32284513c89cd99ac4afdd493d07190ebed83f74a4939c853dc
3
- size 266736700
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:619ca034d86e28d11de74e5e17a1d7807af0dc4f846a4ee9c4b17a9a002192a5
3
+ size 273115383
lifestyle/test_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:254628d946391417e44ccf7fccc21eebf8d51ce31a38a34e1f3d93001d1cdd76
3
- size 107371473
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2c24cb284eb333d507c0157f44bc7a4a4a23a5f61104900f7405ec1a80f499c
3
+ size 110087236
lotte_passages.py CHANGED
@@ -118,6 +118,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
118
  features = datasets.Features(
119
  {
120
  "doc_id": datasets.Value("int32"),
 
121
  "text": datasets.Value("string")
122
  }
123
  )
@@ -170,10 +171,16 @@ class NewDataset(datasets.GeneratorBasedBuilder):
170
 
171
  data = json.loads(row)
172
 
 
 
 
 
 
173
  for i in range(0, len(data)):
174
 
175
  current_query = data[i]
176
  yield i, {
177
  "doc_id": current_query["doc_id"],
 
178
  "text": current_query["text"]
179
  }
 
118
  features = datasets.Features(
119
  {
120
  "doc_id": datasets.Value("int32"),
121
+ "author": datasets.Value("string"),
122
  "text": datasets.Value("string")
123
  }
124
  )
 
171
 
172
  data = json.loads(row)
173
 
174
+ if "author" in data.keys():
175
+ author = data['author']
176
+ else:
177
+ author = ""
178
+
179
  for i in range(0, len(data)):
180
 
181
  current_query = data[i]
182
  yield i, {
183
  "doc_id": current_query["doc_id"],
184
+ "author": author,
185
  "text": current_query["text"]
186
  }
pooled/dev_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:368e4048792e9b3a5184b7daeed9337239643bcec86757e36db907ea6ff059db
3
- size 2327571649
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e651af583a16f146b993af4733eda74dd1a0777636eeb0388f006e50eefdb828
3
+ size 2361574331
pooled/test_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:55ed2ef7c978b896de8e2e1e7907066f115c2fe262e7555836fa26a76b510c7f
3
- size 2474114422
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bdb6e16daf375beccbdfd53dfde44f92075336efab349f0d95c21f815e679968
3
+ size 2513579386
recreation/dev_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9711aeaba3b75ac3025efa4c60c148d9881552231ba44bb49e5a9eb826cb97af
3
- size 353181123
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97010c6392f711981b383aac04812ae99e8e5dfcfc081e5bfb1079e2febc86dc
3
+ size 359239511
recreation/test_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fc4a91d3b46fe7128f3e36a656b209750c3db95b7b1d6f527f7df8faaa9ca569
3
- size 136354177
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a34f8fc11db7686513c1aa392e739a0d2257f8827f0218a1c3e17bc12c0a36c
3
+ size 140143137
science/dev_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:30de2c53db0c1f8f6aaee0332c1de49bce89687ff6ac74db37cd354037407d18
3
- size 432326329
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e2e304469c6d648b179ac44ab3b9ca9c5ff5a5ffc36fd5e7e6fee822ef38af2
3
+ size 440384983
science/test_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6dbc6623035435f12372f7c35bc085b5608a471348851a09b5d23dea37929dd5
3
- size 1503760616
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e112805fd1a913e8bc6b92c4bd0e66d94bbf305b9e9bdc9849bb0bac7865b48c
3
+ size 1544428860
technology/dev_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9a5146425bafd87bfa4ff2e3ce05196a2891cd0d032fc4097ac59f5d10366d08
3
- size 928423308
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f33ecbe2251ead8b33a9a0449aa6278aace83398077def869b9f6da6ad4ff40e
3
+ size 958027334
technology/test_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2208bfe52868acbe12fd177ad2097781304cc5e452d784bd21ea6eb54ff08343
3
- size 574848188
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:756c60bab5e592ebe42987dce49097258a43823be97cc55215210ff5be2120b1
3
+ size 589800516
writing/dev_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:90e8253381a9fc79c1f0c4dbd7195c63e5b38c6e3f1ed951cb46d9b0e2106973
3
- size 345304389
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b25776b4ab686ca008fc3629f4f768c8ddc4702f92a3333394589e437c516d9
3
+ size 351804833
writing/test_collection.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9852ae617146df70a852d44cb1da7f5eb74e1caf463779c430a4da715db47196
3
- size 150208971
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0af85f7136f1b9877c8fd844b21e7e6e5e3eacfb50617b6a4d139a2bcdadc04
3
+ size 154837799