0

I have a simple program through which I'm trying to predict the next word and I get the error

"Error in model$word : $ operator is invalid for atomic vectors".

Can you please help me understand how to get rid of this error?

Following is the code that I'm trying to execute:

include.packages("ANLP")
library(ANLP)
setwd("C:/Users/s.maramreddy/OneDrive - Accenture/Personal/R/Capstone/Coursera-SwiftKey/final/en_US")
model <- readRDS("model.RDS")
testcorp <- "what is"
predict_Backoff(testcorp, model, isDebugMode = T)

Following is the structure of the variable "model"

str(model)

This gives

'data.frame':   108725 obs. of  2 variables:
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • [this](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) link might help you rephrase your question. Pls provide small sample data and reproducible code so that others can guide you in right direction. Cheers! – Prem Dec 28 '17 at 08:17

1 Answers1

0

please provide some sample data so we can check it our end meanwhile you can implement any backoff method by your own which will give you more insight about backoff methods, here the process which you need to follow

  1. Clean your data
  2. Take a sample if your dataset is big
  3. Create ngram model of the sampled data
  4. Implement Stupid backoff which in less expensive than Katz backoff and gives better accuracy

follow these links which will give you more insight

Vineet
  • 1,492
  • 4
  • 17
  • 31