Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Some Problems from Demo Examples #192

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 46 additions & 21 deletions examples/coordination/examples.ipynb

Large diffs are not rendered by default.

585 changes: 43 additions & 542 deletions examples/dataset-examples/wikiconv/Create_Conversations_Script.ipynb

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions examples/dataset-examples/wikiconv/corpus_deletion_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"source": [
"#import relevant modules\n",
"from datetime import datetime, timedelta\n",
"from convokit import Corpus, User, Utterance, Conversation, download"
"from convokit import Corpus, Utterance, Conversation, download"
]
},
{
Expand All @@ -41,7 +41,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset already exists at /home/jonathan/.convokit/downloads/wikiconv-2003\n"
"Dataset already exists at /Users/seanzhangkx/.convokit/downloads/wikiconv-2003\n"
]
}
],
Expand Down Expand Up @@ -113,7 +113,7 @@
{
"data": {
"text/plain": [
"Utterance({'id': '5021479.2081.2077', 'user': User([('name', 'Jay')]), 'root': '5021479.1277.1272', 'reply_to': '5021479.1277.1272', 'timestamp': 1070614595.0, 'text': \"You're right about separating the sandwich of war names and MiG names. Each plane should be sorted chronologically and have its own sentence detailing its importance. \", 'meta': {'is_section_header': True, 'indentation': '2', 'toxicity': 0.1219038, 'sever_toxicity': 0.06112729, 'ancestor_id': '5021479.2081.2077', 'rev_id': '5021479', 'parent_id': None, 'original': None, 'modification': [], 'deletion': [], 'restoration': []}})"
"Utterance({'obj_type': 'utterance', 'vectors': [], 'speaker_': Speaker({'obj_type': 'speaker', 'vectors': [], 'owner': <convokit.model.corpus.Corpus object at 0x7fbe80d0bfd0>, 'id': 'Jay', 'meta': ConvoKitMeta({'user_id': '14784'})}), 'owner': <convokit.model.corpus.Corpus object at 0x7fbe80d0bfd0>, 'id': '5021479.2081.2077', 'meta': ConvoKitMeta({'is_section_header': True, 'indentation': '2', 'toxicity': 0.1219038, 'sever_toxicity': 0.06112729, 'ancestor_id': '5021479.2081.2077', 'rev_id': '5021479', 'parent_id': None, 'original': None, 'modification': [], 'deletion': [], 'restoration': []})})"
]
},
"execution_count": 5,
Expand Down Expand Up @@ -145,9 +145,9 @@
" count_sever_toxic = 0\n",
" \n",
" for deletion_utt in list_of_deletion_utterances:\n",
" toxicity_val = deletion_utt.meta['toxicity']\n",
" sever_toxicity_val = deletion_utt.meta['sever_toxicity']\n",
" timestamp_value = deletion_utt.timestamp\n",
" toxicity_val = deletion_utt[\"meta\"]['toxicity']\n",
" sever_toxicity_val = deletion_utt[\"meta\"]['sever_toxicity']\n",
" timestamp_value = deletion_utt[\"timestamp\"]\n",
" deletion_datetime_val = datetime.fromtimestamp(timestamp_value)\n",
" \n",
" #delta_value is the time delta between when the deletion utt happened and the original utt's posting \n",
Expand All @@ -166,8 +166,7 @@
" count_sever_toxic +=1 \n",
" \n",
" #Return in tuple form the number of each type of affected comment\n",
" return (count_normal, count_toxic, count_sever_toxic)\n",
" "
" return (count_normal, count_toxic, count_sever_toxic)"
]
},
{
Expand Down Expand Up @@ -224,7 +223,7 @@
" #Find the time that the original utterance is posted\n",
" original_utterance = utterance_value.meta['original']\n",
" if (original_utterance is not None):\n",
" original_time = original_utterance.timestamp\n",
" original_time = original_utterance['timestamp']\n",
" original_date_time = datetime.fromtimestamp(original_time)\n",
" else:\n",
" original_date_time = datetime.fromtimestamp(utterance_value.timestamp)\n",
Expand Down Expand Up @@ -303,6 +302,7 @@
" total_normal, total_toxic, total_sever) = get_deletion_counts(individual_utterance_list, timedelta_value)\n",
"print_statistics(count_normal_deleted, count_toxic_deleted, count_sever_deleted,\n",
" total_normal, total_toxic, total_sever)\n",
"\n",
"\n"
]
},
Expand Down Expand Up @@ -414,7 +414,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.9.0"
}
},
"nbformat": 4,
Expand Down
Loading