textRuleScore

loadTableFromDisk

Description

Loads a binary model file, such as a sentiment analysis model (SAM), a category model (MCO), or a concept model (LI), from a specified path on the client machine and creates a CAS table containing the binary data. This action is essential for making externally compiled models available for use in subsequent CAS actions within the textRuleScore action set.

textRuleScore.loadTableFromDisk / caslib="string", casOut={casouttable}, path="string";
Settings
ParameterDescription
pathSpecifies the full path on the controller where the binary model file (SAM, MCO, or LI) is located.
casOutSpecifies the output CAS table that will be created to store the binary model data. This table is required for subsequent scoring actions.
caslibSpecifies the CAS library to be used. While the documentation lists it, the primary caslib is often defined by the session context.
Data Preparation View data prep sheet
Prerequisite: Have a Binary Model File on the Server

This action does not create data in the traditional sense. It requires a pre-compiled binary model file (e.g., .sam for sentiment, .mco for categories, .li for concepts) to be present on the CAS server's file system at a path accessible by the server. The following examples assume that such files exist.

Copied!
1/* No SAS code is needed to create the model file here. */
2/* Assumption: A sentiment model file named 'sentiment.sam' exists in the '/path/to/your/models/' directory on the CAS server. */

Examples

This example demonstrates how to load a sentiment analysis model from a .sam binary file located on the server into a new CAS table named 'sentiment_model'. The 'replace=true' option ensures that if the table already exists, it will be overwritten.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3textRuleScore.loadTableFromDisk / path='/path/to/your/models/sentiment.sam' casOut={name='sentiment_model', replace=true};
4 
5RUN;
6 
Result :
The action creates a new CAS table named 'sentiment_model' in the active caslib. This table contains the binary data from the 'sentiment.sam' file. The SAS log will show a confirmation note indicating the successful creation of the output table.

This example loads a category model from a .mco binary file into a CAS table named 'category_model'. The 'promote=true' option makes the table available to all subsequent CAS sessions, not just the current one. A descriptive label is also added to the output table for better identification.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3textRuleScore.loadTableFromDisk / path='/path/to/your/models/categories.mco' casOut={name='category_model', caslib='casuser', replace=true, promote=true, label='My Category Model for Scoring'};
4 
5RUN;
6 
Result :
A global-scope CAS table named 'category_model' is created in the 'casuser' library. The table is labeled 'My Category Model for Scoring' and can be accessed by other users and sessions until the session ends or it's explicitly dropped. The log will confirm the creation and promotion of the table.

This example shows how to load a concept model (LITI model) from a .li binary file into a CAS table. This is a common step before using the 'applyConcept' action to extract concepts from a document collection.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3textRuleScore.loadTableFromDisk / path='/path/to/your/models/concepts.li' casOut={name='concepts_model_table', replace=true};
4 
5RUN;
6 
Result :
A session-scope CAS table named 'concepts_model_table' is created in the active caslib. It holds the binary content of the 'concepts.li' model, ready to be used as input for the 'config' parameter in the 'applyConcept' action.

FAQ

What is the primary function of the loadTableFromDisk action?
What is the purpose of the 'path' parameter?
Which parameter is mandatory for specifying the output table?
Can I specify the CAS library for the source file?