Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"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
You can’t perform that action at this time.