在functions.php
中,我想将一个函数附加到只有首页的钩子:
function dequeue_iw_theme_styles() {
wp_dequeue_style('iw');
}
if (is_page('new-front-page')) {
add_action('wp_print_styles', 'dequeue_iw_theme_styles', 100);
}
这段代码不起作用。为什么呢?
答案 0 :(得分:1)
反过来试试:
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
vectorizer = CountVectorizer(analyzer = "word", \
tokenizer = None, \
preprocessor = None, \
stop_words = None, \
max_features = 1000)
newTestFile = open("testfile.txt", 'r', encoding='latin-1')
featureVector=vectorizer.fit_transform(newTestFile)
train_data_features = featureVector.toarray()
np.savetxt('plotFeatureVector.txt', train_data_features, fmt="%10s %10.3f")
The error:
Traceback (most recent call last):
File "C:/Users/NuMA/Desktop/Lecture Stuff/EE 485/Project/Deneme/bagOfWords.py", line 12, in <module>
train_data_features = featureVector.toarray()
File "C:\Users\NuMA\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\sparse\compressed.py", line 964, in toarray
return self.tocoo(copy=False).toarray(order=order, out=out)
File "C:\Users\NuMA\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\sparse\coo.py", line 252, in toarray
B = self._process_toarray_args(order, out)
File "C:\Users\NuMA\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\sparse\base.py", line 1039, in _process_toarray_args
return np.zeros(self.shape, dtype=self.dtype, order=order)
ValueError: array is too big; `arr.size * arr.dtype.itemsize` is larger than the maximum possible size.
我认为问题在于通过有条件地添加动作,你已经来不及判断它是否是某个模板。这样,无论如何都要添加操作,只有在模板匹配时才执行代码。