<jupyter_start><jupyter_text>[StaQC: A Systematically Mined Question-Code Dataset from Stack Overflow](https://github.com/LittleYUYU/StackOverflow-Question-Code-Dataset) Exploration<jupyter_code>import pickle
from pprint import pprint
import random
root_dir = '../../raw-datasets/staqc/annotation_tool/data'
code_dir = root_dir + '/code_solution_labeled_data/source'

code_pkl = code_dir + '/python_how_to_do_it_qid_by_classifier_unlabeled_single_code_answer_qid_to_code.pickle'
title_pkl = code_dir + '/python_how_to_do_it_qid_by_classifier_unlabeled_single_code_answer_qid_to_title.pickle'

code_xs = pickle.load(open(code_pkl, 'rb'))
title_xs = pickle.load(open(title_pkl, 'rb'))
predicate = lambda c: True # 5 <= len(c) <= 100
data = [
    (title_xs[key], snippet.strip()) for i, (key, snippet) 
    in enumerate(code_xs.items()) 
    if predicate(snippet)
]

q, c = random.sample(data, 1)[0]

print(q)
print(c)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12380952380952381, 'fraction_numerical': 0.006349206349206349, 'mean_word_length': 6.691056910569106, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '236930', 'license': 'MIT', 'n_tokens_mistral': 378, 'n_tokens_neox': 358, 'n_words': 58, 'path': 'notebooks/staqc_dataset.ipynb', 'repo_name': 'code-gen/exploration', 'size': '945'}