## Not run:
# tryCatch({
#
# # Calculate joint probability a particular sequence of words will appear together
# jointProbabilities <- weblmCalculateJointProbability(
# inputWords = c("where", "is", "San", "Francisco", "where is",
# "San Francisco", "where is San Francisco"), # ASCII only
# modelToUse = "query", # "title"|"anchor"|"query"(default)|"body"
# orderOfNgram = 4L # 1L|2L|3L|4L|5L(default)
# )
#
# # Class and structure of jointProbabilities
# class(jointProbabilities)
# #> [1] "weblm"
#
# str(jointProbabilities, max.level = 1)
# #> List of 3
# #> $ results:'data.frame': 7 obs. of 2 variables:
# #> $ json : chr "{"results":[{"words":"where","probability":-3.378}, __truncated__ ]}
# #> $ request:List of 7
# #> ..- attr(*, "class")= chr "request"
# #> - attr(*, "class")= chr "weblm"
#
# # Print results
# pandoc.table(jointProbabilities$results)
# #> ------------------------------------
# #> words probability
# #> ---------------------- -------------
# #> where -3.378
# #>
# #> is -2.607
# #>
# #> san -3.292
# #>
# #> francisco -4.051
# #>
# #> where is -3.961
# #>
# #> san francisco -4.086
# #>
# #> where is san francisco -7.998
# #> ------------------------------------
#
# }, error = function(err) {
#
# # Print error
# geterrmessage()
#
# })
# ## End(Not run)
Run the code above in your browser using DataLab