more aggressive extracting

This commit is contained in:
mehbark 2024-11-25 15:02:42 -05:00
parent 121ed94fe6
commit f0be1697f9

View file

@ -7,7 +7,7 @@ MIN_8S = 5
def expand(set) def expand(set)
cased = set + set.map(&:downcase) + set.map(&:upcase) cased = set + set.map(&:downcase) + set.map(&:upcase)
spaced = cased + cased.map { _1.gsub(/\s/, ' ') } + cased.map { _1.gsub(/\s/, "\n") } + cased.flat_map do |amulet| spaced = cased + cased.map { _1.gsub(/\s/, ' ') } + cased.map { _1.gsub(/\s/, "\n") } + cased.flat_map do |amulet|
20.times.map { amulet.gsub(/\s/) { rand(2).zero? ? ' ' : "\n" } } 100.times.map { amulet.gsub(/\s/) { rand(2).zero? ? ' ' : "\n" } }
end end
spaced + spaced.flat_map { _1.match?(/[.?!]$/) ? [_1.gsub('.', '?'), _1.gsub('?', '.')] : ["#{_1}.", "#{_1}?"] } spaced + spaced.flat_map { _1.match?(/[.?!]$/) ? [_1.gsub('.', '?'), _1.gsub('?', '.')] : ["#{_1}.", "#{_1}?"] }
end end