Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Recolic
chinese-obfs
Commits
d3743419
Commit
d3743419
authored
Apr 30, 2021
by
Recolic K
Browse files
make the noob code better
parent
d916148e
Changes
2
Hide whitespace changes
Inline
Side-by-side
bullshit.py
View file @
d3743419
...
...
@@ -12,12 +12,10 @@ def loadJson(fileName):
return
json
.
loads
(
file
.
read
())
data
=
loadJson
(
"data.json"
)
motto_data
=
data
[
"famous"
]
# a 代表prefix_data,b代表postfix_data
prefix_data
=
data
[
"before"
]
# 在motto_data前面弄点nonsense_data
postfix_data
=
data
[
'after'
]
# 在motto_data后面弄点nonsense_data
nonsense_data
=
data
[
'bosh'
]
# 代表文章主要nonsense_data来源
xx
=
"学生会退会"
famous_data
=
list
(
data
[
'famous'
])
# a 代表prefix_data,b代表postfix_data
prefix_data
=
list
(
data
[
'before'
])
# 在famous_data前面弄点nonsense_data
postfix_data
=
list
(
data
[
'after'
])
# 在famous_data后面弄点nonsense_data
nonsense_data
=
list
(
data
[
'bosh'
])
# 代表文章主要nonsense_data来源
repeat_factor
=
2
...
...
@@ -30,14 +28,14 @@ def randomized_yield(iterable):
yield
ele
nonsense_generator
=
randomized_yield
(
nonsense_data
)
motto
_generator
=
randomized_yield
(
motto
_data
)
famous
_generator
=
randomized_yield
(
famous
_data
)
def
new_
motto
():
global
motto
_generator
xx
=
next
(
motto
_generator
)
xx
=
xx
.
replace
(
"a"
,
random
.
choice
(
prefix_data
)
)
xx
=
xx
.
replace
(
"b"
,
random
.
choice
(
postfix_data
)
)
return
xx
def
new_
famous
():
global
famous
_generator
famous
=
next
(
famous
_generator
)
famous
=
famous
.
replace
(
"a"
,
random
.
choice
(
prefix_data
)
)
famous
=
famous
.
replace
(
"b"
,
random
.
choice
(
postfix_data
)
)
return
famous
def
new_paragraph
():
xx
=
". "
...
...
@@ -46,16 +44,15 @@ def new_paragraph():
return
xx
if
__name__
==
"__main__"
:
xx
=
input
(
"请输入文章主题:"
)
for
x
in
xx
:
tmp
=
str
()
while
(
len
(
tmp
)
<
6000
)
:
randsrc
=
random
.
randint
(
0
,
100
)
if
randsrc
<
5
:
tmp
+=
new_paragraph
()
elif
randsrc
<
20
:
tmp
+=
new_motto
()
else
:
tmp
+=
next
(
nonsense_generator
)
tmp
=
tmp
.
replace
(
"x"
,
xx
)
print
(
tmp
)
topic
=
input
(
"请输入文章主题:"
)
result
=
str
()
while
(
len
(
result
)
<
6000
)
:
randsrc
=
random
.
randint
(
0
,
100
)
if
randsrc
<
5
:
result
+=
new_paragraph
()
elif
randsrc
<
20
:
result
+=
new_famous
()
else
:
result
+=
next
(
nonsense_generator
)
result
=
result
.
replace
(
"x"
,
topic
)
print
(
result
)
data.json
View file @
d3743419
...
...
@@ -164,4 +164,4 @@
"曾经提到过"
,
"说过一句富有哲理的话"
]
}
\ No newline at end of file
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment