{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"Published on May 15, 2023. By Marília Prata, mpwolke.","metadata":{}},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n\n#Ignore warnings\nimport warnings\nwarnings.filterwarnings('ignore')\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2023-05-15T20:30:43.544047Z","iopub.execute_input":"2023-05-15T20:30:43.545013Z","iopub.status.idle":"2023-05-15T20:30:44.847128Z","shell.execute_reply.started":"2023-05-15T20:30:43.544961Z","shell.execute_reply":"2023-05-15T20:30:44.846250Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The Bard\n\n\"The Bard of Avon,' 'The Immortal Bard' or (in England) simply 'The Bard' is William Shakespeare.\"\n\nWilliam Shakespeare is also referred to as 'The Bard'. The term bard originally meant a friend who likes writing poems indeed Shakespeare gained many friends through his plays.\n\nhttps://www.freelancewriting.com/creative-writing/reasons-why-shakespear/#:~:text=William%20Shakespeare%20is%20also%20referred,many%20friends%20through%20his%20plays.\n\n\"The main difference between ChatGPT and Bard is the data source. Bard continually draws information from the internet, so it has the latest information. ChatGPT's sources end with 2021 data, so it is limited on newer research and information. Bard has more data to gather information in real time by accessing the latest research.\"\n\nhttps://www.techtarget.com/whatis/feature/Bard-vs-ChatGPT-Whats-the-difference#:~:text=The%20main%20difference%20between%20ChatGPT,on%20newer%20research%20and%20information.","metadata":{}},{"cell_type":"markdown","source":"![](https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iXPfgL4c_jXQ/v1/1200x-1.png)https://www.bloomberg.com/opinion/articles/2023-02-07/chatgpt-vs-bard-big-tech-s-future-of-ai-is-ruthless#xj4y7vzkg","metadata":{}},{"cell_type":"code","source":"#By Ant358  https://www.kaggle.com/code/anthony35813/ai-report-a-first-look-at-the-data-for-text-data/notebook\n\narxiv = pd.read_json(\"/kaggle/input/2023-kaggle-ai-report/arxiv_metadata_20230510.json\", \n                              lines=True,\n                             convert_dates=True)\narxiv.head() ","metadata":{"execution":{"iopub.status.busy":"2023-05-15T20:38:31.535049Z","iopub.execute_input":"2023-05-15T20:38:31.535488Z","iopub.status.idle":"2023-05-15T20:41:35.282867Z","shell.execute_reply.started":"2023-05-15T20:38:31.535449Z","shell.execute_reply":"2023-05-15T20:41:35.281930Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Let's try Bard ChatBot\n\nJust Bard: I got unexpected Hubbard (model) for searching just for Bard (13706)\n\nAdding \"The\" (definite article - The Bard) I got 397 (Bardeen)","metadata":{}},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\n# define keyword\nmy_keyword = 'Bard ChatBot'","metadata":{"execution":{"iopub.status.busy":"2023-05-15T20:57:02.556494Z","iopub.execute_input":"2023-05-15T20:57:02.556981Z","iopub.status.idle":"2023-05-15T20:57:02.563101Z","shell.execute_reply.started":"2023-05-15T20:57:02.556947Z","shell.execute_reply":"2023-05-15T20:57:02.561762Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\ndef word_finder(i_word, i_text):\n    found = (str(i_text).lower()).find(str(i_word).lower()) # avoid case sensitivity\n    if found == -1:\n        result = 0\n    else:\n        result = 1\n    return result\n\n# partial function for mapping\nword_indicator_partial = lambda text: word_finder(my_keyword, text)\n# build indicator vector (0/1) of hits\nkeyword_indicator = np.asarray(list(map(word_indicator_partial, arxiv.abstract)))","metadata":{"execution":{"iopub.status.busy":"2023-05-15T20:57:08.744387Z","iopub.execute_input":"2023-05-15T20:57:08.744756Z","iopub.status.idle":"2023-05-15T20:57:15.171038Z","shell.execute_reply.started":"2023-05-15T20:57:08.744727Z","shell.execute_reply":"2023-05-15T20:57:15.169940Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Only one Abstract with Bard. ","metadata":{}},{"cell_type":"code","source":"# number of hits\nprint('Number of hits for keyword <', my_keyword, '> : ', keyword_indicator.sum())","metadata":{"execution":{"iopub.status.busy":"2023-05-15T20:57:19.630266Z","iopub.execute_input":"2023-05-15T20:57:19.630642Z","iopub.status.idle":"2023-05-15T20:57:19.637060Z","shell.execute_reply.started":"2023-05-15T20:57:19.630609Z","shell.execute_reply":"2023-05-15T20:57:19.635993Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\n# add index vector as additional column\narxiv['selection'] = keyword_indicator\n\n# select only hits from data frame\narxiv_hits = arxiv[arxiv['selection']==1]","metadata":{"execution":{"iopub.status.busy":"2023-05-15T20:59:25.677131Z","iopub.execute_input":"2023-05-15T20:59:25.677579Z","iopub.status.idle":"2023-05-15T20:59:25.689981Z","shell.execute_reply.started":"2023-05-15T20:59:25.677545Z","shell.execute_reply":"2023-05-15T20:59:25.688766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# show results\narxiv_hits","metadata":{"execution":{"iopub.status.busy":"2023-05-15T20:59:31.528342Z","iopub.execute_input":"2023-05-15T20:59:31.528719Z","iopub.status.idle":"2023-05-15T20:59:31.548677Z","shell.execute_reply.started":"2023-05-15T20:59:31.528691Z","shell.execute_reply":"2023-05-15T20:59:31.547467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\n# show all abstracts\nn = arxiv_hits.shape[0]\nfor i in range(0,n):\n    print(arxiv_hits.title.iloc[i],\":\\n\")\n    print(arxiv_hits.abstract.iloc[i])\n    print('\\n')","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:02:19.951460Z","iopub.execute_input":"2023-05-15T21:02:19.951991Z","iopub.status.idle":"2023-05-15T21:02:19.960128Z","shell.execute_reply.started":"2023-05-15T21:02:19.951951Z","shell.execute_reply":"2023-05-15T21:02:19.958664Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Above we found Bard ChatBot on the Abstract of that article:\n\nBoosting Big Brother: Attacking Search Engines with Encodings :\n\nAuthors: Nicholas Boucher, Luca Pajola, Ilia Shumailov, Ross Anderson, Mauro Conti\n\nhttps://doi.org/10.48550/arXiv.2304.14031\n\n\" We further demonstrate that this attack is successful against LLM chat search including Bing's GPT-4 chatbot and Google's Bard chatbot.\"\n\nhttps://arxiv.org/abs/2304.14031","metadata":{}},{"cell_type":"markdown","source":"#Try searching Bard ChatBot by title? ","metadata":{}},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\ndef word_finder(i_word, i_text):\n    found = (str(i_text).lower()).find(str(i_word).lower()) # avoid case sensitivity\n    if found == -1:\n        result = 0\n    else:\n        result = 1\n    return result\n\n# partial function for mapping\nword_indicator_partial = lambda text: word_finder(my_keyword, text)\n# build indicator vector (0/1) of hits\nkeyword_indicator = np.asarray(list(map(word_indicator_partial, arxiv.title)))","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:11:42.852409Z","iopub.execute_input":"2023-05-15T21:11:42.852848Z","iopub.status.idle":"2023-05-15T21:11:45.836902Z","shell.execute_reply.started":"2023-05-15T21:11:42.852815Z","shell.execute_reply":"2023-05-15T21:11:45.835694Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# number of hits\nprint('Number of hits for keyword <', my_keyword, '> : ', keyword_indicator.sum())","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:12:15.369019Z","iopub.execute_input":"2023-05-15T21:12:15.370279Z","iopub.status.idle":"2023-05-15T21:12:15.378829Z","shell.execute_reply.started":"2023-05-15T21:12:15.370227Z","shell.execute_reply":"2023-05-15T21:12:15.377704Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Something went wrong since I found Bard manually on that Title:\n\nShould ChatGPT and Bard Share Revenue with Their Data Providers? A New Business Model for the AI Era :\n\nAuthor: Dong Zhang -\nhttps://doi.org/10.48550/arXiv.2305.02555\n\nhttps://arxiv.org/abs/2305.02555#:~:text=A%20crucial%20question%20arise%3A%20should,The%20answer%20is%20Yes.","metadata":{}},{"cell_type":"markdown","source":"#Is that guy talking to the wall?\n\n![](https://d2e931syjhr5o9.cloudfront.net/Chat_GPT_Gif_8f819beac2.gif)https://nimblebox.ai/blog/openai-chatgpt","metadata":{}},{"cell_type":"markdown","source":"#Let's check ChatGPT","metadata":{}},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\n# define keyword\nmy_keyword = 'ChatGPT'","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:19:19.824085Z","iopub.execute_input":"2023-05-15T21:19:19.824569Z","iopub.status.idle":"2023-05-15T21:19:19.829703Z","shell.execute_reply.started":"2023-05-15T21:19:19.824535Z","shell.execute_reply":"2023-05-15T21:19:19.828640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\ndef word_finder(i_word, i_text):\n    found = (str(i_text).lower()).find(str(i_word).lower()) # avoid case sensitivity\n    if found == -1:\n        result = 0\n    else:\n        result = 1\n    return result\n\n# partial function for mapping\nword_indicator_partial = lambda text: word_finder(my_keyword, text)\n# build indicator vector (0/1) of hits\nkeyword_indicator = np.asarray(list(map(word_indicator_partial, arxiv.title)))","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:26:30.158772Z","iopub.execute_input":"2023-05-15T21:26:30.159302Z","iopub.status.idle":"2023-05-15T21:26:32.459963Z","shell.execute_reply.started":"2023-05-15T21:26:30.159265Z","shell.execute_reply":"2023-05-15T21:26:32.458898Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#On titles, we have ChatGPT: 230 times","metadata":{}},{"cell_type":"code","source":"# number of hits\nprint('Number of hits for keyword <', my_keyword, '> : ', keyword_indicator.sum())","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:27:06.973839Z","iopub.execute_input":"2023-05-15T21:27:06.974313Z","iopub.status.idle":"2023-05-15T21:27:06.982780Z","shell.execute_reply.started":"2023-05-15T21:27:06.974283Z","shell.execute_reply":"2023-05-15T21:27:06.981242Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\n# add index vector as additional column\narxiv['selection'] = keyword_indicator\n\n# select only hits from data frame\narxiv_hits = arxiv[arxiv['selection']==1]","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:28:27.715411Z","iopub.execute_input":"2023-05-15T21:28:27.715937Z","iopub.status.idle":"2023-05-15T21:28:27.730536Z","shell.execute_reply.started":"2023-05-15T21:28:27.715898Z","shell.execute_reply":"2023-05-15T21:28:27.729227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# show results\narxiv_hits","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:28:55.670988Z","iopub.execute_input":"2023-05-15T21:28:55.671935Z","iopub.status.idle":"2023-05-15T21:28:55.721623Z","shell.execute_reply.started":"2023-05-15T21:28:55.671866Z","shell.execute_reply":"2023-05-15T21:28:55.720531Z"},"_kg_hide-output":true,"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Are you ready for 230 Titles with ChatGPT?","metadata":{}},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\n# show all abstracts\nn = arxiv_hits.shape[0]\nfor i in range(0,n):\n    print(arxiv_hits.title.iloc[i],\":\\n\")\n    print(arxiv_hits.title.iloc[i])\n    print('\\n')","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:30:58.808789Z","iopub.execute_input":"2023-05-15T21:30:58.809269Z","iopub.status.idle":"2023-05-15T21:30:58.831961Z","shell.execute_reply.started":"2023-05-15T21:30:58.809235Z","shell.execute_reply":"2023-05-15T21:30:58.830562Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\ndef word_finder(i_word, i_text):\n    found = (str(i_text).lower()).find(str(i_word).lower()) # avoid case sensitivity\n    if found == -1:\n        result = 0\n    else:\n        result = 1\n    return result\n\n# partial function for mapping\nword_indicator_partial = lambda text: word_finder(my_keyword, text)\n# build indicator vector (0/1) of hits\nkeyword_indicator = np.asarray(list(map(word_indicator_partial, arxiv.abstract)))","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:20:23.767478Z","iopub.execute_input":"2023-05-15T21:20:23.767872Z","iopub.status.idle":"2023-05-15T21:20:29.612921Z","shell.execute_reply.started":"2023-05-15T21:20:23.767844Z","shell.execute_reply":"2023-05-15T21:20:29.611892Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#ChatGPT hits: 390 times on Abstracts","metadata":{}},{"cell_type":"code","source":"# number of hits\nprint('Number of hits for keyword <', my_keyword, '> : ', keyword_indicator.sum())","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:21:05.553807Z","iopub.execute_input":"2023-05-15T21:21:05.555059Z","iopub.status.idle":"2023-05-15T21:21:05.562777Z","shell.execute_reply.started":"2023-05-15T21:21:05.555018Z","shell.execute_reply":"2023-05-15T21:21:05.561372Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Checking some Kagglers opinion - They both complement each other!\n\nTopic \"Is Chat-Gpt capable enough to replace Google as a search engine?\"\n\n\"Google is a highly complex and sophisticated search engine that utilizes various algorithms, indexing systems, and machine learning techniques to provide accurate and relevant search results. On the other hand, ChatGPT is a language model that relies on pre-existing knowledge and training data to generate responses. While ChatGPT can provide information and answer questions, it is not designed to replace search engines like Google. Instead, it can complement search engines by helping users with specific queries or engaging in conversations about a wide range of topics.\"\n\nBy Shubham Koli 4 (shubhamkoli4)\n\n\"The purpose of ChatGPT and Google Search Engine is different. ChatGPT is an AI language model which is made for generating human-like text such as content, chatbot where Google is a search engine to search indexed different pages on the internet. But if you say about Microsoft Bing then it will and Google then there arises a question. Microsoft Bing is now more powerful with the help of ChatGPT on the other hand Google also releases a beta version of Bard. So at the end of the day, everything depends on their future work, innovation, and services. Also, depends on our adaptation.\"\n\nBy Nahid Hasan (nahidcse)\n\n\n\"The other day i was looking for some code of a statistical analysis function and was stuck with some input parameter and i tried using chatgpt for the same. To my surprise, it created its own input parameter which was not even taken as input by the function. I was so fascinated by that code.\nErgo, we cannot fully reply on chatgpt for the information. Google is something which cannot be replaced fully; but these days where we need information as fast as possible, Chatgpt and google go hand in hand and complement each other.\"\n\nBy Shruti Verma (shrutianalyttica)\n\n#They both complement each other!\n\nFor instance, I like to use ChatGPT to ask for a list of the best papers for whatever study I'd like to know more about, and I inform what I'd like the paper's content to be. So I finally use Google to search for it, etc.\"\n\n\"It's important to remember that you shouldn't always trust ChatGPT, specially for describing you or “teaching” you complex matters. ChatGPT may hallucinate and generate texts that are extremely convincing, but have no ground in reality.\"\n\nI also like to use ChatGPT to obtain a description and even examples of use of some functions in Python libs. But even so, I still look for the lib's documentation to have a more in-depth understanding.\"\n\nBy Luís Fernando Torres","metadata":{}},{"cell_type":"code","source":"from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator\n\ntext = \" \".join(titl for titl in arxiv_hits.title)\n\nstopwords = set(STOPWORDS)","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:59:13.309984Z","iopub.execute_input":"2023-05-15T21:59:13.310393Z","iopub.status.idle":"2023-05-15T21:59:13.361144Z","shell.execute_reply.started":"2023-05-15T21:59:13.310363Z","shell.execute_reply":"2023-05-15T21:59:13.359673Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Doctors vs. ChatGPT: study evaluates technique and empathy in responses to patient questions\n\n\"The questions asked in r/AskDocs, the verified physicians' responses, and the chatbot responses were then evaluated by three members of a team of healthcare professionals working in the areas of pediatrics, geriatrics, internal medicine, oncology, infectious and parasitic diseases, and preventive medicine. The authorship of the answers was masked and the evaluators were instructed to read the questions until the end, as well as the two answers, before evaluating the interaction. They were asked to:\"\n\n1. Indicate the best answer\n\n2. Evaluate the quality of the information (very bad, bad, acceptable, good or very good)\n\n3. Evaluate the response from the level of empathy shown (not at all empathic, slightly empathic, moderately empathic, empathic or very empathic).\n\n\"In the professionals' assessment, the quality of the ChatGPT responses was significantly higher than the physicians' responses; The occurrence of responses considered of good or very good quality was more than three times higher for ChatGPT.\"\n\n\"Chatbot responses were also rated as significantly more empathetic than physician responses. The proportion of responses classified as empathetic or very empathetic was higher for ChatGPT. These values indicate that ChatGPT gave 9.8 times more “empathetic or very empathetic” responses than physicians.\n\nhttps://portugues.medscape.com/verartigo/6509550?ecd=mkm_ret_230515_mscpmrk-OUS_TreAlert_PT&uac=102514CX&impID=5422375&faf=1#vp_2","metadata":{}},{"cell_type":"markdown","source":"#Hey Bard, do you want me to teach you empathy? Don't bother answering that Bard. ","metadata":{}},{"cell_type":"code","source":"#Chris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles\n\nwordcloud = WordCloud(stopwords=stopwords, max_font_size=50, max_words=500,\n                      width = 600, height = 400,\n                      colormap='Set3',\n                      background_color=\"black\").generate(text)\nplt.figure(figsize=(12,8))\nplt.imshow(wordcloud, interpolation=\"bilinear\")\nplt.axis(\"off\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T21:59:23.148053Z","iopub.execute_input":"2023-05-15T21:59:23.148618Z","iopub.status.idle":"2023-05-15T21:59:24.767959Z","shell.execute_reply.started":"2023-05-15T21:59:23.148582Z","shell.execute_reply":"2023-05-15T21:59:24.767006Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Closing Arguments - The GPTaggle (A Google's GPT inspired by Kaggle)\n\nThough Kagglers said that both are complementary, having 230 Titles and 390 Abstracts with ChatGPT and only one Title and Abstract with Bard can already express The Audience perception. \n\nTechnologies need time to mature depending on the quantity and quality of the input offered to them. It's hard to predict which of the Tech Giants will be more successful in using AI to power their businesses, including search engines.\n\nThe chat model brings a total disruption because it already delivers the masticated information.\nThis dispute is not restricted to the Big Techs.\n\nWho knows if there is an innovation from some other company outside of Silicon Valley?\n\n#Maybe Anthony(Goldbloom) and Ben(Hamner) buid a new GPT (The GPTaggle). And Alphabet will buy it later.\n\nThank you Google Translate. You're the best Multilingual Neural Machine translation service ever.","metadata":{}},{"cell_type":"markdown","source":"#Acknowledgements:\n\nAnt358  https://www.kaggle.com/code/anthony35813/ai-report-a-first-look-at-the-data-for-text-data/notebook\n\n\nChris X https://www.kaggle.com/code/docxian/cord-19-dexamethasone-articles","metadata":{}}]}