Generate Rejecto LM from Text File

Home Forums OpenEars plugins Generate Rejecto LM from Text File

Viewing 3 posts - 1 through 3 (of 3 total)

  • Author
    Posts
  • #1019962
    tyeh
    Participant

    Is it possible to have an interface generateRejectingLanguageModelFromTextFile, similar to generateLanguageModelFromTextFile?
    Thanks

    -Thomas

    #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.

    #1019964
    tyeh
    Participant

    Thanks for the suggestion. Looks easy enough never mind about adding the new interface then.
    -Thomas

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.