public IEnumerable <Tuple <int, Snippet> > ExtractSnippetsFromSubmission(Submission submission) { log.Info("Достаю сниппеты из решения {submissionId}, длина сниппетов: {tokensCount} токенов", submission.Id, configuration.AntiPlagiarism.SnippetTokensCount); var codeUnits = codeUnitsExtractor.Extract(submission.ProgramText, submission.Language); foreach (var codeUnit in codeUnits) { foreach (var tokenConverter in tokenConverters) { var snippets = snippetsExtractor.GetSnippets(codeUnit.Tokens, configuration.AntiPlagiarism.SnippetTokensCount, tokenConverter); foreach (var(index, snippet) in snippets.Enumerate()) { yield return(Tuple.Create(codeUnit.FirstTokenIndex + index, snippet)); } } } }
public List <TokenPosition> GetNeededTokensPositions(string program) { return(GetNeededTokensPositions(codeUnitsExtractor.Extract(program))); }