{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "b270bd36-529e-4595-a780-ef6c8151c31f", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/gscratch/scrubbed/mjilg/envs/coref-notebook/lib/python3.7/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n", "/gscratch/scrubbed/mjilg/envs/coref-notebook/lib/python3.7/site-packages/torch/cuda/__init__.py:497: UserWarning: Can't initialize NVML\n", " warnings.warn(\"Can't initialize NVML\")\n" ] } ], "source": [ "import pandas as pd \n", "import spacy" ] }, { "cell_type": "code", "execution_count": 2, "id": "f6448c6f-2b5d-45f5-a32e-b3b47c16ef85", "metadata": {}, "outputs": [], "source": [ "phab_path = \"/mmfs1/gscratch/comdata/users/mjilg/mw-repo-lifecycles/case3/0422_http_phab_comments.csv\"\n", "phab_df = pd.read_csv(phab_path)" ] }, { "cell_type": "code", "execution_count": 3, "id": "e30e81ad", "metadata": {}, "outputs": [], "source": [ "#because of compute issues, need to do the sampling before the coreference resolution\n", "def http_relevant(text):\n", " if pd.isnull(text):\n", " return False\n", " # expanded dictionary for relevancy\n", " # http, login, SSL, TLS, certificate \n", " for word in text.split():\n", " if \"://\" not in word.lower():\n", " #http\n", " if \"http\" in word.lower():\n", " return True\n", " #login\n", " if \"login\" in word.lower():\n", " return True\n", " #ssl\n", " if \"ssl\" in word.lower():\n", " return True\n", " #tls\n", " if \"tls\" in word.lower():\n", " return True\n", " #cert\n", " if word.lower().startswith(\"cert\") and not word.lower().startswith(\"certain\"):\n", " return True\n", " return False\n", "\n", "def is_migrated(comment_text):\n", " if pd.isnull(comment_text):\n", " return False\n", " text = comment_text.strip()\n", " if text.startswith(\"Originally from: http://sourceforge.net\"):\n", " return True \n", " return False" ] }, { "cell_type": "code", "execution_count": 4, "id": "f359805f", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/gscratch/scrubbed/mjilg/envs/coref-notebook/lib/python3.7/site-packages/ipykernel_launcher.py:42: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "/gscratch/scrubbed/mjilg/envs/coref-notebook/lib/python3.7/site-packages/ipykernel_launcher.py:45: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n" ] } ], "source": [ "#find gerrit phab PHID: PHID-USER-idceizaw6elwiwm5xshb\n", "phab_df['isGerrit'] = phab_df['AuthorPHID'] == 'PHID-USER-idceizaw6elwiwm5xshb'\n", "\n", "#cleaning df\n", "phab_df['id'] = phab_df.index + 1\n", "#may have to build out the reply_to column \n", "phab_df['reply_to'] = phab_df.groupby('TaskPHID')['id'].shift()\n", "phab_df['reply_to'] = phab_df['reply_to'].where(pd.notnull(phab_df['reply_to']), None)\n", "\n", "phab_df = phab_df.rename(columns={\n", " 'AuthorPHID': 'speaker',\n", " 'TaskPHID': 'conversation_id',\n", " 'WMFaffil':'meta.affil',\n", " 'isGerrit': 'meta.gerrit'\n", "})\n", "\n", "# after 10-01-2014 before 10-01-2015\n", "phab_df['timestamp'] = pd.to_datetime(phab_df['date_created'], unit='s', origin='unix', utc=True)\n", "#filtered_phab_df = phab_df[(phab_df['date_created'] < 1443743999) & (phab_df['date_created'] >= 1412207999)]\n", "# after 07-01-2013 before 10-01-2015\n", "filtered_phab_df = phab_df[(phab_df['date_created'] < 1443743999) & (phab_df['date_created'] > 1372636800)]\n", "\n", "#removing headless conversations\n", "task_phab_df = filtered_phab_df[filtered_phab_df['comment_type']==\"task_description\"]\n", "headed_task_phids = task_phab_df['conversation_id'].unique()\n", "filtered_phab_df = filtered_phab_df[filtered_phab_df['conversation_id'].isin(headed_task_phids)]\n", "\n", "#removing gerrit comments \n", "mid_comment_phab_df = filtered_phab_df[filtered_phab_df['meta.gerrit'] != True]\n", "\n", "# filter out the sourceforge migration \n", "# Originally from: http://sourceforge.net in the task task_summary\n", "migrated_conversation_ids = task_phab_df[task_phab_df['comment_text'].apply(is_migrated)]['conversation_id'].unique()\n", "\n", "#cut down to only the data that is relevant (mentions http)\n", "relevant_conversation_ids = task_phab_df[\n", " task_phab_df['comment_text'].apply(http_relevant) |\n", " task_phab_df['task_title'].apply(http_relevant)\n", "]['conversation_id'].unique()\n", "\n", "task_phab_df['is_relevant'] = task_phab_df['conversation_id'].isin(relevant_conversation_ids)\n", "mid_comment_phab_df['is_relevant'] = mid_comment_phab_df['conversation_id'].isin(relevant_conversation_ids)\n", "\n", "task_phab_df['is_migrated'] = task_phab_df['conversation_id'].isin(migrated_conversation_ids)\n", "mid_comment_phab_df['is_migrated'] = mid_comment_phab_df['conversation_id'].isin(migrated_conversation_ids)\n", "\n", "comment_phab_df = mid_comment_phab_df[(mid_comment_phab_df['is_relevant'] == True) & (mid_comment_phab_df['is_migrated'] != True)]\n", "task_phab_df = task_phab_df[(task_phab_df['is_relevant'] == True) & (task_phab_df['is_migrated'] != True)]\n", "#comment_phab_df = mid_comment_phab_df" ] }, { "cell_type": "code", "execution_count": 5, "id": "4241cb0a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | task_title | \n", "comment_text | \n", "date_created | \n", "speaker | \n", "meta.affil | \n", "conversation_id | \n", "comment_type | \n", "status | \n", "meta.gerrit | \n", "id | \n", "reply_to | \n", "timestamp | \n", "is_relevant | \n", "is_migrated | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
197 | \n", "Creation of instances broken | \n", "After a replace of old instances, it is not po... | \n", "1442753295 | \n", "PHID-USER-qlodcndtwpolbdhncjis | \n", "False | \n", "PHID-TASK-pitdrld6mszruqmc6usf | \n", "task_description | \n", "resolved | \n", "False | \n", "198 | \n", "NaN | \n", "2015-09-20 12:48:15+00:00 | \n", "True | \n", "False | \n", "
198 | \n", "Creation of instances broken | \n", "Works now. | \n", "1442864673 | \n", "PHID-USER-qlodcndtwpolbdhncjis | \n", "False | \n", "PHID-TASK-pitdrld6mszruqmc6usf | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "199 | \n", "198.0 | \n", "2015-09-21 19:44:33+00:00 | \n", "True | \n", "False | \n", "
199 | \n", "Creation of instances broken | \n", "Ok, the instances are deleted now, I will recr... | \n", "1442864271 | \n", "PHID-USER-qlodcndtwpolbdhncjis | \n", "False | \n", "PHID-TASK-pitdrld6mszruqmc6usf | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "200 | \n", "199.0 | \n", "2015-09-21 19:37:51+00:00 | \n", "True | \n", "False | \n", "
200 | \n", "Creation of instances broken | \n", "The new instances have the same names as recen... | \n", "1442854156 | \n", "PHID-USER-22bsa5u75jz3ci3wnplu | \n", "False | \n", "PHID-TASK-pitdrld6mszruqmc6usf | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "201 | \n", "200.0 | \n", "2015-09-21 16:49:16+00:00 | \n", "True | \n", "False | \n", "
201 | \n", "Creation of instances broken | \n", "This happens also with jessie and presice inst... | \n", "1442835238 | \n", "PHID-USER-qlodcndtwpolbdhncjis | \n", "False | \n", "PHID-TASK-pitdrld6mszruqmc6usf | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "202 | \n", "201.0 | \n", "2015-09-21 11:33:58+00:00 | \n", "True | \n", "False | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
406887 | \n", "Allow login using mosh as an alternative to pl... | \n", "*** Bug 49454 has been marked as a duplicate o... | \n", "1379011061 | \n", "PHID-USER-2nnm76h4ykalvvref2ye | \n", "False | \n", "PHID-TASK-hnwvtmwgpm2oisoqaozt | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "406888 | \n", "406887.0 | \n", "2013-09-12 18:37:41+00:00 | \n", "True | \n", "False | \n", "
406888 | \n", "Allow login using mosh as an alternative to pl... | \n", "JFTR, on Tools mosh-server processes eat up to... | \n", "1376245807 | \n", "PHID-USER-vk6mlmacfhx77egryy5i | \n", "False | \n", "PHID-TASK-hnwvtmwgpm2oisoqaozt | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "406889 | \n", "406888.0 | \n", "2013-08-11 18:30:07+00:00 | \n", "True | \n", "False | \n", "
406889 | \n", "Allow login using mosh as an alternative to pl... | \n", "This is supported on tools, but adding it to t... | \n", "1376185312 | \n", "PHID-USER-h75guknmwivm6x37iute | \n", "False | \n", "PHID-TASK-hnwvtmwgpm2oisoqaozt | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "406890 | \n", "406889.0 | \n", "2013-08-11 01:41:52+00:00 | \n", "True | \n", "False | \n", "
406890 | \n", "Allow login using mosh as an alternative to pl... | \n", "Just found out that mosh already works for too... | \n", "1376118400 | \n", "PHID-USER-5dqihbanu3caaj7pigif | \n", "False | \n", "PHID-TASK-hnwvtmwgpm2oisoqaozt | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "406891 | \n", "406890.0 | \n", "2013-08-10 07:06:40+00:00 | \n", "True | \n", "False | \n", "
406891 | \n", "Allow login using mosh as an alternative to pl... | \n", "(In reply to comment #0)\\n> ssh is quite painf... | \n", "1376118251 | \n", "PHID-USER-6vzzsmi22zem6yttr6vp | \n", "False | \n", "PHID-TASK-hnwvtmwgpm2oisoqaozt | \n", "task_subcomment | \n", "NaN | \n", "False | \n", "406892 | \n", "406891.0 | \n", "2013-08-10 07:04:11+00:00 | \n", "True | \n", "False | \n", "
14490 rows × 14 columns
\n", "