Beispiel #1
0
        public async Task Process(WordsDictionary wordsDictionary)
        {
            if (IsCorrect)
            {
                return;
            }

            results = new ConcurrentBag <WordDistance>();
            await Task.Run(() => Parallel.ForEach(wordsDictionary.Dictionaries, GetTopDistances));

            SuggestedWords = results.OrderBy(e => e.Distance).Select(e => e.Word).Distinct().Take(HeapCapacity).ToList();
        }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();

            tooltipDictionary = new eDictionary();
            var tooltip = new RichTextBoxToolTip
            {
                RichTextBox      = textArea,
                Dictionary       = tooltipDictionary,
                TitlePrefix      = "Alternatywy dla wyrazu \"",
                TitleSuffix      = "\": ",
                TitleBrush       = Brushes.DarkBlue,
                TitleFont        = new Font(textArea.SelectionFont, FontStyle.Bold),
                DescriptionFont  = new Font(textArea.SelectionFont, FontStyle.Regular),
                DescriptionBrush = Brushes.Blue,
            };

            wordsDictionary = new WordsDictionary();
            words           = new List <Word>();
        }
Beispiel #3
0
 public Word(string value, WordsDictionary wordsDictionary)
 {
     Value     = value.ToLower();
     IsCorrect = wordsDictionary.Dictionaries.Any(d => d.Contains(Value));
 }