owoify_rb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/owoify_rb.rb +50 -0
- data/lib/structures/word.rb +87 -0
- data/lib/utility/interleave_arrays.rb +18 -0
- data/lib/utility/mapping.rb +266 -0
- data/lib/utility/presets.rb +28 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9c5ef42f5ec72bae1411fdcaece64ee8c7c0ce9c4d55e730cd18fb2116b29405
|
4
|
+
data.tar.gz: 230cf5823096322fbc244f5a36a41ca2df9dd78de5c432ffef8b5c439d1ddb2d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0deeed2549bb1f785ac43912b2e3a5061ebe74871f4483adb3bf6adfc3b523bf37477f6d5d5f84ff7428ccc77152e5e0f159ce0df12f8c19a3608b3e09d18929
|
7
|
+
data.tar.gz: 770217b7781da31d1fbed9f3c68ea57b4271721a936551eae1372444bdded626e0b4cc4eb06b2484ad5d839dbe4115f9355f3d0c5655b13156215225a233e4da
|
data/lib/owoify_rb.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'structures/word'
|
4
|
+
require 'utility/interleave_arrays'
|
5
|
+
require 'utility/presets'
|
6
|
+
|
7
|
+
module Owoify
|
8
|
+
def self.owoify(source, level = 'owo')
|
9
|
+
word_matches = source.scan(/[^\s]+/).flatten
|
10
|
+
space_matches = source.scan(/\s+/).flatten
|
11
|
+
words = word_matches.map { |x| Word.new(x) }
|
12
|
+
spaces = space_matches.map { |x| Word.new(x) }
|
13
|
+
_level = level.downcase
|
14
|
+
words.map! do |w|
|
15
|
+
SPECIFIC_WORD_MAPPING_LIST.each do |f|
|
16
|
+
w = f.call(w)
|
17
|
+
end
|
18
|
+
case _level
|
19
|
+
when 'owo'
|
20
|
+
OWO_MAPPING_LIST.each do |f|
|
21
|
+
w = f.call(w)
|
22
|
+
end
|
23
|
+
when 'uwu'
|
24
|
+
UWU_MAPPING_LIST.each do |f|
|
25
|
+
w = f.call(w)
|
26
|
+
end
|
27
|
+
OWO_MAPPING_LIST.each do |f|
|
28
|
+
w = f.call(w)
|
29
|
+
end
|
30
|
+
when 'uvu'
|
31
|
+
UVU_MAPPING_LIST.each do |f|
|
32
|
+
w = f.call(w)
|
33
|
+
end
|
34
|
+
UWU_MAPPING_LIST.each do |f|
|
35
|
+
w = f.call(w)
|
36
|
+
end
|
37
|
+
OWO_MAPPING_LIST.each do |f|
|
38
|
+
w = f.call(w)
|
39
|
+
end
|
40
|
+
else
|
41
|
+
raise ArgumentError, 'The specified owoify level is not supported.'
|
42
|
+
end
|
43
|
+
w
|
44
|
+
end
|
45
|
+
|
46
|
+
result = interleave_arrays(words, spaces)
|
47
|
+
result_strings = result.map(&:to_s)
|
48
|
+
result_strings.join
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
class Word
|
6
|
+
def initialize(word)
|
7
|
+
@replaced_words = Set.new
|
8
|
+
@word = word
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
@word
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def search_value_contains_replaced_words(search_value, replace_value)
|
18
|
+
@replaced_words.any? do |word|
|
19
|
+
if search_value.match? word
|
20
|
+
match_result = search_value.match(word)[0]
|
21
|
+
return word.gsub(match_result, replace_value) == replace_value
|
22
|
+
end
|
23
|
+
false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
public
|
28
|
+
|
29
|
+
def replace(search_value, replace_value, replace_replaced_words = false)
|
30
|
+
return self if !replace_replaced_words && search_value_contains_replaced_words(search_value, replace_value)
|
31
|
+
|
32
|
+
replacing_word = @word
|
33
|
+
replacing_word = @word.gsub(search_value, replace_value) if search_value.match? @word
|
34
|
+
collection = @word.scan(search_value).flatten
|
35
|
+
replaced_words = collection.length > 1 ? collection.map { |x| x.gsub(x, replace_value) } : []
|
36
|
+
|
37
|
+
if replacing_word != @word
|
38
|
+
replaced_words.each do |word|
|
39
|
+
@replaced_words.add(word)
|
40
|
+
end
|
41
|
+
@word = replacing_word
|
42
|
+
end
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def replace_with_func_single(search_value, func, replace_replaced_words = false)
|
47
|
+
replace_value = func.call
|
48
|
+
|
49
|
+
return self if !replace_replaced_words && search_value_contains_replaced_words(search_value, replace_value)
|
50
|
+
|
51
|
+
replacing_word = @word
|
52
|
+
if search_value.match? @word
|
53
|
+
match = @word.match(search_value)[0]
|
54
|
+
replacing_word = @word.gsub(match, replace_value)
|
55
|
+
end
|
56
|
+
collection = @word.scan(search_value).flatten
|
57
|
+
replaced_words = collection.length > 1 ? collection.map { |x| x.gsub(x, replace_value) } : []
|
58
|
+
if replacing_word != @word
|
59
|
+
replaced_words.each do |word|
|
60
|
+
@replaced_words.add(word)
|
61
|
+
end
|
62
|
+
@word = replacing_word
|
63
|
+
end
|
64
|
+
self
|
65
|
+
end
|
66
|
+
|
67
|
+
def replace_with_func_multiple(search_value, func, replace_replaced_words = false)
|
68
|
+
return self unless search_value.match? @word
|
69
|
+
|
70
|
+
word = @word
|
71
|
+
captures = search_value.match(word)
|
72
|
+
replace_value = func.call(captures[1], captures[2])
|
73
|
+
|
74
|
+
return self if !replace_replaced_words && search_value_contains_replaced_words(search_value, replace_value)
|
75
|
+
|
76
|
+
replacing_word = @word.gsub(captures[0], replace_value)
|
77
|
+
collection = @word.scan(search_value).flatten
|
78
|
+
replaced_words = collection.length > 1 ? collection.map { |x| x.gsub(x, replace_value) } : []
|
79
|
+
if replacing_word != @word
|
80
|
+
replaced_words.each do |w|
|
81
|
+
@replaced_words.add(w)
|
82
|
+
end
|
83
|
+
@word = replacing_word
|
84
|
+
end
|
85
|
+
self
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def interleave_arrays(a, b)
|
4
|
+
arr = []
|
5
|
+
observed = a
|
6
|
+
other = b
|
7
|
+
temp = []
|
8
|
+
|
9
|
+
while observed.length.positive?
|
10
|
+
arr.push(observed.delete_at(0))
|
11
|
+
temp = observed
|
12
|
+
observed = other
|
13
|
+
other = temp
|
14
|
+
end
|
15
|
+
|
16
|
+
arr += other.length.positive? ? other : []
|
17
|
+
arr
|
18
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'structures/word'
|
4
|
+
|
5
|
+
O_TO_OWO = /o/.freeze
|
6
|
+
EW_TO_UWU = /ew/.freeze
|
7
|
+
HEY_TO_HAY = /([Hh])ey/.freeze
|
8
|
+
DEAD_TO_DED_UPPER = /Dead/.freeze
|
9
|
+
DEAD_TO_DED_LOWER = /dead/.freeze
|
10
|
+
N_VOWEL_T_TO_ND = /n[aeiou]*t/.freeze
|
11
|
+
READ_TO_WEAD_UPPER = /Read/.freeze
|
12
|
+
READ_TO_WEAD_LOWER = /read/.freeze
|
13
|
+
BRACKETS_TO_STARTRAILS_FORE = /[({<]/.freeze
|
14
|
+
BRACKETS_TO_STARTRAILS_REAR = /[)}>]/.freeze
|
15
|
+
PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_FIRST = /[.,](?![0-9])/.freeze
|
16
|
+
PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_SECOND = /[!;]+/.freeze
|
17
|
+
THAT_TO_DAT_UPPER = /That/.freeze
|
18
|
+
THAT_TO_DAT_LOWER = /that/.freeze
|
19
|
+
TH_TO_F_UPPER = /TH(?!E)/.freeze
|
20
|
+
TH_TO_F_LOWER = /[Tt]h(?![Ee])/.freeze
|
21
|
+
LE_TO_WAL = /le$/.freeze
|
22
|
+
VE_TO_WE_UPPER = /Ve/.freeze
|
23
|
+
VE_TO_WE_LOWER = /ve/.freeze
|
24
|
+
RY_TO_WWY = /ry/.freeze
|
25
|
+
RORL_TO_W_UPPER = /(?:R|L)/.freeze
|
26
|
+
RORL_TO_W_LOWER = /(?:r|l)/.freeze
|
27
|
+
LL_TO_WW = /ll/.freeze
|
28
|
+
VOWEL_OR_R_EXCEPT_O_L_TO_WL_UPPER = /[AEIUR]([lL])$/.freeze
|
29
|
+
VOWEL_OR_R_EXCEPT_O_L_TO_WL_LOWER = /[aeiur]l$/.freeze
|
30
|
+
OLD_TO_OWLD_UPPER = /OLD/.freeze
|
31
|
+
OLD_TO_OWLD_LOWER = /([Oo])ld/.freeze
|
32
|
+
OL_TO_OWL_UPPER = /OL/.freeze
|
33
|
+
OL_TO_OWL_LOWER = /([Oo])l/.freeze
|
34
|
+
LORR_O_TO_WO_UPPER = /[LR]([oO])/.freeze
|
35
|
+
LORR_O_TO_WO_LOWER = /[lr]o/.freeze
|
36
|
+
SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_UPPER = /([BCDFGHJKMNPQSTXYZ])([oO])/.freeze
|
37
|
+
SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_LOWER = /([bcdfghjkmnpqstxyz])o/.freeze
|
38
|
+
VORW_LE_TO_WAL = /[vw]le/.freeze
|
39
|
+
FI_TO_FWI_UPPER = /FI/.freeze
|
40
|
+
FI_TO_FWI_LOWER = /([Ff])i/.freeze
|
41
|
+
VER_TO_WER = /([Ff])i/.freeze
|
42
|
+
POI_TO_PWOI = /([Pp])oi/.freeze
|
43
|
+
SPECIFIC_CONSONANTS_LE_TO_LETTER_AND_WAL = /([DdFfGgHhJjPpQqRrSsTtXxYyZz])le$/.freeze
|
44
|
+
CONSONANT_R_TO_CONSONANT_W = /([BbCcDdFfGgKkPpQqSsTtWwXxZz])r/.freeze
|
45
|
+
LY_TO_WY_UPPER = /Ly/.freeze
|
46
|
+
LY_TO_WY_LOWER = /ly/.freeze
|
47
|
+
PLE_TO_PWE = /([Pp])le/.freeze
|
48
|
+
NR_TO_NW_UPPER = /NR/.freeze
|
49
|
+
NR_TO_NW_LOWER = /nr/.freeze
|
50
|
+
FUC_TO_FWUC = /([Ff])uc/.freeze
|
51
|
+
MOM_TO_MWOM = /([Mm])om/.freeze
|
52
|
+
ME_TO_MWE = /([Mm])e/.freeze
|
53
|
+
N_VOWEL_TO_NY_FIRST = /n([aeiou])/.freeze
|
54
|
+
N_VOWEL_TO_NY_SECOND = /N([aeiou])/.freeze
|
55
|
+
N_VOWEL_TO_NY_THIRD = /N([AEIOU])/.freeze
|
56
|
+
OVE_TO_UV_UPPER = /OVE/.freeze
|
57
|
+
OVE_TO_UV_LOWER = /ove/.freeze
|
58
|
+
HAHA_TO_HEHE_XD = /\b(ha|hah|heh|hehe)+\b/.freeze
|
59
|
+
THE_TO_TEH = /\b([Tt])he\b/.freeze
|
60
|
+
YOU_TO_U_UPPER = /\bYou\b/.freeze
|
61
|
+
YOU_TO_U_LOWER = /\byou\b/.freeze
|
62
|
+
TIME_TO_TIM = /\b([Tt])ime\b/.freeze
|
63
|
+
OVER_TO_OWOR = /([Oo])ver/.freeze
|
64
|
+
WORSE_TO_WOSE = /([Ww])orse/.freeze
|
65
|
+
|
66
|
+
FACES = [
|
67
|
+
'(・`ω´・)', ';;w;;', 'owo', 'UwU', '>w<', '^w^', '(* ^ ω ^)',
|
68
|
+
'(⌒ω⌒)', 'ヽ(*・ω・)ノ', '(o´∀`o)', '(o・ω・o)', '\(^▽^)/',
|
69
|
+
'(*^ω^)', '(◕‿◕✿)', '(◕ᴥ◕)', 'ʕ•ᴥ•ʔ', 'ʕ→ᴥ←ʔ', '(*^.^*)', '(。♥‿♥。)',
|
70
|
+
'OwO', 'uwu', 'uvu', 'UvU', '(* ̄з ̄)', '(つ✧ω✧)つ', '(/ =ω=)/',
|
71
|
+
'(╯°□°)╯︵ ┻━┻', '┬─┬ ノ( ゜-゜ノ)', '¯\_(ツ)_/¯'
|
72
|
+
].freeze
|
73
|
+
|
74
|
+
module Mapping
|
75
|
+
|
76
|
+
MAP_O_TO_OWO = lambda do |input|
|
77
|
+
replacement = rand(2) > 0 ? 'owo' : 'o'
|
78
|
+
input.replace(O_TO_OWO, replacement)
|
79
|
+
end
|
80
|
+
|
81
|
+
MAP_EW_TO_UWU = lambda do |input|
|
82
|
+
input.replace(EW_TO_UWU, 'uwu')
|
83
|
+
end
|
84
|
+
|
85
|
+
MAP_HEY_TO_HAY = lambda do |input|
|
86
|
+
input.replace(HEY_TO_HAY, '\1ay')
|
87
|
+
end
|
88
|
+
|
89
|
+
MAP_DEAD_TO_DED = lambda do |input|
|
90
|
+
input = input.replace(DEAD_TO_DED_UPPER, 'Ded')
|
91
|
+
input.replace(DEAD_TO_DED_LOWER, 'ded')
|
92
|
+
end
|
93
|
+
|
94
|
+
MAP_N_VOWEL_T_TO_ND = lambda do |input|
|
95
|
+
input.replace(N_VOWEL_T_TO_ND, 'nd')
|
96
|
+
end
|
97
|
+
|
98
|
+
MAP_READ_TO_WEAD = lambda do |input|
|
99
|
+
input = input.replace(READ_TO_WEAD_UPPER, 'Wead')
|
100
|
+
input.replace(READ_TO_WEAD_LOWER, 'wead')
|
101
|
+
end
|
102
|
+
|
103
|
+
MAP_BRACKETS_TO_STAR_TRAILS = lambda do |input|
|
104
|
+
input = input.replace(BRACKETS_TO_STARTRAILS_FORE, '。・:*:・゚★,。・:*:・゚☆')
|
105
|
+
input.replace(BRACKETS_TO_STARTRAILS_REAR, '☆゚・:*:・。,★゚・:*:・。')
|
106
|
+
end
|
107
|
+
|
108
|
+
MAP_PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS = lambda do |input|
|
109
|
+
num = rand * FACES.length
|
110
|
+
index = num.floor
|
111
|
+
input = input.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_FIRST, lambda { " #{FACES[index]}" })
|
112
|
+
|
113
|
+
num = rand * FACES.length
|
114
|
+
index = num.floor
|
115
|
+
input.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_SECOND, lambda { " #{FACES[index]}" })
|
116
|
+
end
|
117
|
+
|
118
|
+
MAP_THAT_TO_DAT = lambda do |input|
|
119
|
+
input = input.replace(THAT_TO_DAT_LOWER, 'dat')
|
120
|
+
input.replace(THAT_TO_DAT_UPPER, 'Dat')
|
121
|
+
end
|
122
|
+
|
123
|
+
MAP_TH_TO_F = lambda do |input|
|
124
|
+
input = input.replace(TH_TO_F_LOWER, 'f')
|
125
|
+
input.replace(TH_TO_F_UPPER, 'F')
|
126
|
+
end
|
127
|
+
|
128
|
+
MAP_LE_TO_WAL = lambda do |input|
|
129
|
+
input.replace(LE_TO_WAL, 'wal')
|
130
|
+
end
|
131
|
+
|
132
|
+
MAP_VE_TO_WE = lambda do |input|
|
133
|
+
input = input.replace(VE_TO_WE_LOWER, 'we')
|
134
|
+
input.replace(VE_TO_WE_UPPER, 'We')
|
135
|
+
end
|
136
|
+
|
137
|
+
MAP_RY_TO_WWY = lambda do |input|
|
138
|
+
input.replace(RY_TO_WWY, 'wwy')
|
139
|
+
end
|
140
|
+
|
141
|
+
MAP_R_OR_L_TO_W = lambda do |input|
|
142
|
+
input = input.replace(RORL_TO_W_LOWER, 'w')
|
143
|
+
input.replace(RORL_TO_W_UPPER, 'W')
|
144
|
+
end
|
145
|
+
|
146
|
+
MAP_LL_TO_WW = lambda do |input|
|
147
|
+
input.replace(LL_TO_WW, 'ww')
|
148
|
+
end
|
149
|
+
|
150
|
+
MAP_VOWEL_OR_R_EXCEPT_O_L_TO_WL = lambda do |input|
|
151
|
+
input = input.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_LOWER, 'wl')
|
152
|
+
input.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_UPPER, 'W\1')
|
153
|
+
end
|
154
|
+
|
155
|
+
MAP_OLD_TO_OWLD = lambda do |input|
|
156
|
+
input = input.replace(OLD_TO_OWLD_LOWER, '\1wld')
|
157
|
+
input.replace(OLD_TO_OWLD_UPPER, 'OWLD')
|
158
|
+
end
|
159
|
+
|
160
|
+
MAP_OL_TO_OWL = lambda do |input|
|
161
|
+
input = input.replace(OL_TO_OWL_LOWER, '\1wl')
|
162
|
+
input.replace(OL_TO_OWL_UPPER, 'OWL')
|
163
|
+
end
|
164
|
+
|
165
|
+
MAP_L_OR_R_O_TO_WO = lambda do |input|
|
166
|
+
input = input.replace(LORR_O_TO_WO_LOWER, 'wo')
|
167
|
+
input.replace(LORR_O_TO_WO_UPPER, 'W\1')
|
168
|
+
end
|
169
|
+
|
170
|
+
MAP_SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO = lambda do |input|
|
171
|
+
input = input.replace(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_LOWER, '\1wo')
|
172
|
+
input.replace_with_func_multiple(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_UPPER, lambda do |s1, s2|
|
173
|
+
msg = s1
|
174
|
+
msg += s2.upcase == s2 ? 'W' : 'w'
|
175
|
+
msg += s2
|
176
|
+
msg
|
177
|
+
end)
|
178
|
+
end
|
179
|
+
|
180
|
+
MAP_V_OR_W_LE_TO_WAL = lambda do |input|
|
181
|
+
input.replace(VORW_LE_TO_WAL, 'wal')
|
182
|
+
end
|
183
|
+
|
184
|
+
MAP_FI_TO_FWI = lambda do |input|
|
185
|
+
input = input.replace(FI_TO_FWI_LOWER, '\1wi')
|
186
|
+
input.replace(FI_TO_FWI_UPPER, 'FWI')
|
187
|
+
end
|
188
|
+
|
189
|
+
MAP_VER_TO_WER = lambda do |input|
|
190
|
+
input.replace(VER_TO_WER, 'wer')
|
191
|
+
end
|
192
|
+
|
193
|
+
MAP_POI_TO_PWOI = lambda do |input|
|
194
|
+
input.replace(POI_TO_PWOI, '\1woi')
|
195
|
+
end
|
196
|
+
|
197
|
+
MAP_SPECIFIC_CONSONANTS_LE_TO_LETTER_AND_WAL = lambda do |input|
|
198
|
+
input.replace(SPECIFIC_CONSONANTS_LE_TO_LETTER_AND_WAL, '\1wal')
|
199
|
+
end
|
200
|
+
|
201
|
+
MAP_CONSONANT_R_TO_CONSONANT_W = lambda do |input|
|
202
|
+
input.replace(CONSONANT_R_TO_CONSONANT_W, '\1w')
|
203
|
+
end
|
204
|
+
|
205
|
+
MAP_LY_TO_WY = lambda do |input|
|
206
|
+
input = input.replace(LY_TO_WY_LOWER, 'wy')
|
207
|
+
input.replace(LY_TO_WY_UPPER, 'Wy')
|
208
|
+
end
|
209
|
+
|
210
|
+
MAP_PLE_TO_PWE = lambda do |input|
|
211
|
+
input.replace(PLE_TO_PWE, '\1we')
|
212
|
+
end
|
213
|
+
|
214
|
+
MAP_NR_TO_NW = lambda do |input|
|
215
|
+
input = input.replace(NR_TO_NW_LOWER, 'nw')
|
216
|
+
input.replace(NR_TO_NW_UPPER, 'NW')
|
217
|
+
end
|
218
|
+
|
219
|
+
MAP_FUC_TO_FWUC = lambda do |input|
|
220
|
+
input.replace(FUC_TO_FWUC, '\1wuc')
|
221
|
+
end
|
222
|
+
|
223
|
+
MAP_MOM_TO_MWOM = lambda do |input|
|
224
|
+
input.replace(MOM_TO_MWOM, '\1wom')
|
225
|
+
end
|
226
|
+
|
227
|
+
MAP_ME_TO_MWE = lambda do |input|
|
228
|
+
input.replace(ME_TO_MWE, '\1we')
|
229
|
+
end
|
230
|
+
|
231
|
+
MAP_N_VOWEL_TO_NY = lambda do |input|
|
232
|
+
input = input.replace(N_VOWEL_TO_NY_FIRST, 'ny\1')
|
233
|
+
input = input.replace(N_VOWEL_TO_NY_SECOND, 'Ny\1')
|
234
|
+
input.replace(N_VOWEL_TO_NY_THIRD, 'NY\1')
|
235
|
+
end
|
236
|
+
|
237
|
+
MAP_OVE_TO_UV = lambda do |input|
|
238
|
+
input = input.replace(OVE_TO_UV_LOWER, 'uv')
|
239
|
+
input.replace(OVE_TO_UV_UPPER, 'UV')
|
240
|
+
end
|
241
|
+
|
242
|
+
MAP_HAHA_TO_HEHE_XD = lambda do |input|
|
243
|
+
input.replace(HAHA_TO_HEHE_XD, 'hehe xD')
|
244
|
+
end
|
245
|
+
|
246
|
+
MAP_THE_TO_TEH = lambda do |input|
|
247
|
+
input.replace(THE_TO_TEH, '\1eh')
|
248
|
+
end
|
249
|
+
|
250
|
+
MAP_YOU_TO_U = lambda do |input|
|
251
|
+
input = input.replace(YOU_TO_U_UPPER, 'U')
|
252
|
+
input.replace(YOU_TO_U_LOWER, 'u')
|
253
|
+
end
|
254
|
+
|
255
|
+
MAP_TIME_TO_TIM = lambda do |input|
|
256
|
+
input.replace(TIME_TO_TIM, '\1im')
|
257
|
+
end
|
258
|
+
|
259
|
+
MAP_OVER_TO_OWOR = lambda do |input|
|
260
|
+
input.replace(OVER_TO_OWOR, '\1wor')
|
261
|
+
end
|
262
|
+
|
263
|
+
MAP_WORSE_TO_WOSE = lambda do |input|
|
264
|
+
input.replace(WORSE_TO_WOSE, '\1ose')
|
265
|
+
end
|
266
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'utility/mapping'
|
4
|
+
|
5
|
+
SPECIFIC_WORD_MAPPING_LIST = [
|
6
|
+
Mapping::MAP_FUC_TO_FWUC, Mapping::MAP_MOM_TO_MWOM, Mapping::MAP_TIME_TO_TIM, Mapping::MAP_ME_TO_MWE,
|
7
|
+
Mapping::MAP_N_VOWEL_TO_NY, Mapping::MAP_OVER_TO_OWOR, Mapping::MAP_OVE_TO_UV, Mapping::MAP_HAHA_TO_HEHE_XD,
|
8
|
+
Mapping::MAP_THE_TO_TEH, Mapping::MAP_YOU_TO_U, Mapping::MAP_READ_TO_WEAD, Mapping::MAP_WORSE_TO_WOSE
|
9
|
+
].freeze
|
10
|
+
|
11
|
+
UVU_MAPPING_LIST = [
|
12
|
+
Mapping::MAP_O_TO_OWO, Mapping::MAP_EW_TO_UWU, Mapping::MAP_HEY_TO_HAY, Mapping::MAP_DEAD_TO_DED,
|
13
|
+
Mapping::MAP_N_VOWEL_T_TO_ND
|
14
|
+
].freeze
|
15
|
+
|
16
|
+
UWU_MAPPING_LIST = [
|
17
|
+
Mapping::MAP_BRACKETS_TO_STAR_TRAILS, Mapping::MAP_PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS,
|
18
|
+
Mapping::MAP_THAT_TO_DAT, Mapping::MAP_TH_TO_F, Mapping::MAP_LE_TO_WAL, Mapping::MAP_VE_TO_WE, Mapping::MAP_RY_TO_WWY,
|
19
|
+
Mapping::MAP_R_OR_L_TO_W
|
20
|
+
].freeze
|
21
|
+
|
22
|
+
OWO_MAPPING_LIST = [
|
23
|
+
Mapping::MAP_LL_TO_WW, Mapping::MAP_VOWEL_OR_R_EXCEPT_O_L_TO_WL, Mapping::MAP_OLD_TO_OWLD,
|
24
|
+
Mapping::MAP_OL_TO_OWL, Mapping::MAP_L_OR_R_O_TO_WO, Mapping::MAP_SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO,
|
25
|
+
Mapping::MAP_V_OR_W_LE_TO_WAL, Mapping::MAP_FI_TO_FWI, Mapping::MAP_VER_TO_WER, Mapping::MAP_POI_TO_PWOI,
|
26
|
+
Mapping::MAP_SPECIFIC_CONSONANTS_LE_TO_LETTER_AND_WAL, Mapping::MAP_CONSONANT_R_TO_CONSONANT_W,
|
27
|
+
Mapping::MAP_LY_TO_WY, Mapping::MAP_PLE_TO_PWE, Mapping::MAP_NR_TO_NW
|
28
|
+
].freeze
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: owoify_rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chehui Chou
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This is a Ruby port of mohan-cao's owoify-js, which will help you turn
|
14
|
+
any string into nonsensical babyspeak similar to LeafySweet's infamous Chrome extension.
|
15
|
+
email:
|
16
|
+
- tetsuki.syu1126@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/owoify_rb.rb
|
22
|
+
- lib/structures/word.rb
|
23
|
+
- lib/utility/interleave_arrays.rb
|
24
|
+
- lib/utility/mapping.rb
|
25
|
+
- lib/utility/presets.rb
|
26
|
+
homepage: https://github.com/deadshot465/owoify_rb
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubygems_version: 3.1.2
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: Turning your worst nightmare into a Ruby gem.
|
49
|
+
test_files: []
|