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
87d87ed6
There was an error fetching the commit references. Please try again later.
Commit
87d87ed6
authored
3 years ago
by
Bensong Liu
Browse files
Options
Downloads
Patches
Plain Diff
save
parent
e5f51009
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
README.md
+4
-0
4 additions, 0 deletions
README.md
bullshit.py
+20
-3
20 additions, 3 deletions
bullshit.py
with
24 additions
and
3 deletions
README.md
+
4
−
0
View file @
87d87ed6
...
...
@@ -16,6 +16,10 @@ The second section should use the bootstrap data.json and the topic above, to en
The third section is the actual data section.
## dataset guide
There should not be
`,`
or
`。`
in
`famous`
before
`$prefix`
.
----
# 狗屁不通文章生成器
...
...
This diff is collapsed.
Click to expand it.
bullshit.py
+
20
−
3
View file @
87d87ed6
...
...
@@ -18,6 +18,11 @@ prefix_data = list(data['prefixes' ]) # 在famous_data前面弄点nonsense_dat
postfix_data
=
list
(
data
[
'
postfixes
'
])
# 在famous_data后面弄点nonsense_data
nonsense_data
=
list
(
data
[
'
shits
'
])
# 代表文章主要nonsense_data来源
famous_bits_count
=
6
prefix_bits_count
=
2
postfix_bits_count
=
3
nonsense_bits_count
=
5
print
(
"
debug: len=
"
,
[
len
(
l
)
for
l
in
[
famous_data
,
prefix_data
,
postfix_data
,
nonsense_data
]])
repeat_factor
=
2
...
...
@@ -55,8 +60,12 @@ def decode(text):
if
paragraph
==
''
:
continue
# 1. famous-prefix reorder.
# 2. element match and decode bits.
def
encode
(
text
,
topic
,
data
)
def
encode
(
text
,
topic
,
data
):
result
=
'
'
curr_paragraph
=
''
curr_data_offset
=
0
...
...
@@ -65,8 +74,16 @@ def encode(text, topic, data)
result
+=
curr_paragraph
+
paragraph_tail
()
curr_paragraph
=
''
elif
randint
(
0
,
100
)
<
20
:
curr_paragraph
+=
new_famous
()
# add a famous
_index0
=
slice_bits
(
data
,
curr_data_offset
,
prefix_bits_count
)
curr_data_offset
+=
prefix_bits_count
_index1
=
slice_bits
(
data
,
curr_data_offset
,
famous_bits_count
)
curr_data_offset
+=
famous_bits_count
_index2
=
slice_bits
(
data
,
curr_data_offset
,
postfix_bits_count
)
curr_data_offset
+=
postfix_bits_count
curr_paragraph
+=
new_famous
(
famous_data
[
_index1
],
prefix_data
[
_index0
],
postfix_data
[
_index2
])
else
:
curr_paragraph
+=
next
(
nonsense_generator
)
# TODO
result
=
result
.
replace
(
"
$topic
"
,
topic
)
print
(
result
)
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