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
- fname: The current file name. If the function is called from the command line, it retrieves the file name from the clipboard.
- txtlen: The maximum length of text to analyze. If not provided, it defaults to 1000 characters.
Output
- fclass: The proposed file name based on the content analysis.
Algorithm Steps
- 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.
- Use
getfuncparams
to assign values to fname
and txtlen
from the input arguments or default values.
- 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.
- If the extracted text is less than 20 characters, set
fclass
to 'noOCR'.
- If the text length exceeds
txtlen
, truncate it to txtlen
characters.
- Formulate a query string
fff
to classify the text content, asking for a summary in a specific format.
- Use the
chat1
function to process the query and obtain the classification result, which is stored in fclass
.
- 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