上传文件至 /

This commit is contained in:
2026-04-16 15:39:11 +08:00
parent 574dd17001
commit 73c84c7e11
3 changed files with 34 additions and 0 deletions

7
.py.txt Normal file
View File

@@ -0,0 +1,7 @@
import numpy as np
img = np.array([
[255, 255, 0, 0 ],
[255, 255, 0, 0 ],
[0, 0, 255, 255],
[0, 0, 255, 255]
], dtype=np.uint8)

10
import numpy as np.py Normal file
View File

@@ -0,0 +1,10 @@
import numpy as np
image = np.array([
[100, 150, 200],
[80, 120, 180],
[60, 90, 140]
], dtype=np.uint8)
print("原图:")
print(image)

17
import numpy as np3.py Normal file
View File

@@ -0,0 +1,17 @@
import numpy as np
vocab = ["Python", "学习", "数据", "人工智能", "编程"]
doc1 = "Python学习编程"
doc2 = "Python人工智能数据"
def text_to_vector(text, vocab):
words = text.split()
vector = np.zeros(len(vocab))
for i, word in enumerate(vocab):
vector[i] = words.count(word)
return vector
v1 = text_to_vector(doc1, vocab)
v2 = text_to_vector(doc2, vocab)
print("doc1向量:", v1)
print("doc2向量:", v2)