中国大学MOOC: 下面是一段文档的向量化的程序,且未经停用词过滤from sklearn.feature_extraction.text import CountVectorizercorpus = [Jobs was the chairman of Apple Inc., and he was very famous,I like to use apple computer,And I also like to eat apple] vectorizer =CountVectorizer()print(vectorizer.vocabulary_)print(vectorizer.fit_transform(corpus).todense()) #转化为完整特征矩阵已知print(vectorizer.vocabulary_)的输出结果为:{uand: 1, ujobs: 9, uapple: 2, uvery: 15, ufamous: 6, ucomputer: 4, ueat: 5, uhe: 7, uuse: 14, ulike: 10, uto: 13, uof: 11, ualso: 0, uchairman: 3, uthe: 12,
举一反三
- 中国大学MOOC:下面是一段文档的向量化的程序,且未经停用词过滤fromsklearn.feature_extraction.textimportCountVectorizercorpus=[JobswasthechairmanofAppleInc.,andhewasveryfamous,Iliketouseapplecomputer,AndIalsoliketoeatapple]vectorizer=CountVectorizer()print(vectorizer.vocabulary_)print(vectorizer.fit_transform(corpus).todense())#转化为完整特征矩阵已知print(vectorizer.vocabulary_)的输出结果为:{uand:1,ujobs:9,uapple:2,uvery:15,ufamous:6,ucomputer:4,ueat:5,uhe:7,uuse:14,ulike:10,uto:13,uof:11,ualso:0,uchairman:3,uthe:12,uinc:8,uwas:16}.则最后一条print语句中文档D1,即JobswasthechairmanofAppleInc.,andhewasveryfamous的向量为
- 【单选题】myarray1=np.arange(15) myarray2=myarray1.reshape(5,3) print( myarray1) print(myarray2) 输出值是? A. [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15] [[ 0 1 2] [ 3 4 5] [ 6 7 8] [ 9 10 11] [12 13 14]] B. [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15] [[ 1 2 3] [ 4 5 6] [ 7 8 9] [10 11 12] [13 14 15]] C. [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] [[ 0 1 2] [ 3 4 5] [ 6 7 8] [ 9 10 11] [12 13 14]] D. [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] [[ 1 2 3] [ 4 5 6] [ 7 8 9] [10 11 12] [13 14 15]]
- 已知S盒如下表,若输入为100010,则二进制输出为( ) [br][/br] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15 1 13 8 11 5 6 15 0 3 4 7 2 12 1 10 14 9 2 10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4 3 3 15 0 6 10 1 13 8 9 4 5 11 12 7 2 14 A: 0110 B: 1001 C: 0100 D: 0101
- 设DES加密算法中的一个S盒为: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13 若给定输入为101101,则该S盒的输出的二进制表示为
- 设DES加密算法中的一个S盒为: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0 15 12 8 2 4 9 1 7 5 11 A: 1010 B: 0001 C: 1011 D: 0111