Skip to content

Commit

Permalink
google translate nb formatting (#12534)
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan authored Oct 30, 2023
1 parent e05bb93 commit b213850
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"! pip install google-cloud-translate\n"
"! pip install google-cloud-translate"
]
},
{
Expand All @@ -32,7 +32,7 @@
"outputs": [],
"source": [
"from langchain.schema import Document\n",
"from langchain.document_transformers import GoogleTranslateTransformer\n"
"from langchain.document_transformers import GoogleTranslateTransformer"
]
},
{
Expand Down Expand Up @@ -79,7 +79,7 @@
"\n",
"Lewis Cymbal\n",
"CEO, Cymbal Bank\n",
"\"\"\"\n"
"\"\"\""
]
},
{
Expand Down Expand Up @@ -107,7 +107,7 @@
"outputs": [],
"source": [
"documents = [Document(page_content=sample_text)]\n",
"translator = GoogleTranslateTransformer(project_id=\"<YOUR_PROJECT_ID>\")\n"
"translator = GoogleTranslateTransformer(project_id=\"<YOUR_PROJECT_ID>\")"
]
},
{
Expand Down Expand Up @@ -138,7 +138,9 @@
"metadata": {},
"outputs": [],
"source": [
"translated_documents = translator.transform_documents(documents, target_language_code=\"es\")\n"
"translated_documents = translator.transform_documents(\n",
" documents, target_language_code=\"es\"\n",
")"
]
},
{
Expand Down Expand Up @@ -187,7 +189,7 @@
"source": [
"for doc in translated_documents:\n",
" print(doc.metadata)\n",
" print(doc.page_content)\n"
" print(doc.page_content)"
]
}
],
Expand Down

0 comments on commit b213850

Please sign in to comment.