OpenAIPDFtextclassification

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Artificial Intelligence
Introduced first in SolidGeometry 5.5, Creation date: 2024-11-21, Last change: 2025-09-15

analyzes PDF scans with OCR content and create a file name for it



See Also:

Example Illustration

 missing image of OpenAIPDFtextclassification(fname,txtlen)

Syntax

fclass=OpenAIPDFtextclassification([fname,txtlen])

Input Parameter

fname: current file name
txtlen:

Output Parameter

fclass: proposed file name




Copyright 2024-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, OpenAIPDFtextclassification, is designed to analyze PDF files with OCR content and propose a file name based on the content. It is part of the SolidGeometry library, version 5.5, and was developed by Tim Lueth.

Input Parameters

Output

Algorithm Steps

  1. Check if the function is called from the command line. If so, retrieve the file name from the clipboard; otherwise, initialize fname as an empty string.
  2. Use getfuncparams to assign values to fname and txtlen from the input arguments or default values.
  3. Attempt to extract text from the file using extractFileText. If successful, trim and convert it to a character array; otherwise, set txt to an empty array.
  4. If the extracted text is less than 20 characters, set fclass to 'noOCR'.
  5. If the text length exceeds txtlen, truncate it to txtlen characters.
  6. Formulate a query string fff to classify the text content, asking for a summary in a specific format.
  7. Use the chat1 function to process the query and obtain the classification result, which is stored in fclass.
  8. If the function is called from the command line, copy the result to the clipboard.
Algorithm explaination created using ChatGPT on 2025-08-19 07:39. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21