How to use "Text > Summarize" via Automator, and are there some options like "Summary Size"?

(Japanese for now to ask.)


お世話になっております。

今回は macOS 標準機能 "Text > Summarize" を Automator から使用するにあたって、回避したいオプション設定があり、それを変更して実行する方法はないかと思い、質問いたします。


今般流行の GPT-4 の助けを大いに借りて、Automator によって駆動される ".pdf(s) ⇒ .txt(s)" の文章要約ワークフローを確立できました。数日かかりましたが技術革新、というよりは、人類が暗黙裏にアクセスしていた集合知に明示的にアクセスしやすくなると、こんなに作業が捗るのか、と驚嘆しております。

それは置くとして、この文章要約は macOS 標準機能の "Text > Summarize" をその安定性の観点(特に数万字クラスのテキストへの対応可能性)から採用し、ワークフローを組みました。


ですが、workflow から "Text > Summarize" にアクセスするときに、同機能の「要約サイズ(Summary Size)」が "1" に強制的にセットされるようで、ごくごく短い文へと要約されすぎてしまいます。


この「要約サイズ」あるいは「文もしくはパラグラフ単位での要約」別途指定して、 "Text > Summarize" を実行することは可能でしょうか?


当該コマンドは以下の通り。

summary=$(osascript -e "set theFile to POSIX file \"$f\"" -e "set theText to read theFile as «class utf8»" -e "set theSummary to summarize theText" -e "return theSummary")



是非とも練達の方のお知恵を拝借いたしたく。

何卒、宜敷お願いします。



投稿日 2023/04/11 21:15

返信
スレッドに付いたマーク ランキングトップの返信

投稿日 2023/04/11 22:43

AppleScript の辞書には次のようにありますから、in オプションを使えば良さそうです。


summarize v : Summarize the specified text or text file
summarize text or alias : the text (or an alias to a text file) to summarize
[in integer] : the number of sentences desired in the summary
→ text : a summarized version of the text or file


こんな感じでどうでしょうか。


変更前

set theSummary to summarize theText


変更後 (3 のところは適宜変更してください)

set theSummary to summarize theText in 3


返信: 3
スレッドに付いたマーク ランキングトップの返信

2023/04/11 22:43 renpoo への返信

AppleScript の辞書には次のようにありますから、in オプションを使えば良さそうです。


summarize v : Summarize the specified text or text file
summarize text or alias : the text (or an alias to a text file) to summarize
[in integer] : the number of sentences desired in the summary
→ text : a summarized version of the text or file


こんな感じでどうでしょうか。


変更前

set theSummary to summarize theText


変更後 (3 のところは適宜変更してください)

set theSummary to summarize theText in 3


このスレッドはシステム、またはAppleコミュニティチームによってロックされました。 問題解決の参考になる情報であれば、どの投稿にでも投票いただけます。またコミュニティで他の回答を検索することもできます。

How to use "Text > Summarize" via Automator, and are there some options like "Summary Size"?

Apple サポートコミュニティへようこそ
Apple ユーザ同士でお使いの製品について助け合うフォーラムです。Apple Account を使ってご参加ください。