nlp_sentiment_translate: NLP Sentiment Generator/Translator

View source: R/nlp_translators.R

nlp_sentiment_translateR Documentation

NLP Sentiment Generator/Translator

Description

It will read the score code that is written as SAS Code extract the language and hostame, then write an R code equivalent using the SWAT package.

Usage

nlp_sentiment_translate(
  in_file = NULL,
  out_file = "SentimentScoreCode.R",
  zip = TRUE,
  in_caslib,
  in_castable,
  out_caslib,
  out_castable_sentiment,
  out_castable_matches,
  out_castable_features,
  key_column,
  document_column,
  hostname = NULL,
  astore = FALSE,
  astore_caslib = "casuser",
  astore_name = "Sentiment_Astore",
  astore_path = "SentimentModel.astore",
  copyVars = NULL
)

Arguments

in_file

Path to zip/sas file with the score code.

out_file

Path to the translated .R code file.

zip

Boolean, if the score code is inside a zip file. Default to TRUE. It will look for dmcas_epscorecode.sas file inside the zip.

in_caslib

caslib name of the input table

in_castable

input table name

out_caslib

caslib name of the output table

out_castable_sentiment

sentiment output table name

out_castable_matches

matches output table name, if the argument is not defined the table name will be the same as out_castable_sentiment with "_matches" added

out_castable_features

features output table name, if the argument is not defined the table name will be the same as out_castable_sentiment with "_features" added

key_column

Key column name for unique identifier

document_column

text variable column name

hostname

NULL by default, extracts the server name from scoring code file.

astore

If set to TRUE, it will create a scoring code that uploads the astore, available for SAS Viya 2021.1.4 or higher

astore_caslib

Only used when astore = TRUE. The caslib where the astore model is uploaded

astore_name

Only used when astore = TRUE. The castable name where the astore model is uploaded

astore_path

Only used when astore = TRUE. The filepath to the astore file (extract from .zip first)

copyVars

Only used when astore = TRUE default NULL, will not copy variables of the scoring table to the output. If "ALL" will copy all variables to the scored table output, if it is a vector, will copy named vars e.g: ⁠c("var1", "var2)⁠

Value

List object with the Rscore code, out castable, out caslib and the written file path.

Examples

nlp_sentiment_translate("filepath.zip")


sassoftware/sas-scoring-translator-r documentation built on Dec. 7, 2023, 11:55 p.m.