<commit_before>﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Documents;

namespace Wox.Converters
{
    public class HighlightTextConverter : IMultiValueConverter
    {
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo cultureInfo)
        {
            var text = value[0] as string;
            var highlightData = value[1] as List<int>;

            var textBlock = new Span();

            if (highlightData == null || !highlightData.Any())
            {
                // No highlight data, just return the text
                return new Run(text);
            }

            for (var i = 0; i < text.Length; i++)
            {
                var currentCharacter = text.Substring(i, 1);
                if (this.ShouldHighlight(highlightData, i))
                {
                    textBlock.Inlines.Add((new Run(currentCharacter)
                    {
                        FontWeight = FontWeights.Bold
                    }));
                }
                else
                {
                    textBlock.Inlines.Add(new Run(currentCharacter));
                }
            }
            return textBlock;
        }

        public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
        {<commit_msg>light color for unhighlight text<commit_after>﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;

namespace Wox.Converters
{
    public class HighlightTextConverter : IMultiValueConverter
    {
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo cultureInfo)
        {
            var text = value[0] as string;
            var highlightData = value[1] as List<int>;

            var textBlock = new Span();

            if (highlightData == null || !highlightData.Any())
            {
                // No highlight data, just return the text
                return new Run(text);
            }

            for (var i = 0; i < text.Length; i++)
            {
                var currentCharacter = text.Substring(i, 1);
                if (this.ShouldHighlight(highlightData, i))
                {
                    textBlock.Inlines.Add((new Run(currentCharacter)
                    {
                        FontWeight = FontWeights.Bold
                    }));
                }
                else
                {
                    textBlock.Inlines.Add(new Run(currentCharacter)
                    {
                        Foreground = Brushes.LightGray
                    });
                }
            }
            return textBlock;
        }

        public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
        {
{'fraction_non_alphanumeric': 0.084403080872914, 'fraction_numerical': 0.0025673940949935813, 'mean_word_length': 1.5781637717121588, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7045483', 'n_tokens_mistral': 781, 'n_tokens_neox': 735, 'n_words': 198}