public override void UpdateModel(Models.Anime model, string lexeme) { var audioAndSubs = (IEnumerable <string>)Tokenize(lexeme); var lastUpdated = model.Video.LastOrDefault(v => v.AudioAndSubs == null); if (lastUpdated == null) { model.Video.Add(new VideoContent { AudioAndSubs = audioAndSubs }); } else { lastUpdated.AudioAndSubs = audioAndSubs; } }
public override void UpdateModel(Models.Anime model, string lexeme) { var series = (Series)Tokenize(lexeme); var lastUpdated = model.Video.LastOrDefault(v => v.Series == null); if (lastUpdated == null) { model.Video.Add(new VideoContent { Series = series }); } else { lastUpdated.Series = series; } }
public Models.Anime Parse(string title) { var anime = new Models.Anime { Title = title }; var lexemes = _scanner.Scan(title); foreach (var lexeme in lexemes) { var tokenizer = _tokenizers.FirstOrDefault(t => t.TokenType == lexeme.Type); if (tokenizer == null) { throw new TokenizerException("No tokenizer found for lexeme", lexeme.String, lexeme.Type); } tokenizer.UpdateModel(anime, lexeme.String); } return(anime); }
public override void UpdateModel(Models.Anime model, string lexeme) { model.Types = (IEnumerable <Models.Anime.Type>)Tokenize(lexeme); }
public override void UpdateModel(Models.Anime model, string lexeme) { model.Traits = (Traits)Tokenize(lexeme); }
public override void UpdateModel(Models.Anime model, string lexeme) { model.OtherInfo.Add((string)Tokenize(lexeme)); }
public abstract void UpdateModel(Models.Anime model, string lexeme);
public void MainTest(string title, Models.Anime expected) { var actual = _lexer.Parse(title); Assert.AreEqual(expected, actual); }