Skip to content

Commit e06ee52

Browse files
authored
Update proactive_classifier.py
1 parent 65e191c commit e06ee52

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

models/proactive_classifier.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ def __getitem__(self, idx):
154154
with open('train.jsonl') as f:
155155
for line in f:
156156
d = json.loads(line)
157-
for i in range(len(d['thread'])):
157+
for i in range(len(d['thread']) - 1): # Exclude the last item
158158
d_sub = d.copy()
159-
d_sub['thread'] = d_sub['thread'][:i+1]
159+
d_sub['thread'] = d_sub['thread'][:i] # Exclude item at index i
160160
doc = prepare_query(d_sub, turns_max_tokens=300, title_max_tokens=30, post_max_tokens=100)
161-
label = 1 if len(d_sub['thread'][-1]['wiki_links']) > 0 else 0
161+
label = 1 if len(d['thread'][i]['wiki_links']) > 0 else 0 # Label based on next item
162162
docs.append(doc)
163163
labels.append(label)
164164
limit -= 1

0 commit comments

Comments
 (0)