news-generation
所属分类:数学计算
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2023-03-25 01:28:43
上 传 者:
sh-1993
说明: 谁的假新闻更好用马尔可夫链和LSTM比较“假”新闻的质量。机器学习课程的最终项目...
(Who fakes news better? Comparing quality of "fake" news generated with Markov chains and LSTMs. Final project for the machine learning class.)
文件列表:
LICENSE (1070, 2022-06-08)
data/ (0, 2022-06-08)
data/news_cleaned.csv (12978117, 2022-06-08)
results/ (0, 2022-06-08)
results/5gram_200size.txt (1098, 2022-06-08)
results/Batyr_report.pdf (63791, 2022-06-08)
results/generated_text_rnn_chars.txt (9218, 2022-06-08)
src/ (0, 2022-06-08)
src/data_processing.py (1783, 2022-06-08)
src/model_lstm_chars.py (2840, 2022-06-08)
src/model_ngrams.py (4496, 2022-06-08)
src/requirements.txt (180, 2022-06-08)
# News generation
Fake news generation using Markov chains (n-gram language modeling) and long-short term memory network (LSTM).
### Usage
Install dependencies (keras, tensorflow, numpy, pandas):
```bash
# Upgrade your pip3
python3 -m pip install --upgrade pip
# Install deps
pip3 install -U -r src/requirements.txt
```
Then, clean up your CSV containing tweets (e.g., remove stopwords):
```bash
python3 src/data_processing
```
If you want to run n-gram model, run the following command with the output csv file from the previous one:
```bash
python3 src/model_ngrams.py
```
If you would like to run LSTM model based on characters, run the following the same way:
```bash
python3 src/model_lstm_chars.py
```
These will either output results to command line, or generate a file called `generated_text_rnn_chars.txt`. Feel free to modify, play with the code, and contribute if you find a bug.
### Project report
To see the report, click [here](https://github.com/oneturkmen/news-generation/blob/master/./results/Batyr_report.pdf).
### Data clean-up
Code [here](https://github.com/oneturkmen/news-generation/blob/master/./src/data_processing.py)
### Examples of generated text
Using [n-grams (markov chain)](https://github.com/oneturkmen/news-generation/blob/master/./results/5gram_200size.txt)
Using [LSTM](https://github.com/oneturkmen/news-generation/blob/master/./results/generated_text_rnn_chars.txt)
近期下载者:
相关文件:
收藏者: