Guest User

Untitled

a guest
Nov 20th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. select *
  2. from text_exp
  3. where regexp_like(text, '(.+)([^.!?])121')
  4.  
  5. select distinct x.*,
  6. regexp_substr(lower(text), '(w+?)s+(S*s)*?1', level) sub, level
  7. from ezhus.text_exp x
  8. connect by regexp_substr(lower(text), '(w+?)s+(S*s)*?1', level) is not null
  9. AND PRIOR TEXT = TEXT
  10. AND PRIOR dbms_random.value IS NOT NULL
  11.  
  12. select distinct x.*,
  13. regexp_substr(lower(text), '[^[:alpha:]]([a-zа-я]+)[, :;]+.*1[, :;]+.*1[, :;]*.*', level) sub,
  14. level
  15. from ezhus.text_exp x
  16. connect by regexp_substr(lower(text), '[^[:alpha:]]([a-zа-я]+)[, :;]+1[, :;]+1[, :;]*', level) is not null
  17. AND PRIOR TEXT = TEXT
  18. AND PRIOR dbms_random.value IS NOT NULL
  19.  
  20. with TEXTs(TEXT) as(
  21. select 'text abc gef text nm. text this is test abc this abc.' from DUAL
  22. union all
  23. select 'this is row two of the test text, word "text" is double.' from DUAL
  24. )
  25.  
  26.  
  27. select ID, pnum, word, p
  28. from (
  29. select ID, p, pnum, regexp_substr(p, 'w+', 1, level) word
  30. from (
  31. select ID, regexp_substr(text, '.*?(.|$)', 1, level) p, level as pnum
  32. from (select lower(text) as text, rownum as ID from TEXTs) x
  33. connect by regexp_substr(text, '.*?(.|$)', 1, level) is not null
  34. and PRIOR ID=ID and prior dbms_random.value is not null
  35. )
  36. connect by PRIOR ID=ID and PRIOR pnum=pnum and prior dbms_random.value is not null
  37. and regexp_substr(p, 'w+', 1, level) is not null
  38. )
  39. group by ID, p, pnum, word
  40. having count(1)>1
  41.  
  42. ID PNUM WORD P
  43. 1 1 text text abc gef text nm.
  44. 1 2 abc text this is test abc this abc.
  45. 1 2 this text this is test abc this abc.
  46. 2 1 is this is row two of the test text, word "text" is double.
  47. 2 1 text this is row two of the test text, word "text" is double.
  48.  
  49. select x.*,
  50. regexp_count(lower(text),
  51. '[^[:alpha:]]([a-zа-я]+)[, :;]+[^!.?]*1[, :;]+[^!.?]*1')cnt,
  52. regexp_count(lower(text),
  53. '^([a-zа-я]+)[, :;]+[^!.?]*1[, :;]+[^!.?]*1[^[:alpha:]]')cnt1
  54. from ezhus.text_exp x
  55. where regexp_count(lower(text),
  56. '[^[:alpha:]]([a-zа-я]+)[, :;]+[^!.?]*1[, :;]+[^!.?]*1') >= 1
  57. OR regexp_count(lower(text),
  58. '^([a-zа-я]+)[, :;]+[^!.?]*1[, :;]+[^!.?]*1[^[:alpha:]]') >= 1
  59.  
  60. select x.*
  61. from ezhus.text_exp x
  62. where regexp_like(regexp_replace(lower(text),
  63. '^([0-9a-zа-я]+)[, :;]+[^!.?]*1[, :;]+[^!.?]*1', ' '||text),
  64. '[^[0-9a-zа-я]]*([0-9a-zа-я]+)[, :;]+[^!.?]*1[, :;]+[^!.?]*1')
Add Comment
Please, Sign In to add comment