<jupyter_start><jupyter_text>Stance for testing set<jupyter_code>'''Read in input csv for which predictions are required'''
#input_structure = [["Headline1","Headline2"],["Body1","Body2"]] #this is a list containing 



name="test_set" #name for output
df_input_csv = pd.read_csv(input_csv)
headlines = df_input_csv['Headline'].tolist()
bodies = df_input_csv['Body'].tolist()



prediction_dist, predicted_labels = get_stance(headlines, bodies)
'''Write output predictions'''
with open('{}_output_predictions.csv'.format(name),'w') as f:
    writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)
    writer.writerow(["Headline","Body","Agree","Disagree","Discuss","Unrelated","Classification"])
    for i in range(len(predicted_labels)):
        output_line = [headlines[i], bodies[i], prediction_dist[i][0], prediction_dist[i][1], prediction_dist[i][2], prediction_dist[i][3], inverse_label_map[predicted_labels[i]]]
        writer.writerow(output_line)
print("Outputs written to: {}".format('{}_output_predictions.csv'.format(name)))<jupyter_output>Outputs written to: test_set_output_predictions.csv<jupyter_text>Stance for kaggle subset<jupyter_code>name = "kaggle_first_1000"
input_csv = "../final_combined_kaggle_scraped_pruned.csv"
df_input_csv = pd.read_csv(input_csv)
headlines = df_input_csv['title'].tolist()[:1000]
bodies = df_input_csv['text'].tolist()[:1000]
prediction_dist, predicted_labels = get_stance(headlines, bodies)
'''Write output predictions'''
with open('{}_output_predictions.csv'.format(name),'w') as f:
    writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)
    writer.writerow(["Headline","Body","Agree","Disagree","Discuss","Unrelated","Classification"])
    for i in range(len(predicted_labels)):
        output_line = [headlines[i], bodies[i], prediction_dist[i][0], prediction_dist[i][1], prediction_dist[i][2], prediction_dist[i][3], inverse_label_map[predicted_labels[i]]]
        writer.writerow(output_line)
print("Outputs written to: {}".format('{}_output_predictions.csv'.format(name)))
len(np.where(predicted_labels==1)[0])
'''
Use model to predict
predictions = stance_model.predict([headline_sequences, article_sequences, concatenated_tfidf_vec], batch_size = 128)
predicted_labels = np.argmax(predictions, axis=1)
#predicted_labels = 
'''

body = "The name <NAME> infuriates President Trump. I believe he hates Obama more than he hates crooked Hillary, mainly because Obama was a successful and very popular president. So it was no surprise when one of the first things Trump wanted to do after taking office is tear apart Obamacare. If it had simply been called Health Care for Everyone or something like that, Trump might not have noticed. But it had Obama's name on it, and Trump couldn't tolerate that. So he wanted it torn down. So far, his efforts have totally failed, but that's nothing new. Next, Trump wants to erase all the good Obama did with easing U.S.-Cuba relations. The embargo is still in place. And yes, human rights violations are still taking place all the time in Cuba. But people are traveling there. It has been opened up to trade and to some news agencies. It is a relationship that will help the Cuban people in the long run. And it gives Americans a chance to see a nearby country that has been a mystery for decades."

title<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12485172004744959, 'fraction_numerical': 0.008896797153024912, 'mean_word_length': 6.562780269058296, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '293683', 'license': 'Apache-2.0', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1019, 'n_words': 309, 'path': 'Stance_detection/Predict_stance_using_trained_models.ipynb', 'repo_name': 'shantanuj/Fake_Net', 'size': '3378'}