From 65e34a0bda10aa25ba4017f94cca78d6fca17f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E6=96=87=E6=9D=B0?= <2509165027@student.example.com> Date: Thu, 23 Apr 2026 16:04:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 260423-2509165027.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 260423-2509165027.py diff --git a/260423-2509165027.py b/260423-2509165027.py new file mode 100644 index 0000000..cbca67a --- /dev/null +++ b/260423-2509165027.py @@ -0,0 +1,10 @@ +from sklearn.feature_extraction.text import CountVectorizer +docs=["Python 是 编程 语言" + "Java 是 编程 语言" + "Python Python Python"] +vectorizer = CountVectorizer() +bow_matrix = vectorizer.fit_transform(docs) + +print("词表:", vectorizer.get_feature_names_out()) +print("BoW矩阵:") +print(bow_matrix.toarray()) \ No newline at end of file