tokestermw/tensorflow-shakespeare
概要
Neural machine translation between the writings of Shakespeare and modern English using TensorFlow
AI・機械学習計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- 0
- 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
関連プロジェクトを探す
読み込み中…