daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Oct 20th, 2018 65 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. string sensPattenr = @"[.!?]+s*";
  2. string wordPattern = @"[s,;]+|s*[а-я]х+[,s;]";
  3.    
  4. var data = "Мама, ax ax,, мыла раму 25/05/2015 ух;25раз!!! Потом 26/05/2015 смотрела, ох долго, фх,фх Дом2!... Без хх труда не выловишь и рыбку из пруда?!! 27/05/2015 она ых отдыхала…";
  5.    
  6. var lines = data.Split('!', '?', '.').Where(x=>!string.IsNullOrWhiteSpace(x));
  7.    
  8. var words = lines.Select(x => x.Split(' ', ',', ';').Where(s => !string.IsNullOrWhiteSpace(s) && !new[] { 'x', 'х' }.Any(s.ToLower().Contains)).ToList());
  9.    
  10. var result = words.Where(x => x.Count >= 3 && x.Any(a => DateTime.TryParse(a, out _))).Select(x => x.Select(s => s.Any(char.IsDigit) ? $"({s})" : s).ToList()).ToList();
  11.    
  12. result.ForEach(x=>Console.WriteLine(string.Join(" ", x.Skip(Math.Max(0, x.Count - 2)))));
  13.    
  14. var data = "Мама, ax ax,, мыла раму 25/05/2015 ух;25раз!!! Потом 26/05/2015 смотрела, ох долго, фх,фх Дом2!... Без хх труда не выловишь и рыбку из пруда?!! 27/05/2015 она ых отдыхала…";
  15. var lines = data.Split('!', '?', '.').Where(x => !string.IsNullOrWhiteSpace(x));
  16.  
  17. var words = lines.Select(x =>
  18.     x.Split(' ', ',', ';')
  19.         .Where(s => !string.IsNullOrWhiteSpace(s) && !new[] {'x', 'х'}.Any(s.ToLower().Contains)).ToList());
  20.  
  21. var result = words.Where(x => x.Count >= 3 && x.Any(a => DateTime.TryParse(a, out _)))
  22.     .Select(x => x.Select(s => s.Any(char.IsDigit) ? $"({s})" : s).ToList()).ToList();
  23.  
  24. result.ForEach(x => Console.WriteLine(string.Join(" ", x.Skip(Math.Max(0, x.Count - 2)))));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top