weblmListAvailableModels: Retrieves the list of web language models available.

Description Usage Value Author(s) Examples

View source: R/weblmListAvailableModels.R

Description

This function retrieves the list of web language models currently available.

Internally, this function invokes the Microsoft Cognitive Services Web Language Model REST API documented at https://www.microsoft.com/cognitive-services/en-us/web-language-model-api/documentation.

You MUST have a valid Microsoft Cognitive Services account and an API key for this function to work properly. See https://www.microsoft.com/cognitive-services/en-us/pricing for details.

Usage

1

Value

An S3 object of the class weblm. The list of available language models is stored in the results dataframe inside this object. The dataframe includes a short description of the corpus used to build the model, the name of the model, the max N-gram order supported, and a list of Web Language Model REST API methods supported by each model.

Author(s)

Phil Ferriere pferriere@hotmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## Not run: 
 tryCatch({

   # Retrieve a list of supported web language models
   modelList <- weblmListAvailableModels()

   # Class and structure of modelList
   class(modelList)          # weblm
   #> [1] "weblm"

   str(modelList, max.level = 1)
   #> List of 3
   #>  $ results:'data.frame':  4 obs. of  7 variables:
   #>  $ json   : chr "{"models":[{"corpus":"bing webpage title text 2013-12", __truncated__ }]}
   #>  $ request:List of 7
   #>   ..- attr(*, "class")= chr "request"
   #>  - attr(*, "class")= chr "weblm"

   # Print partial results
   pandoc.table(modelList$results[1:3])
   #> -------------------------------------------------
   #>             corpus              model   maxOrder
   #> ------------------------------ ------- ----------
   #>    bing webpage title text      title      5
   #>            2013-12
   #>
   #> bing webpage body text 2013-12   body      5
   #>
   #>  bing web query text 2013-12    query      5
   #>
   #>    bing webpage anchor text    anchor      5
   #>            2013-12
   #> -------------------------------------------------


 }, error = function(err) {

   # Print error
   geterrmessage()

 })

## End(Not run)

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