Reply To: Generate Rejecto LM from Text File

Home Forums OpenEars plugins Generate Rejecto LM from Text File Reply To: Generate Rejecto LM from Text File

#1019963
Halle Winkler
Politepix

Welcome,

I can consider adding it to Rejecto, but the code to handle it in your app is pretty brief if you want to do it right now:

NSError *error = nil;
NSString *textFileString = [NSString stringWithContentsOfFile:pathToMyTextFile encoding:NSUTF8StringEncoding error:&error];

if(error) {
  NSLog(@"Error reading in text file: %@", error);
}

NSArray *corpusArray = [textFileString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; 

That corpusArray can be used as your word array with Rejecto. LanguageModelGenerator’s version adds a bit more error checking and text normalization on the assumption that all kinds of weird input might go in, but that’s the basis of it.