Ejemplo n.º 1
0
        internal static void Get(ref string text, ObservableCollection <DictionaryPasswordElement> obserColl)
        {
            //wykrycie cytatów bez ostatniej kropki
            var regex = new Regex(@"\D+\d*(, s\. \d*|, \d*|,\d*, s. dod. \d*|,\d*, s. \d*|,\d*)?");

            var match = regex.Match(text.TrimStart());

            while (match.Success && IsNumber(match.Value.Last()) && match.Value.Length > 5 ||
                   match.Success && match.Value.Contains("cyt."))
            {
                WriteText.Write(match.Value.Last() == '.' ? match.Value.TrimStart() : match.Value.TrimStart() + ".", "cytat", obserColl);
                var z = match.Length + 2 < text.Length ? match.Length + 2 : match.Length;

                text = text.Remove(0, z);

                if (!IsNullOrEmpty(text) && text != "." && text.Length > 4)
                {
                    match = regex.Match(text);
                }
                else
                {
                    break;
                }
            }
        }
        internal static void Get(ref string text, string recognizeText, Dictionary <string, string> dictionary, ObservableCollection <DictionaryPasswordElement> obserColl)
        {
            var e = RecognizeMeaningWord.Get(recognizeText, dictionary);

            WriteText.Write(recognizeText, e, obserColl);
            text = text.Remove(0, recognizeText.Length + 1);
        }
Ejemplo n.º 3
0
        internal static void Get(ref string text,
                                 Dictionary <string, string> dictionary,
                                 ObservableCollection <DictionaryPasswordElement> obserColl)
        {
            var definiendum = "";
            var regex       = new Regex(@"\D*? ");
            var matches     = regex.Matches(text);

            foreach (Match match in matches)
            {
                if (match == matches[0])
                {
                    definiendum += match.Value;
                    continue;
                }

                if (!dictionary.ContainsKey(match.Value.TrimEnd(' ', ',')) &&
                    match.Value[0] != '«' && match.Value[0] != '~')
                {
                    definiendum += match.Value;
                }
                else
                {
                    WriteText.Write(definiendum.TrimEnd(' '), "definiendum",
                                    obserColl);
                    text = text.Remove(0, definiendum.Length);
                    break;
                }
            }
        }
        internal static void Get(ref string text, ObservableCollection <DictionaryPasswordElement> obserColl)
        {
            var regex = new Regex(@"<.*>");
            var match = regex.Match(text);

            if (match.Success)
            {
                WriteText.Write(match.Value.TrimEnd(), "wyjaśnienie etymologiczne wyrazu", obserColl);
                text = text.Replace(match.Value, "");
            }
        }
Ejemplo n.º 5
0
        internal static void Get(ref string text, ObservableCollection <DictionaryPasswordElement> obserColl)
        {
            var regex = new Regex(@"«.*?»");
            var match = regex.Match(text);

            if (match.Success)
            {
                WriteText.Write(match.Value.TrimEnd(), "definiens", obserColl);
                text = text.Replace(match.Value, "");
            }
        }
Ejemplo n.º 6
0
        internal static void Get(ref string text, Dictionary <string, string> dictionary, ObservableCollection <DictionaryPasswordElement> obserColl)
        {
            //wykrycie odwołania i nadanie opisu
            var regex = new Regex(@"\/+ \w+|\/+\w+");
            var match = regex.Match(text);

            if (match.Success)
            {
                var e = RecognizeMeaningWord.Get(match.Value, dictionary);
                WriteText.Write(match.Value, e, obserColl);
                text = text.Remove(0, match.Length + 1);
            }
        }
Ejemplo n.º 7
0
        internal static void Get(string text, Dictionary <string, string> dictionary, ObservableCollection <DictionaryPasswordElement> obserColl)
        {
            text = text.Replace('«', ' ').TrimEnd();

            var regex     = new Regex(@"odm. jak \D ");
            var match     = regex.Match(text);
            var splitText = text.Split(' ');

            for (var i = 0; i < splitText.Length; i++)
            {
                switch (splitText[i])
                {
                case "":
                case ":":
                case ".":
                case "'":
                    break;

                case "odm.":
                {
                    i = +3;
                    var e = RecognizeMeaningWord.Get(match.Value.Trim()
                                                     , dictionary);
                    WriteText.Write(match.Value.Trim(), e, obserColl);
                    break;
                }

                case "–":
                case "-":
                    WriteText.Write(splitText[i] + " " + splitText[i + 1]
                                    , "definiendum", obserColl);
                    i += 1;
                    break;

                default:
                {
                    var e = RecognizeMeaningWord.Get(splitText[i].Replace(",", ""), dictionary);
                    WriteText.Write(splitText[i].Replace(",", ""), e, obserColl);
                    break;
                }
                }
            }
        }