public Result <HashSet <string> > InitializeBoringWords(TagCloudCreationOptions options) { if (options.PathToBoringWords.HasNoValue) { return(Result.Fail <HashSet <string> >("No path was given")); } return(boringWords == null?ReadWords(options.PathToBoringWords.Value) : Result.Ok(boringWords)); }
public string PrepareWord(string word, TagCloudCreationOptions options) { if (options.PathToBoringWords == null) { return(word); } if (!boringWords.IsValueCreated) { path = options.PathToBoringWords; } return(boringWords.Value.Contains(word) ? null : word); }
public override void Run(string[] startupArgs) { parser.Parse(startupArgs); if (isHelpShown) { End(); return; } var options = new TagCloudCreationOptions(new ImageCreatingOptions(brush, font, center)); Read(wordsFile) .Then(ws => Creator.CreateImage(ws, options)) .Then(i => i.Save(outputPath)) .Then(none => End($"Here you go{Environment.NewLine}\tFile is saved successfully into {outputPath}")) .OnFail(err => End(error: err)); }
public override void Run(string[] startupArgs) { parser.Parse(startupArgs); if (isHelpShown) { End(); return; } var options = new TagCloudCreationOptions(new ImageCreatingOptions(brush, font, center)); if (!TryRead(wordsFile, out var words)) { Console.Error.WriteLine("Can not read given file"); End(); return; } using (var image = Creator.CreateImage(words, options)) image.Save(outputPath); Console.Out.WriteLine($"Here you go{Environment.NewLine}\tFile is saved successfully into {outputPath}"); End(); }
public override string PrepareWord(string word, TagCloudCreationOptions options) => ProcessWordByTag(word, (tag, w) => tag == PartOfSpeech.Preposition ? null : w);
public Result <Maybe <string> > PrepareWord(string word, TagCloudCreationOptions options) { return(InitializeBoringWords(options) .Then(r => r.Contains(word) ? Maybe <string> .None : word)); }
/// <inheritdoc cref="IWordPreparer" /> public string PrepareWord(string word, TagCloudCreationOptions _) { var preparedWord = word.ToLowerInvariant(); return(word == string.Empty ? null : preparedWord); }