{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "9faa2600", "metadata": {}, "outputs": [], "source": [ "import json\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "f1475719", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
questiondataset
0Is our average employee older than 35?066_IBM_HR
1Is the most frequent travel value rarely trave...066_IBM_HR
2Is the highest DailyRate equal to 1499?066_IBM_HR
3Is the highest DailyRate negative?066_IBM_HR
4Is our research dept bigger than sales?066_IBM_HR
\n", "
" ], "text/plain": [ " question dataset\n", "0 Is our average employee older than 35? 066_IBM_HR\n", "1 Is the most frequent travel value rarely trave... 066_IBM_HR\n", "2 Is the highest DailyRate equal to 1499? 066_IBM_HR\n", "3 Is the highest DailyRate negative? 066_IBM_HR\n", "4 Is our research dept bigger than sales? 066_IBM_HR" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "semeval_test_qa = pd.read_csv(\"test_qa.csv\")\n", "semeval_test_qa.head()" ] }, { "cell_type": "code", "execution_count": 3, "id": "ed8af27b", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "e7ae0b3927e04128b61059a6f4de6bf1", "version_major": 2, "version_minor": 0 }, "text/plain": [ "tokenizer_config.json: 0%| | 0.00/1.25k [00:00\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
questiondatasetpredicted_type
0Is our average employee older than 35?066_IBM_HRboolean
1Is the most frequent travel value rarely trave...066_IBM_HRboolean
2Is the highest DailyRate equal to 1499?066_IBM_HRboolean
3Is the highest DailyRate negative?066_IBM_HRboolean
4Is our research dept bigger than sales?066_IBM_HRboolean
............
517List the titles of books with fewer than 200 p...080_Bookslist[category]
518List the categories of books with ratings abov...080_Bookslist[category]
519List the authors of books with more than 10 re...080_Bookslist[category]
520List the 5 categories of the last five books i...080_Bookslist[category]
521List the editions of books in the 'Business, I...080_Bookslist[category]
\n", "

522 rows × 3 columns

\n", "" ], "text/plain": [ " question dataset \\\n", "0 Is our average employee older than 35? 066_IBM_HR \n", "1 Is the most frequent travel value rarely trave... 066_IBM_HR \n", "2 Is the highest DailyRate equal to 1499? 066_IBM_HR \n", "3 Is the highest DailyRate negative? 066_IBM_HR \n", "4 Is our research dept bigger than sales? 066_IBM_HR \n", ".. ... ... \n", "517 List the titles of books with fewer than 200 p... 080_Books \n", "518 List the categories of books with ratings abov... 080_Books \n", "519 List the authors of books with more than 10 re... 080_Books \n", "520 List the 5 categories of the last five books i... 080_Books \n", "521 List the editions of books in the 'Business, I... 080_Books \n", "\n", " predicted_type \n", "0 boolean \n", "1 boolean \n", "2 boolean \n", "3 boolean \n", "4 boolean \n", ".. ... \n", "517 list[category] \n", "518 list[category] \n", "519 list[category] \n", "520 list[category] \n", "521 list[category] \n", "\n", "[522 rows x 3 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# 🚀 Get Model Predictions (`y_pred`)\n", "semeval_test_qa['predicted_type'] = classify(semeval_test_qa['question'].to_list())\n", "semeval_test_qa" ] }, { "cell_type": "code", "execution_count": 5, "id": "d5f88e3e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Answers: ['True', 'True', 'True', 'False', 'True', 'True', 'True', 'True', 'True', 'Sales Executive', 'Sales', 'Divorced', 'Life Sciences', 'Travel_Rarely', 'Male', '3', 'Human Resources', '36.92', '9.0', '40.0', '4919.0', '13513', '11.10', '446.0', '15.0', '15.0', '[4, 3]', '[1009, 1051, 1052, 1081, 1091]', '[2, 1, 4, 3, 5]', '[25, 25, 25, 25, 25]', '[35, 34, 36, 31, 29]', \"['Sales Executive', 'Research Scientist', 'Laboratory Technician']\", \"['Research & Development', 'Sales']\", \"['Single', 'Married', 'Divorced']\", \"['Life Sciences', 'Other', 'Medical', 'Marketing', 'Technical Degree', 'Human Resources']\", \"['Travel_Rarely', 'Travel_Frequently', 'Non-Travel']\", \"['No', 'Yes']\", '[1, 2, 3, 4]', '[1, 2, 3]', 'True', 'True', 'True', '15132', 'True', 'False', 'False', 'False', 'True', 'True', '2012', '3.92', '5', '0', 'charlietrisj', '806.7501', '20000.0', '66.0', '1.1509', '12592', '2002', '1', '23020', '[2012, 2011, 2010, 2009]', '[66, 52, 47, 44, 43]', \"['Manny S', 'David S','ZP83','palmsprings0']\", \"['Manny S']\", '[3523356, 3236579, 3235844, 3235844, 3235844]', \"['2012', '2011', '2010', '2009']\", 'True', 'False', 'True', 'True', 'True', 'True', 'True', 'Request for Quotations', 'SOUTH ASIA', \"Lao People's Democratic Republic\", 'Civil Works', 'EUROPE AND CENTRAL ASIA', 'India', 'Agriculture, Fishing and Forestry', '812960107.83', '9.0', '239461.0', '530724.5038668092', '427.0', '5652503.36', '27051', '[812960107.83, 616609217.47, 577047623.48]', 'True', '[427.0, 832.0, 1418.0, 2530.0, 3058.0 ]', '[2021, 2022, 2023]', '[15925264883.9, 13321977331.02, 13505690141.88]', '[100000.05, 100005.34]', '[321127567.87, 306306411.37, 253905847.27, 180832613.5]', \"['India', 'Western and Central Africa', 'Ethiopia', 'Madagascar', 'Bolivia']\", \"['SOUTH ASIA', 'Western and Central Africa', 'Eastern and Southern Africa', 'LATIN AMERICA AND CARIBBEAN']\", \"['Request for Bids', 'Individual Consultant Selection', 'Request for Quotations', 'Direct Selection']\", \"['Ghana', 'World', 'Burkina Faso', 'Nigeria']\", \"['Post', 'Prior']\", \"['Post', 'Prior']\", 'True', 'True', 'False', 'True', 'True', 'True', 'True', 'False', 'Business and Finance', 'Business and Finance', 'Sports', 'Sports', '483', 'Commercial Trucks', 'Attractions', '703', '34', '85', '316', '40', '40', '8', 'True', '703', \"['483', '90', 'SPSHQ5']\", '[12, 41]', '[0, 0]', '[703, 663, 316, 60]', \"['Attractions', 'Automotive', 'Books and Literature']\", \"['Attractions', 'Automotive']\", \"['Amusement and Theme Parks', 'Bars & Restaurants', 'Casinos', 'Parks']\", \"['Attractions']\", \"['Attractions', 'Attractions', 'Attractions', 'Attractions']\", \"['150', '1', '2', '37']\", \"['150', '1', '2']\", 'True', 'True', 'True', 'True', 'True', 'False', 'True', 'True', 'Hacendado', 'Spain', 'No gluten', '263', 'Hacendado', 'kiliweb', '8329', '29', '5423', '3420', '9102', '9483', '1913', '[00001522, 8480000041968, 8480000041975, 8480000046444, 8480000230058, 8480000865274, 8480000707000]', \"['Seitán a la plancha' ,'Seitán a la piastra' ,'Hamburguesa de seitán' ,'Seitán a la plancha' ,'Seitán' ,'Seitan' ,'Seitán a la plancha']\", \"['No gluten', 'Green Dot']\", \"['No gluten', 'Green Dot', 'No lactose', 'Vegetarian', 'Vegan']\", \"['Hacendado', 'Mercadona']\", '[4148, 3420]', \"['Spain', 'Portugal', 'France']\", '[9147, 186, 141]', 'True', 'True', 'True', 'True', 'True', 'True', 'True', 'True', 'Switzerland', 'Pakistan', 'Pakistan', 'Switzerland', 'Hong Kong (China)', 'Singapore', 'Barbados', '101.1', '46.5', '121.0', '44.22', '84.2', '72.1', '110.91', '3.0', '[46.5, 36.7, 39.2, 67.2, 19.0]', '[18.8, 20.4, 21.0, 21.2, 22.5]', '[158.7, 54.6, 120.3, 111.1, 43.5]', '[109.1, 88.4, 84.6]', '[97.0, 83.3, 86.8, 50.4, 69.4]', '[11.1, 12.7, 12.7, 12.8, 13.7]', '[99.4, 101.1, 102.4, 102.4, 102.8]', \"['Switzerland', 'Bahamas', 'Iceland', 'Singapore', 'Barbados']\", \"['Switzerland', 'Iceland', 'Hong Kong (China)']\", \"['Bangladesh', 'Pakistan', 'Nepal']\", \"['Australia', 'Austria', 'Canada', 'New Zealand', 'Ireland', 'France']\", \"['Luxembourg', 'Kuwait', 'Qatar', 'Switzerland', 'United States']\", \"['Bangladesh', 'Pakistan', 'Indonesia']\", 'True', 'True', 'True', 'True', 'True', 'True', 'True', 'True', '4.0', '4.0', '4.0', '2', '2.0', '4.5', '3.0', 'True', '340.0', '109.70', '162.0', '9.7', '1.5', '0.6048128003332054', '11854.0', '108.0', '[340, 340, 340, 340, 340]', '9', '42', '[120, 120, 120, 120, 120]', '[6.8, 7.2, 7.21, 7.23, 7.25]', '[5.0, 5.0, 5.0, 5.0, 5.0]', '[5.0, 5.0, 5.0, 5.0, 5.0]', '[120, 120, 120, 120, 120]', '[340, 340]', '[7.21, 7.28]', '[4, 5, 5, 5, 5]', '[1, 1, 2, 1, 1]', '[4.0, 4.5, 4.5, 4.0]', '[4.5, 5.0, 4.0, 4.5, 4.5]', '[2.0, 2.0, 3.0, 4.0, 2.0]', 'True', 'True', 'True', 'False', 'True', 'True', 'True', 'False', 'True', 'southeast', 'male', 'yes', 'southeast', 'male', 'True', '0', 'northeast', 'no', '53.13', '1.09', '4', '17755824.99', '18', '91', '274', '30.4', '[53.13, 52.58]', '[1163.46, 44501.39, 2438.05]', '[18, 18, 18, 18, 18]', '[18, 18, 18]', \"['yes', 'no']\", \"['southeast', 'southeast', 'southeast']\", 'True', 'True', 'False', 'True', 'False', 'True', 'True', 'True', 'True', '83 kg', '93 kg', 'Bench Press', '399.0', '10', '5', '5', '399', '399', 'Sarah Thomas', '258507.0', '100.0', '299.0', '10', '[399, 399, 399]', '[100, 100, 100, 100, 100]', '[88849, 88071, 87862, 83245, 81271]', '[46, 46, 46]', '[100, 100]', '[399, 399, 399]', \"['Emily Davis', 'Jessica Wilson', 'Jane Smith', 'Laura Taylor', 'Sarah Thomas']\", \"['Chris Brown', 'John Doe', 'Michael Johnson', 'Daniel Lee', 'Matthew Anderson']\", \"['93 kg', 'Open', '59 kg']\", \"['Laura Taylor', 'Sarah Thomas', 'Matthew Anderson', 'Jane Smith', 'Laura Taylor']\", \"['Deadlift', 'Bench Press', 'Squat']\", \"['Deadlift', 'Bench Press', 'Squat']\", 'False', 'False', 'True', 'True', 'False', 'False', 'False', 'False', 'HHS Region 04', 'Suicide', 'Male', 'Urban', 'HHS Region 04', '276.4', '0.1', '25', '22762.7', '0.640', '63.16', '10', '273.0', '[276.4, 266.4, 248.8, 246.0, 245.2]', '[0.1, 0.1, 0.1, 0.1, 0.1]', '[106.0, 106.7, 114.3, 115.1, 119.8]', '[1.4, 1.3, 1.3, 1.3]', '[0.4, 0.4, 0.4, 0.5, 0.5]', \"['Heart disease', 'Cancer', 'Lower respiratory', 'Unintentional injuries', 'Cerebrovascular diseases', 'Alzheimers', 'Diabetes', 'Flu and pneumonia', 'Suicide', 'Nephritis']\", \"['HHS Region 04', 'HHS Region 06', 'HHS Region 03']\", \"['Urban', 'Rural']\", 'True', 'False', 'True', 'False', 'True', 'True', 'True', 'True', 'Kevin Durant', 'Kevin Durant', 'GSW', 'Steve Nash', 'GSW', 'Greivis Vasquez', 'Ricky Rubio', '191', '1348034', '320686', '76.210', '82', '907', '0', '0', '269', '[1247, 1232, 1226]', '[907, 840, 839]', '[2818, 2593, 2558, 2376]', '[191, 177, 174]', '[269, 254, 242]', \"['Harrison Barnes', 'DeMar DeRozan', 'Jeff Green', 'P.J. Tucker', 'Andre Drummond']\", '[Andre Drummond, Nikola Vucevic, Rudy Gobert]', \"['GSW', 'LAC', 'BOS', 'MIL', 'MIA']\", '[GSW, MIL, BOS, OKC, DEN]', \"['Chris Paul', 'James Harden']\", \"['Hassan Whiteside', 'Victor Wembanyama', 'Serge Ibaka']\", \"['James Harden', 'Russell Westbrook', 'Rajon Rondo', 'Chris Paul']\", 'True', 'True', 'False', 'False', 'False', 'True', 'False', '42', 'True', '0', '19', '163.0', '2.0', '31.6', '126.0', '1.35', '29.25', '1012', '30', '90', '0.61', '5.09', '[196.0, 186.0, 180.0]', '[16.0, 17.0, 18.0, 19.0]', '[1, 2, 3, 4, 5, 6, 7, 8, 9]', '[49.0, 50.0, 55.0, 66.0, 61.0]', '[0, 1]', '[0, 1]', '[165.0, 180.0, 157.0, 167.0]', '[1,2,3,4,5,6,7,8,9]', '[17, 18, 19]', 'False', 'False', 'False', 'False', 'False', 'False', 'True', 'True', 'True', '1', '5', 'December', '11', 'Monday', 'January', '6', 'Thursday', '33.3', '0.4', '574.40', '7', '44.28', '852.7', '4.55', '247', '[33.3, 33.1, 32.6]', '[7.9, 9.3, 15.3, 15.5, 15.8]', '[2, 3, 4, 5, 6, 8, 9]', '[15, 15, 17, 18]', '[9.4, 9.4, 9.4, 9.4, 8.9]', '[6.995619625, 6.616439948, 5.633109621]', '[1.1, 2.4, 3.0]', '[January, February, March, April, May, June, July, August, September, October, November, December]', '[Monday, Thursday, Wednesday]', '[August, November]', '[Tuesday, Thursday, Saturday]', \"['December', 'August']\", \"['Wednesday', 'Monday']\", \"['Monday', 'Thursday', 'Saturday', 'Wednesday', 'Sunday', 'Friday', 'Tuesday']\", 'False', 'False', 'False', 'False', 'False', 'True', 'True', 'False', \"Hell's Kitchen\", 'Flavours', 'Sat', 'Premium Beans', 'Jun', '20', 'Lower Manhattan', 'Coffee', '8.0', '80.0', '698812.33', 'True', '3.38', '21096', '3', '360', '35352.0', '[8, 8, 8]', '[5, 8, 3]', '[0.8, 0.8, 0.8, 0.8]', '[360.0, 72.0, 56.0]', '[7, 1, 2, 3, 4, 5, 6]', '[\"Hell\\'s Kitchen\", \\'Astoria\\', \\'Lower Manhattan\\']', \"['Coffee beans', 'Branded']\", \"['Brewed Chai tea', 'Gourmet brewed coffee', 'Barista Espresso']\", \"['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']\", \"['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\", '[8, 3]', \"['Premium Beans', 'Premium Beans']\", 'Civet Cat', 'True', 'True', 'True', 'True', 'False', 'False', 'True', 'True', 'How to Win Friends and Influence People', 'Novel', '1000', '10', 'Ernest Hemingway', '80', 'BPB Publications (India)', '6', 'Islamic Books', '8', '14087', '5', '20.236', '9', '498', '2', '12', '37', '[498, 640, 80, 512, 492]', '[498, 640, 80, 512, 492]', '[73.0, 85.0, 50.0, 30.0]', '[492]', '[4, 6, 21, 38, 18]', '[5.0, 0.0, 27.0, 1.0, 40.0]', '[498]', '1', \"['History and Tradition', ' Business, Investment and Economics', 'Islamic Books', 'Islamic Books', 'Computer Science & Engineering']\", \"['Harish Bhat , B.S. Badan', 'Leil Lowndes', 'Dr. Joseph Murphy']\", \"['Madinah Arabic Reader 1', 'How Harsh Mariwala ?Groomed? Marico', 'Train to Pakistan', 'The Old Man and The Sea', 'Metamorphosis', 'Animal Farm', 'The Alchemist', 'Who Moved My Cheese?', 'The Art of War']\", \"['History and Tradition', ' Business, Investment and Economics', 'Novel', 'Novel', 'Novel', 'Novel', 'Novel', 'Novel', 'Self-help and meditation', 'Self-help and meditation', 'Self-help and meditation', 'Self-help and meditation', 'Self-help and meditation', 'Self-help and meditation', ' Mystery, Detective, Thriller and Adventure']\", \"['Yuval Noah Harari', 'Benjamin Graham', 'Khaled Hosseini', 'Ernest Hemingway', 'George Orwell', 'Chetan Bhagat', 'Dale Carnegie', 'Spencer Johnson', 'Napoleon Hill', 'Dr. Joseph Murphy', 'Jack Welch, Suzy Welch', 'J. K. Rowling']\", \"['Self-help and meditation', 'Self-help and meditation', 'Self-help and meditation', 'War Tactics and Foreign Policy', ' Mystery, Detective, Thriller and Adventure']\", \"['1st Edition', 'Edition', 'Edition', '1st Published']\"]\n", "Light Answers: ['True', 'True', 'False', 'False', 'True', 'True', 'True', 'True', 'True', 'Laboratory Technician', 'Sales', 'Divorced', 'Life Sciences', 'Travel_Frequently', 'Male', '3', 'Other', '35.65', '6.0', '25.0', '3183.0', '241', '19.5', '8.0', '8.0', '8.0', '[4, 3]', '[2028, 2090, 2426, 2661, 2670]', '[2, 1, 4, 3]', '[23, 22, 21, 20, 17]', '[38, 32, 29, 36, 22]', \"['Laboratory Technician', 'Research Scientist', 'Manufacturing Director']\", \"['Research & Development', 'Sales']\", \"['Single', 'Married', 'Divorced']\", \"['Life Sciences', 'Other', 'Medical']\", \"['Travel_Rarely', 'Travel_Frequently', 'Non-Travel']\", \"['No', 'Yes']\", '[1, 2, 3, 4]', '[1, 2, 3]', 'False', 'True', 'True', '15', 'True', 'False', 'False', 'False', 'True', 'False', '2012', '3.5', '5', '0', 'charlietrisj', '1241.05', '20.0', '5.0', '0.7999', '5463', '2004', '1', '16', '[2012, 2010, 2011, 2009]', '[5, 3, 2, 2, 1]', '[]', '[]', '[1164645, 643970, 281828, 262330, 258705]', \"['2011', '2012', '2010', '2009']\", 'False', 'False', 'False', 'False', 'True', 'True', 'False', 'Request for Quotations', 'Western and Central Africa', 'Micronesia, Federated States of', 'Consultant Services', 'Eastern and Southern Africa', 'Burkina Faso', 'Agriculture, Fishing and Forestry', '800433.3', '3.0', '20.0', '164490.6105', '477763.0', '224496.80', '13', '[800433.3, 716716.34, 369866.76]', 'True', '[477763.0, 552271.0, 754040.0, 783608.0, 841649.0]', '[2024, 2025, 2023]', '[13222.93, 2685156.49, 591432.79]', '[157840.9, 166464.39, 173560.0]', '[716716.34, 369866.76, 198952.48, 189088.46]', \"['Burkina Faso', 'Nigeria', 'Niger', 'Ethiopia', 'Somalia']\", \"['EAST ASIA AND PACIFIC', 'Eastern and Southern Africa', 'LATIN AMERICA AND CARIBBEAN', 'Western and Central Africa']\", \"['Request for Bids', 'Individual Consultant Selection', 'Request for Quotations', 'Consultant Qualification Selection']\", \"['Ghana', 'World', 'Burkina Faso', 'Nigeria']\", \"['Post', 'Prior']\", \"['Post', 'Prior']\", 'True', 'False', 'True', 'True', 'False', 'True', 'False', 'False', 'Attractions', 'Attractions', 'Automotive', 'Automotive', '150', 'Commercial Trucks', 'Attractions', '20', '1', '3', '6', '2', '2', '1', 'True', '20', \"['150']\", '[15, 5]', '[0, 0]', '[20, 18, 6, 0]', \"['Attractions', 'Automotive']\", \"['Attractions', 'Automotive']\", \"['Amusement and Theme Parks', 'Bars & Restaurants', 'Casinos', 'Parks']\", \"['Attractions']\", \"['Attractions', 'Attractions', 'Attractions', 'Attractions']\", \"['150', '1', '2']\", \"['150', '1', '2']\", 'True', 'True', 'True', 'True', 'True', 'False', 'False', 'True', 'Hacendado', 'Spain', 'Green Dot', '1', 'Hacendado', 'elcoco', '17', '3', '14', '17', '17', '20', '2', '[00001522]', '\"[\\'Seitán a la plancha\\']\"', \"['Green Dot', 'No gluten']\", \"['Green Dot', 'No gluten']\", \"['Mercadona', 'Hacendado']\", '[7, 5]', \"['Spain', 'United Kingdom', 'United States']\", '[18, 1, 1]', 'True', 'True', 'True', 'True', 'True', 'False', 'True', 'True', 'Switzerland', 'Pakistan', 'Puerto Rico', 'Switzerland', 'Hong Kong (China)', 'Singapore', 'Barbados', '101.1', '46.5', '20.0', '73.21', '50.8', '72.1', '110.91', '3.0', '[46.5, 36.7, 39.2, 67.2, 19.0]', '[62.4, 62.7, 63.1, 63.2, 63.3]', '[158.7, 54.6, 120.3, 111.1, 43.5]', '[109.1, 88.4, 84.6]', '[97.0, 83.3, 86.8, 50.4, 69.4]', '[42.3, 42.4, 43.2, 44.7, 45.6]', '[101.1, 99.4, 102.4, 102.4, 103.5]', \"['Switzerland', 'Bahamas', 'Iceland', 'Singapore', 'Barbados']\", \"['Switzerland', 'Iceland', 'Hong Kong (China)']\", \"['Singapore', 'Hong Kong (China)', 'Switzerland']\", \"['Australia', 'Austria', 'Canada', 'New Zealand', 'Ireland', 'France']\", \"['Luxembourg', 'Kuwait', 'Qatar', 'Switzerland', 'United States']\", \"['Hong Kong (China)', 'Singapore', 'Puerto Rico']\", 'True', 'False', 'True', 'False', 'False', 'False', 'True', 'True', '4.0', '1.0', '4.0', '4', '3.0', '4.5', '3.0', 'True', '337.0', '109.25', '12.0', '8.8', '3.0', '0.4924867083432169', '233.0', '4.0', '[337, 330, 328, 327, 325]', '0', '0', '[118, 115, 112, 111, 110]', '[7.9, 8.0, 8.0, 8.0, 8.0]', '[4.5, 4.5, 4.0, 4.0, 4.0]', '[4.5, 4.5, 4.5, 4.5, 4.0]', '[118, 115, 112, 111, 110]', '[337, 330]', '[7.9, 8.21]', '[4, 5, 4, 4, 4]', '[2, 3, 1, 3, 3]', '[4.5, 4.5, 4.0, 3.5]', '[4.5, 4.5, 4.0, 4.0, 3.5]', '[4.0, 3.5, 1.5, 3.0, 3.0]', 'False', 'True', 'True', 'False', 'True', 'True', 'True', 'False', 'False', 'southeast', 'male', 'yes', 'southeast', 'male', 'True', '0', 'northwest', 'no', '42.13', '0.6', '4', '249048.48', '18', '5', '4', '29.35', '[42.13, 40.3]', '[39611.75, 10602.38, 11090.71]', '[18, 23, 19, 23, 25]', '[18, 19, 19]', \"['yes']\", \"['southeast', 'southwest', 'southeast']\", 'True', 'True', 'False', 'True', 'False', 'True', 'True', 'True', 'True', '52 kg', '74 kg', 'Squat', '398.0', '10', '5', '5', '398', '269', 'Laura Taylor', '2125.0', '133.0', '287.0', '2.0', '[398, 396, 396]', '[111, 120, 132, 133, 178]', '[1390, 694, 675, 598, 556]', '[22, 21, 20]', '[235, 273]', '[359, 265, 264]', \"['Emily Davis', 'Jessica Wilson', 'Jane Smith', 'Laura Taylor', 'Sarah Thomas']\", \"['Chris Brown', 'John Doe', 'Michael Johnson', 'Daniel Lee', 'Matthew Anderson']\", \"['74 kg', '120 kg']\", \"['Laura Taylor', 'Sarah Thomas', 'Matthew Anderson', 'Jane Smith', 'Laura Taylor']\", \"['Bench Press', 'Deadlift', 'Squat']\", \"['Bench Press', 'Deadlift', 'Squat']\", 'False', 'False', 'True', 'True', 'True', 'True', 'False', 'False', 'HHS Region 04', 'Heart disease', 'Male', 'Urban', 'HHS Region 04', '276.4', '0.4', '8', '3711.6', '1.18', '47.64', '5', '161.29', '[276.4, 248.8, 246.0, 229.0, 226.8]', '[0.4, 0.4, 0.5, 0.5, 0.5]', '[115.1, 124.5, 132.2, 138.1, 139.6]', '[1.0, 0.8, 0.8, 0.6]', '[0.4, 0.4, 0.5, 0.5, 0.5]', \"['Heart disease']\", \"['HHS Region 04', 'HHS Region 02', 'HHS Region 03']\", \"['Urban', 'Rural']\", 'False', 'False', 'False', 'False', 'True', 'True', 'True', 'False', 'Kevin Durant', 'Kevin Durant', 'OKC', 'Kevin Durant', 'GSW', 'Russell Westbrook', 'Monta Ellis', '169', '8904', '7064', '79.335', '82', '607', '0', '0', '154', '[886, 670, 662]', '[607, 604, 551]', '[2280, 2133, 2036, 2023]', '[169, 160, 145]', '[154, 105, 91]', \"['Russell Westbrook', 'Monta Ellis', 'Kemba Walker', 'DeMar DeRozan', 'Damian Lillard' ]\", \"['David Lee', 'LaMarcus Aldridge', 'Blake Griffin']\", \"['OKC', 'MIA', 'NYK', 'GSW', 'POR']\", '[GSW, OKC, MIA, POR, NYK]', \"['Monta Ellis', 'Kemba Walker']\", \"['Brook Lopez', 'Kevin Durant', 'LaMarcus Aldridge']\", \"['Russell Westbrook', 'Deron Williams', 'LeBron James', 'Stephen Curry']\", 'False', 'True', 'False', 'True', 'False', 'True', 'True', '20', 'True', '0', '19', '156.0', '1.0', '23.1', '55.0', '1.40', '22.57', '20.0', '17', '20', '0.40', '2.38', '[180.0, 165.0, 165.0]', '[16.0, 17.0, 18.0, 19.0]', '[]', '[49.0, 50.0]', '[0, 1]', '[0]', '[165.0, 180.0]', '[]', '[17.0, 18.0]', 'False', 'False', 'True', 'True', 'False', 'False', 'False', 'False', 'True', '10', '6', 'December', '0', 'Monday', 'August', '11', 'Monday', '26.4', '0.9', '0.0', '3', '48.95', '643.1', '4.62', '20', '[26.4, 24.1, 22.9]', '[70.8, 77.5, 80.8, 94.3, 97.1]', '[4, 5, 6]', '[21, 27, 27, 29]', '[7.2, 6.7, 6.7, 5.4, 5.4]', '[0.0, 0.0, 0.0]', '[26.2, 27.4, 27.9]', '[January, February, August, November, December]', '[Monday, Tuesday, Wednesday]', '[August, November]', '[Sunday, Tuesday, Monday]', \"['December', 'February', 'August']\", \"['Tuesday', 'Monday', 'Sunday', 'Saturday']\", \"['Monday', 'Thursday', 'Saturday', 'Wednesday']\", 'False', 'False', 'False', 'False', 'False', 'True', 'True', 'True', 'Lower Manhattan', 'Coffee', 'Sun', 'Hot chocolate', 'Jan', '8', 'Lower Manhattan', 'Coffee', '2.0', '16.0', '97.3', 'True', '3.20', '20', '2', '9', '0', '[2, 1]', '[5, 8]', '[2.0, 2.5, 2.55, 3.0]', '[9.0, 7.0, 6.2]', '[7]', '[\\'Lower Manhattan\\', \"Hell\\'s Kitchen\"]', '[]', \"['Brewed Chai tea', 'Hot chocolate', 'Gourmet brewed coffee']\", \"['Jan']\", \"['Sun']\", '[5, 8]', \"['Hot chocolate', 'Hot chocolate']\", 'Civet Cat', 'True', 'True', 'True', 'True', 'False', 'False', 'False', 'True', 'Sapiens A Brief History Of Humankind', 'Novel', '1000', '7', 'Benjamin Graham', '80', 'BPB Publications (India)', '6', 'Islamic Books', '8', '8780', '1', '10.65', '9', '498', '2', '3', '19', '[498, 640, 80, 512, 492]', '[1258, 1598, 528, 950, 718]', '[30.0, 39.0, 27.0, 13.0]', '[492]', '[4, 6, 21, 38, 18]', '[11.0, 23.0, 27.0, 10.0, 13.0]', '[498]', '2', \"['History and Tradition', ' Business, Investment and Economics', 'Islamic Books', 'Islamic Books', 'Computer Science & Engineering']\", \"['Harish Bhat , B.S. Badan']\", \"['Madinah Arabic Reader 1', 'How Harsh Mariwala ?Groomed? Marico', 'Train to Pakistan']\", \"['History and Tradition', ' Business, Investment and Economics', 'Novel', 'Novel']\", \"['Yuval Noah Harari', 'Benjamin Graham', 'Khaled Hosseini']\", \"['Novel', 'Novel', 'Novel', 'Self-help and meditation', 'Self-help and meditation']\", \"['1st Edition', 'Edition', 'Edition', '1st Published']\"]\n", "Semantics: ['boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'category', 'number', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[number]', 'list[number]', 'boolean', 'boolean', 'boolean', 'number', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'number', 'number', 'number', 'number', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[number]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'boolean', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'boolean', 'number', 'list[category]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'number', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[number]', 'list[category]', 'list[number]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'boolean', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'boolean', 'number', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'category', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'category', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'number', 'boolean', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'number', 'number', 'category', 'number', 'category', 'category', 'number', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'category', 'category', 'category', 'number', 'category', 'category', 'number', 'number', 'number', 'boolean', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[number]', 'list[category]', 'category', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'boolean', 'category', 'category', 'number', 'number', 'category', 'number', 'category', 'number', 'category', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'list[number]', 'number', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]', 'list[category]']\n" ] } ], "source": [ "answers_file = \"answers/answers.txt\"\n", "answers_lite_file = \"answers/answers_lite.txt\"\n", "semantics_file = \"answers/semantics.txt\"\n", "\n", "# Load answers.txt into a list\n", "with open(answers_file, \"r\", encoding=\"utf-8\") as f:\n", " answers = [line.strip() for line in f.readlines()]\n", "\n", "# Load answers.txt into a list\n", "with open(answers_lite_file, \"r\", encoding=\"utf-8\") as f:\n", " answers_lite = [line.strip() for line in f.readlines()]\n", "\n", "# Load semantics.txt into a list\n", "with open(semantics_file, \"r\", encoding=\"utf-8\") as f:\n", " semantics = [line.strip() for line in f.readlines()]\n", "\n", "# Print the lists (optional)\n", "print(\"Answers:\", answers)\n", "print(\"Light Answers:\", answers_lite)\n", "print(\"Semantics:\", semantics)" ] }, { "cell_type": "code", "execution_count": 6, "id": "d2d43dfb", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
questiondatasetpredicted_typetypeansweranswer_lite
0Is our average employee older than 35?066_IBM_HRbooleanbooleanTrueTrue
1Is the most frequent travel value rarely trave...066_IBM_HRbooleanbooleanTrueTrue
2Is the highest DailyRate equal to 1499?066_IBM_HRbooleanbooleanTrueFalse
3Is the highest DailyRate negative?066_IBM_HRbooleanbooleanFalseFalse
4Is our research dept bigger than sales?066_IBM_HRbooleanbooleanTrueTrue
.....................
517List the titles of books with fewer than 200 p...080_Bookslist[category]list[category]['Madinah Arabic Reader 1', 'How Harsh Mariwal...['Madinah Arabic Reader 1', 'How Harsh Mariwal...
518List the categories of books with ratings abov...080_Bookslist[category]list[category]['History and Tradition', ' Business, Investme...['History and Tradition', ' Business, Investme...
519List the authors of books with more than 10 re...080_Bookslist[category]list[category]['Yuval Noah Harari', 'Benjamin Graham', 'Khal...['Yuval Noah Harari', 'Benjamin Graham', 'Khal...
520List the 5 categories of the last five books i...080_Bookslist[category]list[category]['Self-help and meditation', 'Self-help and me...['Novel', 'Novel', 'Novel', 'Self-help and med...
521List the editions of books in the 'Business, I...080_Bookslist[category]list[category]['1st Edition', 'Edition', 'Edition', '1st Pub...['1st Edition', 'Edition', 'Edition', '1st Pub...
\n", "

522 rows × 6 columns

\n", "
" ], "text/plain": [ " question dataset \\\n", "0 Is our average employee older than 35? 066_IBM_HR \n", "1 Is the most frequent travel value rarely trave... 066_IBM_HR \n", "2 Is the highest DailyRate equal to 1499? 066_IBM_HR \n", "3 Is the highest DailyRate negative? 066_IBM_HR \n", "4 Is our research dept bigger than sales? 066_IBM_HR \n", ".. ... ... \n", "517 List the titles of books with fewer than 200 p... 080_Books \n", "518 List the categories of books with ratings abov... 080_Books \n", "519 List the authors of books with more than 10 re... 080_Books \n", "520 List the 5 categories of the last five books i... 080_Books \n", "521 List the editions of books in the 'Business, I... 080_Books \n", "\n", " predicted_type type \\\n", "0 boolean boolean \n", "1 boolean boolean \n", "2 boolean boolean \n", "3 boolean boolean \n", "4 boolean boolean \n", ".. ... ... \n", "517 list[category] list[category] \n", "518 list[category] list[category] \n", "519 list[category] list[category] \n", "520 list[category] list[category] \n", "521 list[category] list[category] \n", "\n", " answer \\\n", "0 True \n", "1 True \n", "2 True \n", "3 False \n", "4 True \n", ".. ... \n", "517 ['Madinah Arabic Reader 1', 'How Harsh Mariwal... \n", "518 ['History and Tradition', ' Business, Investme... \n", "519 ['Yuval Noah Harari', 'Benjamin Graham', 'Khal... \n", "520 ['Self-help and meditation', 'Self-help and me... \n", "521 ['1st Edition', 'Edition', 'Edition', '1st Pub... \n", "\n", " answer_lite \n", "0 True \n", "1 True \n", "2 False \n", "3 False \n", "4 True \n", ".. ... \n", "517 ['Madinah Arabic Reader 1', 'How Harsh Mariwal... \n", "518 ['History and Tradition', ' Business, Investme... \n", "519 ['Yuval Noah Harari', 'Benjamin Graham', 'Khal... \n", "520 ['Novel', 'Novel', 'Novel', 'Self-help and med... \n", "521 ['1st Edition', 'Edition', 'Edition', '1st Pub... \n", "\n", "[522 rows x 6 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "semeval_test_qa['type'] = semantics\n", "semeval_test_qa['answer'] = answers\n", "semeval_test_qa['answer_lite'] = answers_lite\n", "semeval_test_qa" ] }, { "cell_type": "code", "execution_count": 7, "id": "9930c58e", "metadata": {}, "outputs": [], "source": [ "semeval_test_qa.to_csv(\"new_test_qa.csv\", index=False)" ] } ], "metadata": { "kernelspec": { "display_name": "myo_nlp_env", "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.16" } }, "nbformat": 4, "nbformat_minor": 5 }