owoify_rb 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/owoify_rb.rb +4 -0
- data/lib/utility/mapping.rb +49 -50
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b497d9273a9d0c4bebc22ed77e3ce53c91927025b3bb0b6f0f163fd29f32763
|
4
|
+
data.tar.gz: c3d63ee03bc86c20f2745a7dfdbb3cbbbb9ce9d11c6c4fbece1d7ec0d08c8cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d5bffe0b326d4a2e1eeaa0b3626d9140a7a445fa66df206db409e793104230d10b1341223b3ed8956d2f660397f53384e73d268cda2baf70511f3cfb1ee9868
|
7
|
+
data.tar.gz: 12fe19105c9fa150cffa701688afb0934003f4019605b0a4db1362c604bf7de53cfc66becb9f74573b016a8ec508483e5bb3df019be7f775782c008ccb324b7b
|
data/lib/owoify_rb.rb
CHANGED
@@ -4,7 +4,11 @@ require 'structures/word'
|
|
4
4
|
require 'utility/interleave_arrays'
|
5
5
|
require 'utility/presets'
|
6
6
|
|
7
|
+
# Owoify module is the main module where owoify function lies in.
|
8
|
+
# Since owoify is literally just a function, users are expected to invoke owoify by calling Owoify.owoify().
|
7
9
|
module Owoify
|
10
|
+
# The main entry point of the owoify function.
|
11
|
+
# Pass in the source string and the desired owoify level.
|
8
12
|
def self.owoify(source, level = 'owo')
|
9
13
|
word_matches = source.scan(/[^\s]+/).flatten
|
10
14
|
space_matches = source.scan(/\s+/).flatten
|
data/lib/utility/mapping.rb
CHANGED
@@ -87,8 +87,8 @@ module Mapping
|
|
87
87
|
end
|
88
88
|
|
89
89
|
MAP_DEAD_TO_DED = lambda do |input|
|
90
|
-
input
|
91
|
-
|
90
|
+
input.replace(DEAD_TO_DED_UPPER, 'Ded')
|
91
|
+
.replace(DEAD_TO_DED_LOWER, 'ded')
|
92
92
|
end
|
93
93
|
|
94
94
|
MAP_N_VOWEL_T_TO_ND = lambda do |input|
|
@@ -96,33 +96,32 @@ module Mapping
|
|
96
96
|
end
|
97
97
|
|
98
98
|
MAP_READ_TO_WEAD = lambda do |input|
|
99
|
-
input
|
100
|
-
|
99
|
+
input.replace(READ_TO_WEAD_UPPER, 'Wead')
|
100
|
+
.replace(READ_TO_WEAD_LOWER, 'wead')
|
101
101
|
end
|
102
102
|
|
103
103
|
MAP_BRACKETS_TO_STAR_TRAILS = lambda do |input|
|
104
|
-
input
|
105
|
-
|
104
|
+
input.replace(BRACKETS_TO_STARTRAILS_FORE, '。・:*:・゚★,。・:*:・゚☆')
|
105
|
+
.replace(BRACKETS_TO_STARTRAILS_REAR, '☆゚・:*:・。,★゚・:*:・。')
|
106
106
|
end
|
107
107
|
|
108
108
|
MAP_PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS = lambda do |input|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
input.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_SECOND, lambda { " #{FACES[index]}" })
|
109
|
+
input.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_FIRST, lambda {
|
110
|
+
" #{FACES[rand(FACES.length)]}"
|
111
|
+
})
|
112
|
+
.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_SECOND, lambda {
|
113
|
+
" #{FACES[rand(FACES.length)]}"
|
114
|
+
})
|
116
115
|
end
|
117
116
|
|
118
117
|
MAP_THAT_TO_DAT = lambda do |input|
|
119
|
-
input
|
120
|
-
|
118
|
+
input.replace(THAT_TO_DAT_LOWER, 'dat')
|
119
|
+
.replace(THAT_TO_DAT_UPPER, 'Dat')
|
121
120
|
end
|
122
121
|
|
123
122
|
MAP_TH_TO_F = lambda do |input|
|
124
|
-
input
|
125
|
-
|
123
|
+
input.replace(TH_TO_F_LOWER, 'f')
|
124
|
+
.replace(TH_TO_F_UPPER, 'F')
|
126
125
|
end
|
127
126
|
|
128
127
|
MAP_LE_TO_WAL = lambda do |input|
|
@@ -130,8 +129,8 @@ module Mapping
|
|
130
129
|
end
|
131
130
|
|
132
131
|
MAP_VE_TO_WE = lambda do |input|
|
133
|
-
input
|
134
|
-
|
132
|
+
input.replace(VE_TO_WE_LOWER, 'we')
|
133
|
+
.replace(VE_TO_WE_UPPER, 'We')
|
135
134
|
end
|
136
135
|
|
137
136
|
MAP_RY_TO_WWY = lambda do |input|
|
@@ -139,8 +138,8 @@ module Mapping
|
|
139
138
|
end
|
140
139
|
|
141
140
|
MAP_R_OR_L_TO_W = lambda do |input|
|
142
|
-
input
|
143
|
-
|
141
|
+
input.replace(RORL_TO_W_LOWER, 'w')
|
142
|
+
.replace(RORL_TO_W_UPPER, 'W')
|
144
143
|
end
|
145
144
|
|
146
145
|
MAP_LL_TO_WW = lambda do |input|
|
@@ -148,33 +147,33 @@ module Mapping
|
|
148
147
|
end
|
149
148
|
|
150
149
|
MAP_VOWEL_OR_R_EXCEPT_O_L_TO_WL = lambda do |input|
|
151
|
-
input
|
152
|
-
|
150
|
+
input.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_LOWER, 'wl')
|
151
|
+
.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_UPPER, 'W\1')
|
153
152
|
end
|
154
153
|
|
155
154
|
MAP_OLD_TO_OWLD = lambda do |input|
|
156
|
-
input
|
157
|
-
|
155
|
+
input.replace(OLD_TO_OWLD_LOWER, '\1wld')
|
156
|
+
.replace(OLD_TO_OWLD_UPPER, 'OWLD')
|
158
157
|
end
|
159
158
|
|
160
159
|
MAP_OL_TO_OWL = lambda do |input|
|
161
|
-
input
|
162
|
-
|
160
|
+
input.replace(OL_TO_OWL_LOWER, '\1wl')
|
161
|
+
.replace(OL_TO_OWL_UPPER, 'OWL')
|
163
162
|
end
|
164
163
|
|
165
164
|
MAP_L_OR_R_O_TO_WO = lambda do |input|
|
166
|
-
input
|
167
|
-
|
165
|
+
input.replace(LORR_O_TO_WO_LOWER, 'wo')
|
166
|
+
.replace(LORR_O_TO_WO_UPPER, 'W\1')
|
168
167
|
end
|
169
168
|
|
170
169
|
MAP_SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO = lambda do |input|
|
171
|
-
input
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
170
|
+
input.replace(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_LOWER, '\1wo')
|
171
|
+
.replace_with_func_multiple(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_UPPER, lambda do |s1, s2|
|
172
|
+
msg = s1
|
173
|
+
msg += s2.upcase == s2 ? 'W' : 'w'
|
174
|
+
msg += s2
|
175
|
+
msg
|
176
|
+
end)
|
178
177
|
end
|
179
178
|
|
180
179
|
MAP_V_OR_W_LE_TO_WAL = lambda do |input|
|
@@ -182,8 +181,8 @@ module Mapping
|
|
182
181
|
end
|
183
182
|
|
184
183
|
MAP_FI_TO_FWI = lambda do |input|
|
185
|
-
input
|
186
|
-
|
184
|
+
input.replace(FI_TO_FWI_LOWER, '\1wi')
|
185
|
+
.replace(FI_TO_FWI_UPPER, 'FWI')
|
187
186
|
end
|
188
187
|
|
189
188
|
MAP_VER_TO_WER = lambda do |input|
|
@@ -203,8 +202,8 @@ module Mapping
|
|
203
202
|
end
|
204
203
|
|
205
204
|
MAP_LY_TO_WY = lambda do |input|
|
206
|
-
input
|
207
|
-
|
205
|
+
input.replace(LY_TO_WY_LOWER, 'wy')
|
206
|
+
.replace(LY_TO_WY_UPPER, 'Wy')
|
208
207
|
end
|
209
208
|
|
210
209
|
MAP_PLE_TO_PWE = lambda do |input|
|
@@ -212,8 +211,8 @@ module Mapping
|
|
212
211
|
end
|
213
212
|
|
214
213
|
MAP_NR_TO_NW = lambda do |input|
|
215
|
-
input
|
216
|
-
|
214
|
+
input.replace(NR_TO_NW_LOWER, 'nw')
|
215
|
+
.replace(NR_TO_NW_UPPER, 'NW')
|
217
216
|
end
|
218
217
|
|
219
218
|
MAP_FUC_TO_FWUC = lambda do |input|
|
@@ -229,14 +228,14 @@ module Mapping
|
|
229
228
|
end
|
230
229
|
|
231
230
|
MAP_N_VOWEL_TO_NY = lambda do |input|
|
232
|
-
input
|
233
|
-
|
234
|
-
|
231
|
+
input.replace(N_VOWEL_TO_NY_FIRST, 'ny\1')
|
232
|
+
.replace(N_VOWEL_TO_NY_SECOND, 'Ny\1')
|
233
|
+
.replace(N_VOWEL_TO_NY_THIRD, 'NY\1')
|
235
234
|
end
|
236
235
|
|
237
236
|
MAP_OVE_TO_UV = lambda do |input|
|
238
|
-
input
|
239
|
-
|
237
|
+
input.replace(OVE_TO_UV_LOWER, 'uv')
|
238
|
+
.replace(OVE_TO_UV_UPPER, 'UV')
|
240
239
|
end
|
241
240
|
|
242
241
|
MAP_HAHA_TO_HEHE_XD = lambda do |input|
|
@@ -248,8 +247,8 @@ module Mapping
|
|
248
247
|
end
|
249
248
|
|
250
249
|
MAP_YOU_TO_U = lambda do |input|
|
251
|
-
input
|
252
|
-
|
250
|
+
input.replace(YOU_TO_U_UPPER, 'U')
|
251
|
+
.replace(YOU_TO_U_LOWER, 'u')
|
253
252
|
end
|
254
253
|
|
255
254
|
MAP_TIME_TO_TIM = lambda do |input|
|
@@ -263,4 +262,4 @@ module Mapping
|
|
263
262
|
MAP_WORSE_TO_WOSE = lambda do |input|
|
264
263
|
input.replace(WORSE_TO_WOSE, '\1ose')
|
265
264
|
end
|
266
|
-
end
|
265
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: owoify_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chehui Chou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a Ruby port of mohan-cao's owoify-js, which will help you turn
|
14
14
|
any string into nonsensical babyspeak similar to LeafySweet's infamous Chrome extension.
|