Upload 4 files
Browse files
a.py
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import fasttext
|
2 |
+
import jieba
|
3 |
+
train_data_path = 'sel.txt'
|
4 |
+
parse_data_path = 'parse.txt'
|
5 |
+
|
6 |
+
model_path = 'word_vectors.bin'
|
7 |
+
|
8 |
+
def train():
|
9 |
+
#jieba cut
|
10 |
+
with open(train_data_path, 'r', encoding='utf-8') as f:
|
11 |
+
with open(parse_data_path, 'w', encoding='utf-8') as f1:
|
12 |
+
lines=f.readlines()
|
13 |
+
for i,line in enumerate(lines):
|
14 |
+
print(i,len(lines))
|
15 |
+
words = jieba.cut(line)
|
16 |
+
f1.write(" ".join(words) + "\n")
|
17 |
+
model = fasttext.train_unsupervised( parse_data_path, model='skipgram', dim=300, epoch=10, lr=0.1)
|
18 |
+
model.save_model(model_path)
|
19 |
+
|
20 |
+
#train()
|
21 |
+
|
22 |
+
model = fasttext.load_model(model_path)
|
23 |
+
|
24 |
+
#targets = ['阴茎', '乳房','阴道', '肛门', '屁股','腿','脚','脚趾','手','手指','手臂','头','嘴巴','眼睛','鼻子','耳朵','脸','脖子','胸','腹','腰','背','舌头','口腔','肩膀']
|
25 |
+
#targets = ['身体','抓住','抚摸','呻吟','抽插','抱','分开','搂住','揉捏','亲吻','躺下','舔']
|
26 |
+
#targets = ['没入','压','淫叫','插','吐','吞','挠','翘','吸','闻','握','伸入','捧起']
|
27 |
+
#targets = ['咬','吮','含','舔','抬','跪','拉','推','蹲','爬','站','趴','坐','拔']
|
28 |
+
#targets = ['爸爸','妈妈','儿子','女儿','老公','老婆','姐姐','妹妹','哥哥','弟弟','阿姨','舅妈','舅舅','叔叔','姑姑','姑父','姨妈','姨父','婶婶','婶父','嫂子','妹夫','姐夫']
|
29 |
+
#targets = ['阴唇','阴囊','输精管']
|
30 |
+
targets = ['精液','爱液']
|
31 |
+
|
32 |
+
for target in targets:
|
33 |
+
print(target,end=' ')
|
34 |
+
for _,i in model.get_nearest_neighbors(target, k=20):
|
35 |
+
print(i,end=' ')
|
36 |
+
print()
|
37 |
+
|
38 |
+
#print(model.words)
|
39 |
+
|
40 |
+
texts_to_cluster = ["飞机", "肉棒", "汽车", "阴茎", "猫", "B", "老婆"]
|
41 |
+
|
42 |
+
vectors = [model.get_sentence_vector(text) for text in texts_to_cluster]
|
43 |
+
|
44 |
+
from sklearn.cluster import KMeans
|
45 |
+
kmeans = KMeans(n_clusters=3)
|
46 |
+
clusters = kmeans.fit_predict(vectors)
|
47 |
+
|
48 |
+
#for i, text in enumerate(texts_to_cluster):
|
49 |
+
# print(f"文本 '{text}' 属于类别 {clusters[i]}")
|
b.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import random
|
3 |
+
path = 'sis-novel1/files'
|
4 |
+
files = os.listdir(path)
|
5 |
+
random.shuffle(files)
|
6 |
+
files = files[:1000 ]
|
7 |
+
#merge files to one txt
|
8 |
+
with open('sel.txt', 'w', encoding='utf-8') as f:
|
9 |
+
for i,file in enumerate(files):
|
10 |
+
print(i,len(files))
|
11 |
+
with open(path + '/' + file, 'r', encoding='utf-8') as f1:
|
12 |
+
text=f1.read()
|
13 |
+
text=text.replace('\n\n','[dooubleenter]')
|
14 |
+
text=text.replace('\n','')
|
15 |
+
text=text.replace('[dooubleenter]','\n')
|
16 |
+
f.write(text)
|
keywords.txt
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
阴茎 肉棒 阳具 鸡巴 阳物
|
2 |
+
乳房 乳头 奶子 胸部 双乳 美乳 乳尖 乳峰 双峰 乳肉 乳球
|
3 |
+
阴道 小穴 子宫 肛门 阴道内 阴道口 蜜穴
|
4 |
+
马眼 龟头
|
5 |
+
阴唇 肉缝 阴道口 穴口
|
6 |
+
阴户 阴阜 阴部
|
7 |
+
阴毛
|
8 |
+
阴蒂
|
9 |
+
阴囊 睾丸 蛋蛋 卵蛋 卵袋
|
10 |
+
输精管
|
11 |
+
精液 精 浓精
|
12 |
+
爱液 淫水 淫液 蜜汁 淫汁
|
13 |
+
肛门 直肠 屁眼 菊花 肠道
|
14 |
+
屁股 臀部 臀 臀肉
|
15 |
+
腿 大腿 双腿 小腿 美腿 两腿 玉腿
|
16 |
+
脚 脚背 小脚 玉足 纤足 丝足 美脚 脚面 双脚 美足 脚掌
|
17 |
+
脚趾 脚趾甲 趾甲 玉趾 脚趾头 足趾
|
18 |
+
手 双手 右手 左手 手指 手掌
|
19 |
+
手指 中指 食指 指头 指尖
|
20 |
+
手臂 胳膊 手腕 脖子 肩膀 双臂
|
21 |
+
头 脑袋 脸 螓首
|
22 |
+
嘴巴 嘴 嘴唇 舌头 小嘴 双唇 樱唇
|
23 |
+
眼睛 双眼
|
24 |
+
鼻子 鼻腔 鼻孔 鼻尖
|
25 |
+
耳朵 耳边 耳 耳垂
|
26 |
+
脸 脸上 脸颊 小脸 脸蛋 俏脸
|
27 |
+
脖子 脖颈 锁骨
|
28 |
+
胸 胸脯
|
29 |
+
腹
|
30 |
+
腰 腰部 腰身 腰肢 纤腰
|
31 |
+
背 背上 背部 玉背
|
32 |
+
舌头 舌尖 香舌 软舌
|
33 |
+
口腔 喉咙
|
34 |
+
肩膀 肩上 肩头 肩
|
35 |
+
身体 身子 身躯 娇躯 全身 胴体 肉体 躯体
|
36 |
+
|
37 |
+
抓住 握住 双手 按住 捏住
|
38 |
+
抚摸 轻抚 爱抚 揉捏 揉搓
|
39 |
+
呻吟 娇喘 喘息 娇啼
|
40 |
+
抽插 抽动 抽送 进出 撞击 插动 冲刺
|
41 |
+
抱 抱住 抱起 抱紧
|
42 |
+
分开 张开
|
43 |
+
搂住 挽住 揽住 揽
|
44 |
+
亲吻 吻 拥吻 热吻 接吻
|
45 |
+
吸吮
|
46 |
+
躺下
|
47 |
+
没入 插入 插进 捣进 挤入 刺入
|
48 |
+
压 压在 压住 压着
|
49 |
+
淫叫 浪叫 叫
|
50 |
+
插 肏 干 捅 草 操
|
51 |
+
奸
|
52 |
+
高潮
|
53 |
+
射精
|
54 |
+
吐 吐出
|
55 |
+
吞 咽 吞下 吞咽 吞进 咽进
|
56 |
+
挠
|
57 |
+
翘 翘起
|
58 |
+
吸 吮 吸吮
|
59 |
+
闻 闻到 嗅
|
60 |
+
握 握住 抓 捏
|
61 |
+
伸入 伸进 探入 伸 伸出 探进
|
62 |
+
捧起 捧 捧住
|
63 |
+
咬 咬住 啃
|
64 |
+
舔
|
65 |
+
含 含进 含着 含到 含住
|
66 |
+
舔 舐 舔着
|
67 |
+
抬 抬起
|
68 |
+
跪 跪下
|
69 |
+
拉 拽 扯 拉着
|
70 |
+
推 推回 推动 推着 推到
|
71 |
+
蹲 蹲下
|
72 |
+
爬
|
73 |
+
站 站立
|
74 |
+
趴 趴在
|
75 |
+
坐 坐在 坐下
|
76 |
+
脱
|
77 |
+
弯
|
78 |
+
|
79 |
+
爸爸 父亲
|
80 |
+
妈妈 母亲
|
81 |
+
儿子
|
82 |
+
女儿
|
83 |
+
孩子
|
84 |
+
老公
|
85 |
+
老婆
|
86 |
+
丈夫
|
87 |
+
妻子
|
88 |
+
姐姐
|
89 |
+
妹妹
|
90 |
+
哥哥
|
91 |
+
弟弟
|
92 |
+
表姐
|
93 |
+
表妹
|
94 |
+
表哥
|
95 |
+
表弟
|
96 |
+
叔叔
|
97 |
+
阿姨
|
98 |
+
舅妈
|
99 |
+
舅舅
|
100 |
+
姑姑
|
101 |
+
姑父
|
102 |
+
姨妈
|
103 |
+
姨父
|
104 |
+
侄子
|
105 |
+
[人名]
|
106 |
+
|
107 |
+
你
|
108 |
+
我
|
109 |
+
他
|
110 |
+
她
|
111 |
+
它
|
112 |
+
|
113 |
+
上衣
|
114 |
+
裤子
|
115 |
+
裙子
|
116 |
+
内裤
|
117 |
+
丝袜
|
118 |
+
胸罩
|
119 |
+
高跟鞋
|
120 |
+
戒指
|
121 |
+
婚纱
|
122 |
+
|
123 |
+
嗯
|
124 |
+
唔
|
125 |
+
啊
|
126 |
+
哦
|
127 |
+
爽
|
128 |
+
舒服
|
129 |
+
不要
|
130 |
+
去了
|
131 |
+
|
132 |
+
乱伦
|
133 |
+
绿帽
|
134 |
+
出轨
|
135 |
+
强奸
|
q.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
keywords=[]
|
3 |
+
with open('keywords.txt',encoding='utf-8') as f:
|
4 |
+
for key in f.read().split():
|
5 |
+
keywords.append(key)
|
6 |
+
|
7 |
+
with open('sel.txt',encoding='utf-8') as f:
|
8 |
+
text=f.read()
|
9 |
+
|
10 |
+
#generate questions about keywords in text
|
11 |
+
lines = text.split('\n')
|
12 |
+
|
13 |
+
random.shuffle(lines)
|
14 |
+
|
15 |
+
def make_question(key,line):
|
16 |
+
pos = line.rfind(key)
|
17 |
+
if pos == -1:
|
18 |
+
return None
|
19 |
+
line = line[:pos] + '__'
|
20 |
+
return line
|
21 |
+
|
22 |
+
for line in lines[:100]:
|
23 |
+
line = line.strip()
|
24 |
+
for key in keywords:
|
25 |
+
if key in line:
|
26 |
+
#print(make_question(key,line))
|
27 |
+
print(line)
|
28 |
+
print(key)
|
29 |
+
break
|