weblmInit: Initializes the 'mscsweblm4r' package.

Description Usage Author(s) Examples

View source: R/weblmInit.R

Description

This function initializes the Microsoft Cognitive Services Web Language Model REST API key and URL by reading them either from a configuration file or environment variables.

This function MUST be called right after package load and before calling any mscsweblm4r core functions, or these functions will fail.

The weblmInit configuration function will first check to see if the variable MSCS_WEBLANGUAGEMODEL_CONFIG_FILE exists in the system environment. If it does, the package will use that as the path to the configuration file.

If MSCS_WEBLANGUAGEMODEL_CONFIG_FILE doesn't exist, it will look for the file .mscskeys.json in the current user's home directory (that's ~/.mscskeys.json on Linux, and something like C:/Users/Phil/Documents/.mscskeys.json on Windows). If the file is found, the package will load the API key and URL from it.

If using a file, please make sure it has the following structure:

1
2
3
4
{
  "weblanguagemodelurl": "https://api.projectoxford.ai/text/weblm/v1.0/",
  "weblanguagemodelkey": "...MSCS Web Language Model API key goes here..."
}

If no configuration file is found, weblmInit will attempt to pick up its configuration information from two Sys env variables instead:

MSCS_WEBLANGUAGEMODEL_URL - the URL for the Web LM REST API.

MSCS_WEBLANGUAGEMODEL_KEY - your personal Web LM REST API key.

weblmInit needs to be called only once, after package load.

Usage

1

Author(s)

Phil Ferriere pferriere@hotmail.com

Examples

1
2
3
4
## Not run: 
 weblmInit()

## End(Not run)

mscsweblm4r documentation built on May 2, 2019, 3:46 p.m.