Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chinese-obfs
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
chinese-obfs
Commits
d3743419
There was an error fetching the commit references. Please try again later.
Commit
d3743419
authored
3 years ago
by
Bensong Liu
Browse files
Options
Downloads
Patches
Plain Diff
make the noob code better
parent
d916148e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bullshit.py
+23
-26
23 additions, 26 deletions
bullshit.py
data.json
+1
-1
1 addition, 1 deletion
data.json
with
24 additions
and
27 deletions
bullshit.py
+
23
−
26
View file @
d3743419
...
@@ -12,12 +12,10 @@ def loadJson(fileName):
...
@@ -12,12 +12,10 @@ def loadJson(fileName):
return
json
.
loads
(
file
.
read
())
return
json
.
loads
(
file
.
read
())
data
=
loadJson
(
"
data.json
"
)
data
=
loadJson
(
"
data.json
"
)
motto_data
=
data
[
"
famous
"
]
# a 代表prefix_data,b代表postfix_data
famous_data
=
list
(
data
[
'
famous
'
])
# a 代表prefix_data,b代表postfix_data
prefix_data
=
data
[
"
before
"
]
# 在motto_data前面弄点nonsense_data
prefix_data
=
list
(
data
[
'
before
'
])
# 在famous_data前面弄点nonsense_data
postfix_data
=
data
[
'
after
'
]
# 在motto_data后面弄点nonsense_data
postfix_data
=
list
(
data
[
'
after
'
])
# 在famous_data后面弄点nonsense_data
nonsense_data
=
data
[
'
bosh
'
]
# 代表文章主要nonsense_data来源
nonsense_data
=
list
(
data
[
'
bosh
'
])
# 代表文章主要nonsense_data来源
xx
=
"
学生会退会
"
repeat_factor
=
2
repeat_factor
=
2
...
@@ -30,14 +28,14 @@ def randomized_yield(iterable):
...
@@ -30,14 +28,14 @@ def randomized_yield(iterable):
yield
ele
yield
ele
nonsense_generator
=
randomized_yield
(
nonsense_data
)
nonsense_generator
=
randomized_yield
(
nonsense_data
)
motto
_generator
=
randomized_yield
(
motto
_data
)
famous
_generator
=
randomized_yield
(
famous
_data
)
def
new_
motto
():
def
new_
famous
():
global
motto
_generator
global
famous
_generator
xx
=
next
(
motto
_generator
)
famous
=
next
(
famous
_generator
)
xx
=
xx
.
replace
(
"
a
"
,
random
.
choice
(
prefix_data
)
)
famous
=
famous
.
replace
(
"
a
"
,
random
.
choice
(
prefix_data
)
)
xx
=
xx
.
replace
(
"
b
"
,
random
.
choice
(
postfix_data
)
)
famous
=
famous
.
replace
(
"
b
"
,
random
.
choice
(
postfix_data
)
)
return
xx
return
famous
def
new_paragraph
():
def
new_paragraph
():
xx
=
"
.
"
xx
=
"
.
"
...
@@ -46,16 +44,15 @@ def new_paragraph():
...
@@ -46,16 +44,15 @@ def new_paragraph():
return
xx
return
xx
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
xx
=
input
(
"
请输入文章主题:
"
)
topic
=
input
(
"
请输入文章主题:
"
)
for
x
in
xx
:
result
=
str
()
tmp
=
str
()
while
(
len
(
result
)
<
6000
)
:
while
(
len
(
tmp
)
<
6000
)
:
randsrc
=
random
.
randint
(
0
,
100
)
randsrc
=
random
.
randint
(
0
,
100
)
if
randsrc
<
5
:
if
randsrc
<
5
:
result
+=
new_paragraph
()
tmp
+=
new_paragraph
()
elif
randsrc
<
20
:
elif
randsrc
<
20
:
result
+=
new_famous
()
tmp
+=
new_motto
()
else
:
else
:
result
+=
next
(
nonsense_generator
)
tmp
+=
next
(
nonsense_generator
)
result
=
result
.
replace
(
"
x
"
,
topic
)
tmp
=
tmp
.
replace
(
"
x
"
,
xx
)
print
(
result
)
print
(
tmp
)
This diff is collapsed.
Click to expand it.
data.json
+
1
−
1
View file @
d3743419
...
@@ -164,4 +164,4 @@
...
@@ -164,4 +164,4 @@
"曾经提到过"
,
"曾经提到过"
,
"说过一句富有哲理的话"
"说过一句富有哲理的话"
]
]
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment