• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to integrate local LLM for proofreading

Explorer ,
Mar 13, 2024 Mar 13, 2024

Copy link to clipboard

Copied

Hey folks,

I'm thinking of writing a script to add local LLM api support to FrameMaker. I basically want to get AI assisted proofreading/text correction by doing the following (using a local lightweight Mistral-7B model):

1. Select text, then send it via button press to an LLM client  running on my computer (LM Studio or ollama) for proofreading
2. Receive & process the proofreading results
3. Apply the suggestions to the text in FrameMaker

 

Before I dive into what might just be an impossible task due to ExtendScript limitations (I'd have to do quite a lot of digging, I'm not a real coder), do you think this is doable? I'd be very grateful for any insights, or tips where to start. 🙂🙏

Views

4.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 3 Correct answers

Community Expert , Mar 15, 2024 Mar 15, 2024

I gave you a headstart with this post:

https://community.adobe.com/t5/framemaker-discussions/get-framemaker-text-as-a-string/td-p/14491503

You will see that I have created a function for getting text from any FrameMaker text object (TextRange, Pgf, Flow, etc.). Functions like this are useful because you can plug them into any of your scripts as needed.

Votes

Translate

Translate
Community Expert , Mar 15, 2024 Mar 15, 2024
// Replace the selected text.
// You already have the selection in a varable.
doc.DeleteText (textRange);
doc.AddText (textRange.beg, correctedText);

Untested, but it should work.

Votes

Translate

Translate
Community Expert , Apr 15, 2024 Apr 15, 2024

These two short videos will explain text locations and text ranges:

https://youtu.be/6ywYWU4VC7g?si=pA7llQ5vS8nIlqwt

https://youtu.be/fH5giAcDp6Q?si=lerkUNDTWdSoLKjO

If you are in a hurry, the second one will show you how to select a paragraph.

Votes

Translate

Translate
Community Expert ,
Apr 15, 2024 Apr 15, 2024

Copy link to clipboard

Copied

LATEST

One caution with the paragraph selection code: when the selected text is replaced, any anchored objects in the selection (tables, anchored frames, markers, etc.) will be deleted.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines