Skip to content

Instantly share code, notes, and snippets.

@riow1983
Created October 4, 2017 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riow1983/fb9c58e8ad4a24281d870ad51e6e230e to your computer and use it in GitHub Desktop.
Save riow1983/fb9c58e8ad4a24281d870ad51e6e230e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from mshonyaku import translate, add_translate"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'You are the boss.'"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# translate\n",
"textToTranslate = \"上司に確認してきます。\"\n",
"fromLangCode = \"ja\"\n",
"toLangCode = \"en\"\n",
"\n",
"translate(textToTranslate=textToTranslate, fromLangCode=fromLangCode, toLangCode=toLangCode)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<Response [200]>"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# add_translate\n",
"originalText = textToTranslate\n",
"translatedText = \"I will verify with my boss.\"\n",
"fromLangCode = \"ja\"\n",
"toLangCode = \"en\"\n",
"\n",
"\n",
"add_translate(originalText=originalText, translatedText=translatedText, \n",
" fromLangCode=fromLangCode, toLangCode=toLangCode)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'I will verify with my boss.'"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# translate after add_translation\n",
"textToTranslate = \"上司に確認してきます。\"\n",
"fromLangCode = \"ja\"\n",
"toLangCode = \"en\"\n",
"\n",
"translate(textToTranslate=textToTranslate, fromLangCode=fromLangCode, toLangCode=toLangCode)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment