tokestermw/tensorflow-shakespeare
关于
Neural machine translation between the writings of Shakespeare and modern English using TensorFlow
机器学习实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Shakespeare translations using TensorFlow
This is an example of using the new Google's TensorFlow library on monolingual translation going from modern English to Shakespeare based on research from Wei Xu.
Prepare
First download the TensorFlow library depending on your platform:
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl # for mac
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl # for ubuntu
- Grabs parallel data.
- Gets train, dev split.
- Builds vocabulary
- Converts parallel data into ids
From the root directory:
python -m tensorshake.get_data
python -m tensorshake.prepare_corpus
Delete /cache to start anew.
Train
Use the example BASH script to train the model. This saves the check points in the --train_dir directory.
If you run it again, the training process continues from the check point. To restart with fresh parameters,
simply delete/rename the check points.
./run.sh
Results
Benchmarks from original paper. (Shakespeare -> Modern English)
| Input | Output |
|---|---|
| i will bite thee by the ear for that jest . | i ’ ll bite you by the ear for that joke . |
| what further woe conspires against mine age ? | what ’ s true despair conspires against my old age ? |
| how doth my lady ? | how is my lady ? |
| hast thou slain tybalt ? | have you killed tybalt ? |
| an i might live to see thee married once , i have my wish . | if i could live to see you married, i ’ ve my wish . |
| benvolio , who began this bloody fray ? | benvolio , who started this bloody fight itself ? |
| what is your will ? | what do you want ? |
| call her forth to me . | bring her out to me . |
Cherrypicked examples from this repo (Modern English -> Shakespeare)
| Input | Output |
|---|---|
| but you’re not listening to me. | but you do not hear me . |
| Gregory, on my word, we will not be humiliated, like carrying coal. | regory , we 'll not carry coals . |
| but he got the promotion. | he is the friend . |
| i can hit quickly, if i'm motivated. | i strike , i am moved . |
| Did you just give us the finger, sir? | have you leave the thumb , sir ? |
| You don’t know what you’re doing! | you do not what you know you . |
| have you killed Tybalt? | hast thou slain tybalt ? |
| Why, Romeo, are you crazy? | why , art thou mad , mad ? |
Pre-Trained Models
Here is a link for an example model: https://s3-us-west-2.amazonaws.com/foxtype-nlp/tensorshake/model_cache.zip
Possible improvements
- word embeddings
- beam search
- language model reranking
探索相关项目
加载中…