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:
{
"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.
weblmInit()## Not run:
# weblmInit()
# ## End(Not run)
Run the code above in your browser using DataLab