This package contains code and data for inferring word-level political bias from labeled texts.

Cite this work
Yihong Zhang and Takahiro Hara, Extracting Political Interest Model from Interaction Data Based on Novel Word-level Bias Assignment. ACM Transactions on Intelligent Systems and Technology. 2024.

Files
- BiDEL.py: code file
- politician_text_tokens.txt: text file
- politician_text_tokens_label_tag.txt: label file, labeled according to text authors
- vis_hashtags_small.txt: a small set of hashtags for visualization
- word_to_embedding_idx.npy: 10,000 words for studying

Running the code:
python BiDEL.py

Result of running the code
During running, the code will output two files
- word_political_bias.txt: learned bias of the words included in word_to_embedding_idx.npy
- word_embeddings_BIDEL.npy: the complete embeddings including the semantics and bias of the words
At the end of running, a visualization of selected hashtags will be shown.

Tested on this environment:
- python 3.9.0
- tensorflow 2.10.0
