PDF_EXTRACT_TEXT- PDFファイルからテキストコンテンツを抽出
DOCX_EXTRACT_TEXT- DOCXファイルからテキストコンテンツを抽出
JINBA_FLEX_PARSER- Jinba Flex Parser APIを使用してドキュメントをテキストに解析。PDF、DOCX、画像など、さまざまなファイル形式をサポート
WORD_TABLE_EXTRACT- Word文書からテーブルデータをJSONとして抽出
WORD_TABLE_UPDATE- Word文書のテーブルデータを更新
TRANSLATE_PPTX_FILE- PowerPoint(PPTX)ファイルのテキストコンテンツを異なる言語に翻訳
CONVERTER_HTML_TO_PDF および CONVERTER_HTML_TO_DOCX を参照してください。
認証は不要です。文書処理ツールは、ファイルURLまたはbase64エンコードされたファイルで直接動作します。
PDF・DOCXからテキストを抽出する
- id: upload_pdf
name: upload_pdf
tool: INPUT_TEXT
input:
- name: description
value: "Base64エンコードされたPDFファイル"
- id: upload_docx
name: upload_docx
tool: INPUT_TEXT
input:
- name: description
value: "Base64エンコードされたDOCXファイル"
- id: extract_pdf_text
name: extract_pdf_text
tool: PDF_EXTRACT_TEXT
needs: [upload_pdf]
input:
- name: pdf_base64
value: "{{steps.upload_pdf.result}}"
- id: extract_docx_text
name: extract_docx_text
tool: DOCX_EXTRACT_TEXT
needs: [upload_docx]
input:
- name: docx_base64
value: "{{steps.upload_docx.result}}"
- id: analyze_extracted_text
name: analyze_extracted_text
tool: OPENAI_INVOKE
needs: [extract_pdf_text, extract_docx_text]
config:
- name: version
value: gpt-5.2
input:
- name: prompt
value: |
以下の抽出されたテキストを分析し、以下を提供してください:
1. 主要トピックの要約
2. 重要な発見や重要なポイント
3. 言及されたアクションアイテム
PDFコンテンツ: {{steps.extract_pdf_text.result}}
DOCXコンテンツ: {{steps.extract_docx_text.result}}
例: Jinba Flex Parserでドキュメントを解析
JINBA_FLEX_PARSER は、URL上のドキュメントを解析して抽出したテキストを返します。URLベースのファイルをそのまま処理でき(base64エンコード不要)、PDF、DOCX、画像などをサポートしています。
入力:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
fileUrl | string | はい | 解析するファイルのURL |
endpointType | enum | いいえ | default(標準の解析サービス、推奨)、custom(ユーザー指定URLを使うオンプレミス環境向け)、legacy(非推奨)。デフォルトは default |
customEndpointUrl | string | いいえ | カスタムエンドポイントのURL。endpointType が custom の場合は必須 |
| フィールド | 説明 |
|---|---|
apiKey | 解析エンドポイントのAPIキー。空白の場合はJinbaクレジットを使用 |
result: ドキュメントから解析されたテキストコンテンツ
- id: upload_source_document
name: upload_source_document
tool: INPUT_FILE
input:
- name: description
value: "解析するドキュメント(PDF、DOCX、画像など)"
- id: parse_document
name: parse_document
tool: JINBA_FLEX_PARSER
needs: [upload_source_document]
input:
- name: fileUrl
value: "{{steps.upload_source_document.result}}"
- id: summarize_document
name: summarize_document
tool: OPENAI_INVOKE
needs: [parse_document]
config:
- name: version
value: gpt-5.2
input:
- name: prompt
value: |
以下のドキュメントを要約してください:
{{steps.parse_document.result}}
例: 文書分析パイプライン
- id: upload_document
name: upload_document
tool: INPUT_FILE
input:
- name: description
value: "分析する文書"
- id: determine_file_type
name: determine_file_type
tool: PYTHON_SANDBOX_RUN
needs: [upload_document]
input:
- name: data_type
value: OBJECT
- name: code
value: |
import base64
import json
import requests
# ファイル情報を取得
file_url = "{{steps.upload_document.result}}"
file_name = "{{steps.upload_document.filenames}}".lower()
if file_name.endswith('.pdf'):
file_type = 'pdf'
elif file_name.endswith('.docx'):
file_type = 'docx'
else:
file_type = 'unknown'
content = requests.get(file_url).content
print(json.dumps({
"file_type": file_type,
"filename": file_name,
"base64": base64.b64encode(content).decode('utf-8')
}))
- id: extract_text_pdf
name: extract_text_pdf
tool: PDF_EXTRACT_TEXT
needs: [determine_file_type]
when: "steps.determine_file_type.result.data.file_type == 'pdf'"
input:
- name: pdf_base64
value: "{{steps.determine_file_type.result.data.base64}}"
- id: extract_text_docx
name: extract_text_docx
tool: DOCX_EXTRACT_TEXT
needs: [determine_file_type]
when: "steps.determine_file_type.result.data.file_type == 'docx'"
input:
- name: docx_base64
value: "{{steps.determine_file_type.result.data.base64}}"
- id: process_extracted_text
name: process_extracted_text
tool: PYTHON_SANDBOX_RUN
needs: [extract_text_pdf, extract_text_docx]
input:
- name: data_type
value: OBJECT
- name: code
value: |
import json
# ファイル形式に応じて抽出したテキストを取得
pdf_text = r'''{{steps.extract_text_pdf.result}}'''
docx_text = r'''{{steps.extract_text_docx.result}}'''
# テキストを結合して整形
extracted_text = pdf_text or docx_text or ""
# 基本的なテキスト分析
word_count = len(extracted_text.split())
char_count = len(extracted_text)
# 重要と思われるセクションを抽出
lines = extracted_text.split('\n')
important_lines = [line.strip() for line in lines if
any(keyword in line.lower() for keyword in
['summary', 'conclusion', 'action', 'todo', 'next steps'])]
result = {
"text": extracted_text,
"word_count": word_count,
"character_count": char_count,
"important_sections": important_lines[:10] # 上位10件まで
}
print(json.dumps(result))
- id: generate_document_summary
name: generate_document_summary
tool: OPENAI_INVOKE
needs: [determine_file_type, process_extracted_text]
config:
- name: version
value: gpt-5.2
input:
- name: prompt
value: |
この文書の包括的な要約を作成してください:
文書: {{steps.determine_file_type.result.data.filename}}
単語数: {{steps.process_extracted_text.result.data.word_count}}
コンテンツ:
{{steps.process_extracted_text.result.data.text}}
以下を提供してください:
1. エグゼクティブサマリー(2-3文)
2. 主要トピックとテーマ
3. 重要な事実やデータポイント
4. アクションアイテムや推奨事項
5. 全体的な評価
Wordの表を抽出する
- id: extract_word_table
name: extract_word_table
tool: WORD_TABLE_EXTRACT
config:
- name: timeout
value: 300000
input:
- name: file_url
value: "https://example.com/document.docx"
- name: table_index
value: 0
- id: process_table_data
name: process_table_data
tool: PYTHON_SANDBOX_RUN
needs: [extract_word_table]
input:
- name: data_type
value: OBJECT
- name: code
value: |
import json
# 前のステップからテーブルデータを取得
table_data = {{steps.extract_word_table.result}}
# テーブルデータを処理
processed_data = []
headers = table_data[0] if table_data else []
for row in table_data[1:]: # ヘッダー行をスキップ
row_dict = {}
for i, cell in enumerate(row):
if i < len(headers):
row_dict[headers[i]] = cell
processed_data.append(row_dict)
print(json.dumps({"processed_table": processed_data}))
- id: save_to_spreadsheet
name: save_to_spreadsheet
tool: GOOGLE_SPREADSHEET_ADD_ROWS
needs: [process_table_data]
config:
- name: token
value: "{{secrets.GOOGLE_SHEETS_OAUTH}}"
input:
- name: sheet_id
value: "your_spreadsheet_id"
- name: sheet_title
value: "抽出されたデータ"
- name: rows
value: "{{steps.process_table_data.result.data.processed_table}}"
PowerPointを翻訳する
- id: upload_presentation
name: upload_presentation
tool: INPUT_FILE
input:
- name: description
value: "翻訳するPowerPointファイルをアップロード"
- id: translate_to_spanish
name: translate_to_spanish
tool: TRANSLATE_PPTX_FILE
needs: [upload_presentation]
input:
- name: value
value: "{{steps.upload_presentation.result}}"
- name: target_lang
value: "es"
- id: translate_to_french
name: translate_to_french
tool: TRANSLATE_PPTX_FILE
needs: [upload_presentation]
input:
- name: value
value: "{{steps.upload_presentation.result}}"
- name: target_lang
value: "fr"
- id: translate_to_japanese
name: translate_to_japanese
tool: TRANSLATE_PPTX_FILE
needs: [upload_presentation]
input:
- name: value
value: "{{steps.upload_presentation.result}}"
- name: target_lang
value: "ja"
- id: create_download_links
name: create_download_links
tool: PYTHON_SANDBOX_RUN
needs: [upload_presentation, translate_to_spanish, translate_to_french, translate_to_japanese]
input:
- name: code
value: |
import json
# 翻訳結果を収集
original_file = "{{steps.upload_presentation.filenames}}"
spanish_url = "{{steps.translate_to_spanish.result.url}}"
french_url = "{{steps.translate_to_french.result.url}}"
japanese_url = "{{steps.translate_to_japanese.result.url}}"
translations = {
"original_file": original_file,
"translations": [
{"language": "スペイン語 (es)", "download_url": spanish_url},
{"language": "フランス語 (fr)", "download_url": french_url},
{"language": "日本語 (ja)", "download_url": japanese_url}
]
}
print("=== PowerPoint翻訳完了 ===")
print(f"元のファイル: {original_file}")
print("\n翻訳されたバージョンが利用可能:")
for trans in translations["translations"]:
print(f" • {trans['language']}: {trans['download_url']}")
# さらなる処理のためのJSON出力
print(f"\nJSON出力: {json.dumps(translations, ensure_ascii=False)}")
対応言語
TRANSLATE_PPTX_FILEツールは標準言語コードを使用してさまざまな言語への翻訳をサポートします:
主要言語コード:
- en: 英語
- es: スペイン語
- fr: フランス語
- de: ドイツ語
- it: イタリア語
- pt: ポルトガル語
- ru: ロシア語
- ja: 日本語
- ko: 韓国語
- zh: 中国語(簡体字)
- ar: アラビア語
- hi: ヒンディー語
- nl: オランダ語
- sv: スウェーデン語
- da: デンマーク語
- no: ノルウェー語
- fi: フィンランド語
使用上の注意:
- 翻訳は元の書式とスライド構造を保持します
- 画像内のテキストは翻訳できません(テキストボックスと図形のみ)
- 複雑なアニメーションと画面切り替え効果は保持されます
- 翻訳後のファイルサイズは若干変動する場合があります
- 処理時間はプレゼンテーションのサイズと複雑さに依存します
ヒントとベストプラクティス
- base64エンコードファイルのサポートにより安全なファイル処理が可能
- 処理前に常にファイルタイプを検証する
- 大きな文書を処理する際は適切なタイムアウトを検討する
- 破損したファイルやサポートされていないファイルのエラーハンドリングを実装する
- 構造化データ分析のためにテキストとは別にテーブルを抽出する
- より良い分析結果のためにテキストのクリーニングと前処理を検討する