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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d0191263",
   "metadata": {},
   "outputs": [],
   "source": [
    "#load in metadata.jsonl file to view it\n",
    "import json\n",
    "import jsonlines\n",
    "import pandas as pd\n",
    "import os\n",
    "import numpy as np\n",
    "\n",
    "# Load the metadata.jsonl file\n",
    "with jsonlines.open('metadata.jsonl') as reader:\n",
    "    metadata = [obj for obj in reader]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6820d40d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>task_id</th>\n",
       "      <th>Question</th>\n",
       "      <th>Level</th>\n",
       "      <th>Final answer</th>\n",
       "      <th>file_name</th>\n",
       "      <th>Annotator Metadata</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>c61d22de-5f6c-4958-a7f6-5e9707bd3466</td>\n",
       "      <td>A paper about AI regulation that was originall...</td>\n",
       "      <td>2</td>\n",
       "      <td>egalitarian</td>\n",
       "      <td></td>\n",
       "      <td>{'Steps': '1. Go to arxiv.org and navigate to ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>17b5a6a3-bc87-42e8-b0fb-6ab0781ef2cc</td>\n",
       "      <td>I’m researching species that became invasive a...</td>\n",
       "      <td>2</td>\n",
       "      <td>34689</td>\n",
       "      <td></td>\n",
       "      <td>{'Steps': '1. Search the web for “finding nemo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>04a04a9b-226c-43fd-b319-d5e89743676f</td>\n",
       "      <td>If we assume all articles published by Nature ...</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td></td>\n",
       "      <td>{'Steps': '1. Find how many articles were publ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>14569e28-c88c-43e4-8c32-097d35b9a67d</td>\n",
       "      <td>In Unlambda, what exact charcter or text needs...</td>\n",
       "      <td>2</td>\n",
       "      <td>backtick</td>\n",
       "      <td></td>\n",
       "      <td>{'Steps': '1. Searched \"Unlambda syntax\" onlin...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>e1fc63a2-da7a-432f-be78-7c4a95598703</td>\n",
       "      <td>If Eliud Kipchoge could maintain his record-ma...</td>\n",
       "      <td>1</td>\n",
       "      <td>17</td>\n",
       "      <td></td>\n",
       "      <td>{'Steps': '1. Googled Eliud Kipchoge marathon ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                task_id  \\\n",
       "0  c61d22de-5f6c-4958-a7f6-5e9707bd3466   \n",
       "1  17b5a6a3-bc87-42e8-b0fb-6ab0781ef2cc   \n",
       "2  04a04a9b-226c-43fd-b319-d5e89743676f   \n",
       "3  14569e28-c88c-43e4-8c32-097d35b9a67d   \n",
       "4  e1fc63a2-da7a-432f-be78-7c4a95598703   \n",
       "\n",
       "                                            Question  Level Final answer  \\\n",
       "0  A paper about AI regulation that was originall...      2  egalitarian   \n",
       "1  I’m researching species that became invasive a...      2        34689   \n",
       "2  If we assume all articles published by Nature ...      2           41   \n",
       "3  In Unlambda, what exact charcter or text needs...      2     backtick   \n",
       "4  If Eliud Kipchoge could maintain his record-ma...      1           17   \n",
       "\n",
       "  file_name                                 Annotator Metadata  \n",
       "0            {'Steps': '1. Go to arxiv.org and navigate to ...  \n",
       "1            {'Steps': '1. Search the web for “finding nemo...  \n",
       "2            {'Steps': '1. Find how many articles were publ...  \n",
       "3            {'Steps': '1. Searched \"Unlambda syntax\" onlin...  \n",
       "4            {'Steps': '1. Googled Eliud Kipchoge marathon ...  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Convert the list of dictionaries to a DataFrame\n",
    "df = pd.DataFrame(metadata)\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "9b7659b2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Steps': '1. Search the web for “finding nemo main character”.\\n2. Note the results, which state that the main character is a clownfish.\\n3. Search the web for “usgs nonnative species database”.\\n4. Click result for the Nonindigenous Aquatic Species site.\\n5. Click “Marine Fishes”.\\n6. Click “Species List of Nonindigenous Marine Fish”.\\n7. Scroll through the list until I find the clown anenomefish, and click “Collection info”.\\n8. Note the place that a clown anenomefish was found, in Fred Howard Park at the Gulf of Mexico.\\n9. Search the web for “fred howard park florida zip code”.\\n10. Note the zip code, 34689. Since only one clownfish was found before the year 2020, this is the answer.',\n",
       " 'Number of steps': '10',\n",
       " 'How long did this take?': '5 minutes',\n",
       " 'Tools': '1. Search engine\\n2. Web browser',\n",
       " 'Number of tools': '2'}"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#convert metadata into dataframe and view the annotator column\n",
    "df = pd.DataFrame(metadata)\n",
    "df.head()\n",
    "df['Annotator Metadata'][1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "73c7bbaa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "In July 2, 1959 United States standards for grades of processed fruits,\n",
      "vegetables, and certain other products listed as dehydrated, consider the items\n",
      "in the \"dried and dehydrated section\" specifically marked as dehydrated along\n",
      "with any items in the Frozen/Chilled section that contain the whole name of the\n",
      "item, but not if they're marked Chilled. As of August 2023, what is the\n",
      "percentage (to the nearest percent) of those standards that have been superseded\n",
      "by a new version since the date given in the 1959 standards?\n"
     ]
    }
   ],
   "source": [
    "#print the question and answer for the 11th row, print it out in wrapped text.\n",
    "import textwrap\n",
    "print(textwrap.fill(df['Question'][10], width=80))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "f30fb061",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Steps': '1. Search the web for \"PDB ID 5wb7\"\\n2. Navigate to https://www.rcsb.org/structure/5wb7 from the search results page\\n3. Download the PDB file from the landing page.\\n4. Process the PDB file using Python and Biopython to calculate the distance between the first two atoms listed in the file. (1.4564234018325806 Å)\\nfrom Bio.PDB import PDBParser\\nparser = PDBParser()\\nstructure = parser.get_structure(\"5wb7\", \"5wb7.pdb\")\\nfor atom in structure.get_atoms():\\n    atom1 = atom\\n    break\\nfor atom in structure.get_atoms():\\n    if atom != atom1:\\n        atom2 = atom\\n        break\\ndistance = atom1 - atom2\\nprint(f\"{distance}\")\\n5. Round the result to the nearest picometer (1.456)',\n",
       " 'Number of steps': '5',\n",
       " 'How long did this take?': '45 minutes',\n",
       " 'Tools': '1. Web browser\\n2. Search engine\\n3. File handling\\n4. Python\\n5. Calculator ',\n",
       " 'Number of tools': '5'}"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Annotator Metadata'][11]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "54bf634a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Extract all tools from Annotator Metadata\n",
    "all_tools = []\n",
    "for entry in metadata:\n",
    "    tools = entry['Annotator Metadata']['Tools'].split('\\n')\n",
    "    # Remove numbering and leading/trailing whitespace from each tool\n",
    "    tools = [t.split('. ')[-1].strip() for t in tools]\n",
    "    all_tools.extend(tools)\n",
    "\n",
    "# Count unique tools\n",
    "tool_counts = pd.Series(all_tools).value_counts()\n",
    "#print out the top 10 tools with counts greater than 5 as a DataFrame\n",
    "tool_counts_df = tool_counts.reset_index()\n",
    "tool_counts_df.columns = ['Tool', 'Count']\n",
    "tool_counts_df = tool_counts_df.sort_values(by='Count', ascending=False)\n",
    "# print out unique tool names\n",
    "# Save the tool counts to a CSV file\n",
    "tool_counts_df.to_csv('tool_counts.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "1f0a65e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Web browser',\n",
       " 'Search engine',\n",
       " 'Calculator',\n",
       " 'Image recognition tools',\n",
       " 'search engine',\n",
       " 'None',\n",
       " 'web browser',\n",
       " 'A search engine',\n",
       " 'A web browser',\n",
       " 'PDF viewer',\n",
       " 'PDF access']"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tool_counts_df.Tool[tool_counts_df.Count > 5].values.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "a6f475af",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Tool</th>\n",
       "      <th>Count</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Web browser</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Search engine</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Calculator</td>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Image recognition tools</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>search engine</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>Wikipedia</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>Video capability</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>Image processing tools</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>Image recognition software</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>YouTube</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>93 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                          Tool  Count\n",
       "0                  Web browser     95\n",
       "1                Search engine     88\n",
       "2                   Calculator     30\n",
       "3      Image recognition tools     11\n",
       "4                search engine      9\n",
       "..                         ...    ...\n",
       "88                   Wikipedia      1\n",
       "89            Video capability      1\n",
       "90      Image processing tools      1\n",
       "91  Image recognition software      1\n",
       "92                     YouTube      1\n",
       "\n",
       "[93 rows x 2 columns]"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tool_counts_df"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "hf_agent",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}