- カテゴリ:
文字列とバイナリ関数 (大規模言語モデル)
TRANSLATE (SNOWFLAKE.CORTEX)¶
指定された入力テキストをサポートされている言語から別の言語に翻訳します。
注意
この関数は、検索文字列と置換文字列を指定しても文字列を変換しません。その機能については、 TRANSLATE をご参照ください。
構文¶
SNOWFLAKE.CORTEX.TRANSLATE(
<text>, <source_language>, <target_language>)
引数¶
戻り値¶
原文からターゲット言語への翻訳を含む文字列。
使用上の注意¶
以下の言語が TRANSLATE 関数でサポートされています。ソース言語とターゲット言語に対応する言語コードを使用します。
TRANSLATE モデルは、翻訳されるテキストに2つの異なる言語が混在している場合にも対応しています(例: 「スパングリッシュ」)。この場合、ソース言語として空の文字列(''
)を指定すると、ソーステキストで使用される言語が自動検出されます。
言語 |
コード |
---|---|
中国語 |
|
オランダ語 |
|
英語 |
|
フランス語: |
|
ドイツ語 |
|
ヒンディー語 |
|
イタリア語 |
|
日本語 |
|
韓国語 |
|
ポーランド語 |
|
ポルトガル語 |
|
ロシア語 |
|
スペイン語 |
|
スウェーデン語 |
|
TRANSLATE 関数は、ソース言語またはターゲット言語のいずれかが英語の場合に最良の結果を生成します(例: 英語からスペイン語、ドイツ語から英語)。ドイツ語からスペイン語など、他の言語ペアの結果は正確さに欠ける場合があります。
アクセス制御の要件¶
ユーザーは、 SNOWFLAKE.CORTEX_USER データベースロール が付与されているロールを使用する必要があります。この権限の詳細については、 必要な権限 をご参照ください。
例¶
次の例では、テーブルの各行を英語からドイツ語に翻訳しています(この例では、 review_content
は reviews
テーブルからの列です)。
SELECT SNOWFLAKE.CORTEX.TRANSLATE(review_content, 'en', 'de') FROM reviews LIMIT 10;
次の例では、架空の製品レビューを英語からスペイン語に翻訳しています。
SELECT SNOWFLAKE.CORTEX.TRANSLATE(
'Hit the slopes with Snowflake\'s latest innovation - "Skii Headphones" designed to keep your ears warm and your soul ablaze. Engineered specifically for snow weather, these rugged headphones combine crystal-clear sound with thermally-insulated ear cups to keep the chill out and the beats in. Whether you\'re carving through powder or cruising down groomers, Skii Headphones will fuel your mountain adventures with vibrant sound and unrelenting passion. Stay warm, stay fired up, and shred the mountain with Snowflake Skii Headphones',
'en','es');
このクエリの結果は次のとおりです。
Sube a las pistas con la última innovación de Snowflake: "Skii Headphones", diseñados para mantener tus oídos calientes y tu alma encendida. Diseñados específicamente para el clima de nieve, estos audífonos resistentes combinan un sonido cristalino con copas de oído aisladas térmicamente para mantener el frío fuera y los ritmos dentro. Ya sea que estés esculpiendo en polvo o deslizándote por pistas preparadas, los Skii Headphones alimentarán tus aventuras en la montaña con un sonido vibrante y una pasión incesante. Mantente caliente, mantente encendido y arrasa la montaña con los Skii Headphones de Snowflake.
次の例では、通話記録をドイツ語から英語に翻訳しています。
SELECT SNOWFLAKE.CORTEX.TRANSLATE
('Kunde: Hallo
Agent: Hallo, ich hoffe, es geht Ihnen gut. Um Ihnen am besten helfen zu können, teilen Sie bitte Ihren Vor- und Nachnamen und den Namen der Firma, von der aus Sie anrufen.
Kunde: Ja, hier ist Thomas Müller von SkiPisteExpress.
Agent: Danke Thomas, womit kann ich Ihnen heute helfen?
Kunde: Also wir haben die XtremeX Helme in Größe M bestellt, die wir speziell für die kommende Wintersaison benötigen. Jedoch sind alle Schnallen der Helme defekt, und keiner schließt richtig.
Agent: Ich verstehe, dass das ein Problem für Ihr Geschäft sein kann. Lassen Sie mich überprüfen, was mit Ihrer Bestellung passiert ist. Um zu bestätigen: Ihre Bestellung endet mit der Nummer 56682?
Kunde: Ja, das ist meine Bestellung.
Agent: Ich sehe das Problem. Entschuldigen Sie die Unannehmlichkeiten. Ich werde sofort eine neue Lieferung mit reparierten Schnallen für Sie vorbereiten, die in drei Tagen bei Ihnen eintreffen sollte. Ist das in Ordnung für Sie?
Kunde: Drei Tage sind ziemlich lang, ich hatte gehofft, diese Helme früher zu erhalten. Gibt es irgendeine Möglichkeit, die Lieferung zu beschleunigen?
Agent: Ich verstehe Ihre Dringlichkeit. Ich werde mein Bestes tun, um die Lieferung auf zwei Tage zu beschleunigen. Wie kommst du damit zurecht?
Kunde: Das wäre großartig, ich wäre Ihnen sehr dankbar.
Agent: Kein Problem, Thomas. Ich kümmere mich um die eilige Lieferung. Danke für Ihr Verständnis und Ihre Geduld.
Kunde: Vielen Dank für Ihre Hilfe. Auf Wiedersehen!
Agent: Bitte, gerne geschehen. Auf Wiedersehen und einen schönen Tag noch!'
,'de','en');
結果は次のとおりです。
Customer: Hello
Agent: Hello, I hope you are well. To best assist you, please share your first and last name and the name of the company you are calling from.
Customer: Yes, this is Thomas Müller from SkiPisteExpress.
Agent: Thank you, Thomas, what can I help you with today?
Customer: So, we ordered the XtremeX helmets in size M, which we specifically need for the upcoming winter season. However, all the buckles on the helmets are defective and none of them close properly.
Agent: I understand that this can be a problem for your business. Let me check what happened with your order. To confirm: your order ends with the number 56682?
Customer: Yes, that's my order.
Agent: I see the issue. I apologize for the inconvenience. I will prepare a new delivery with repaired buckles for you immediately, which should arrive in three days. Is that okay for you?
Customer: Three days is quite a long time; I was hoping to receive these helmets sooner. Is there any way to expedite the delivery?
Agent: I understand your urgency. I will do my best to expedite the delivery to two days. How does that sound?
Customer: That would be great, I would be very grateful.
Agent: No problem, Thomas. I will take care of the urgent delivery. Thank you for your understanding and patience.
Customer: Thank you very much for your help. Goodbye!
Agent: You're welcome. Goodbye and have a nice day!
最後に、次の例では、2つの異なる言語(大文字と小文字)から英語への翻訳を説明します。ソース言語の指定は空文字列であることに注意してください。
SELECT SNOWFLAKE.CORTEX.TRANSLATE ('Voy a likear tus fotos en Insta.', '', 'en')
このクエリ結果は次のとおりです。
I'm going to like your photos on Insta.
法的通知¶
Snowflake AI と ML をご参照ください。