## 贝叶斯分类基本原理

### 贝叶斯定理：

条件概率公式

$$
P(A|B) = \dfrac{P(AB)}{P(B)}
$$

贝叶斯定理

$$
P(B_i|A)=\dfrac{P(A|B_i)P(B_i)}{\sum\limits_j P(A|B_j)P(B_j)}
$$

假设有N种可能的类别标记$\{c_1,c_2,...,c_N\}$，$P(c_i|\textbf{x})$，将样本x标记为$c_i$的后验概率
$$
P(c|\textbf{x})=\dfrac{P(\textbf{x},c)}{P(\textbf{x})}=\dfrac{P(c)P(\textbf{x}|c)}{P(\textbf{x})} \tag{a1}
$$

### 朴素贝叶斯

朴素贝叶斯分类器采用了**“属性条件独立性假设”**：对已知类别，假设所有属性相互独立（每个属性独立地对分类结果发生影响）

$$
P(c|\textbf{x})=\dfrac{P(c)P(\textbf{x}|c)}{P(\textbf{x})} = \dfrac{P(c)}{P(\textbf{x})}\prod\limits_{i=1}^d P(x_i|c)
$$

### 训练方法

* 基于训练集$D$估计类先验概率$P(c)$并为每个特征估计条件概率$P(x_i|c)$
* 类先验概率$P(c)=\dfrac{|D_c|}{|D|}$
* 若为**离散**特征$P(x_i|c)=\dfrac{|D_{c,x_i}|}{|D|}$（计数统计）
* 若为**连续**特征：考虑概率密度函数，如正态分布

$$
P(x_i|c)=\dfrac{1}{\sqrt{2\pi}\sigma_{c,i}} exp \left(-\dfrac{(x_i-\mu_{c,i})^2}{2\sigma_{c,i}^2}\right)
$$

### Laplace修正
$$
\begin{align}
\hat{P}(c)&=\dfrac{|D_c|+1}{|D|+N} \\
\hat{P}(x_i,c)&=\dfrac{|D_{c,x_i}|+1}{|D|+N_i} \tag{a2}
\end{align}
$$
N表示训练集中可能的类别数，$N_i$表示第i个属性可能的取值数。

# 朴素贝叶斯模型构建

## 数据加载与向量化

```python
import numpy as np
from math import log
```

```python
def loadDataSet():
    postingList=[['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'],       #切分的词条
                 ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'],
                 ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'],
                 ['stop', 'posting', 'stupid', 'worthless', 'garbage'],
                 ['mr', 'licks', 'ate', 'my', 'steak', 'how', 'to', 'stop', 'him'],
                 ['quit', 'buying', 'worthless', 'dog', 'food', 'stupid']]
    classVec = [0,1,0,1,0,1]#类别标签向量，1代表侮辱性词汇，0代表不是
    return postingList,classVec

# 函数说明:将切分的实验样本词条整理成不重复的词条列表，也就是词汇表
def createVocabList(dataSet):
    vocabSet = set([])                      #创建一个空的不重复列表
    for document in dataSet:
        vocabSet = vocabSet | set(document) #取并集
    return list(vocabSet)

# 函数说明:根据vocabList词汇表，将inputSet向量化，向量的每个元素为1或0
def setOfWords2Vec(vocabList, inputSet):
    returnVec = [0] * len(vocabList)                               #创建一个其中所含元素都为0的向量
    for word in inputSet:                                          #遍历每个词条
        if word in vocabList:                                      #如果词条存在于词汇表中，则置1
            returnVec[vocabList.index(word)] = 1
        else: print("the word: %s is not in my Vocabulary!" % word)
    return returnVec                                               #返回文档向量
```

```python
postingList, classVec = loadDataSet()
print('postingList:');display(postingList)
myVocabList = createVocabList(postingList)
print('\nmyVocabList:\n',myVocabList,len(myVocabList))
trainMat = []
for postinDoc in postingList:
    trainMat.append(setOfWords2Vec(myVocabList, postinDoc))
print('\ntrainMat:', trainMat)
```

    postingList:

    [['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'],
     ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'],
     ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'],
     ['stop', 'posting', 'stupid', 'worthless', 'garbage'],
     ['mr', 'licks', 'ate', 'my', 'steak', 'how', 'to', 'stop', 'him'],
     ['quit', 'buying', 'worthless', 'dog', 'food', 'stupid']]

    myVocabList:
     ['stop', 'steak', 'love', 'not', 'so', 'has', 'posting', 'help', 'I', 'garbage', 'dog', 'him', 'food', 'is', 'please', 'maybe', 'to', 'licks', 'cute', 'my', 'stupid', 'worthless', 'ate', 'mr', 'how', 'problems', 'dalmation', 'buying', 'take', 'park', 'flea', 'quit'] 32

    trainMat: [[0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1]]

## 朴素贝叶斯模型训练

对照`式a1`,$\textbf{x}$即为一个向量$(x_1,x_2,...,x_{32})$，长度与词个数相同。

根据独立性假设，所有词相互独立。训练朴素贝叶斯模型的基本算法如下：

> * 计算每个类别种文档数目
> * 对每篇训练文档
>   * 对每个类别：
>     * 如果词条出现在文档中→增加该词条的计数值
>     * 增加所有词条的计数值
>   * 对每个类别：
>     * 对每个词条：
>       * 将该词条的数目除以总词条数目得到条件概率
>   * 返回每个类别的条件概率

### 训练模型

```python
'''
Parameters:
    trainMatrix - 训练文档矩阵，即setOfWords2Vec返回的returnVec构成的矩阵
    trainCategory - 训练类别标签向量，即loadDataSet返回的classVec
Returns:
    p0Vect - 侮辱类的条件概率数组
    p1Vect - 非侮辱类的条件概率数组
    pAbusive - 文档属于侮辱类的概率
'''
# 函数说明:朴素贝叶斯分类器训练函数
def trainNB0(trainMatrix,trainCategory):
    numTrainDocs = len(trainMatrix)                       #计算训练的文档数目
    numWords = len(trainMatrix[0])                        #计算词条数
    pAbusive = sum(trainCategory)/float(numTrainDocs)     #文档属于侮辱类的概率
    p0Num = np.zeros(numWords); p1Num = np.zeros(numWords)#创建numpy.zeros数组,词条出现数初始化为0
    p0Denom = 0.0; p1Denom = 0.0    #分母初始化为0
    for i in range(numTrainDocs):
        if trainCategory[i] == 1:   #统计属于侮辱类的条件概率所需的数据，即P(w0|1),P(w1|1),P(w2|1)···
            p1Num += trainMatrix[i]
            p1Denom += sum(trainMatrix[i]) ## 当前文档词数
        else:                      #统计属于非侮辱类的条件概率所需的数据，即P(w0|0),P(w1|0),P(w2|0)···
            p0Num += trainMatrix[i]
            p0Denom += sum(trainMatrix[i])
    p1Vect = p1Num/p1Denom
    p0Vect = p0Num/p0Denom
    return p0Vect,p1Vect,pAbusive#返回属于侮辱类的条件概率数组，属于非侮辱类的条件概率数组，文档属于侮辱类的概率

```

```python
trainMat = []
for postinDoc in postingList:
    trainMat.append(setOfWords2Vec(myVocabList, postinDoc))
p0V, p1V, pAb = trainNB0(trainMat, classVec)
print('p0V:\n', p0V)
print('p1V:\n', p1V)
print('classVec:\n', classVec)
print('pAb:\n', pAb)
```

    p0V:
     [0.04166667 0.04166667 0.04166667 0.         0.04166667 0.04166667
     0.         0.04166667 0.04166667 0.         0.04166667 0.08333333
     0.         0.04166667 0.04166667 0.         0.04166667 0.04166667
     0.04166667 0.125      0.         0.         0.04166667 0.04166667
     0.04166667 0.04166667 0.04166667 0.         0.         0.
     0.04166667 0.        ]
    p1V:
     [0.05263158 0.         0.         0.05263158 0.         0.
     0.05263158 0.         0.         0.05263158 0.10526316 0.05263158
     0.05263158 0.         0.         0.05263158 0.05263158 0.
     0.         0.         0.15789474 0.10526316 0.         0.
     0.         0.         0.         0.05263158 0.05263158 0.05263158
     0.         0.05263158]
    classVec:
     [0, 1, 0, 1, 0, 1]
    pAb:
     0.5

### 平滑修改模型

在刚才的矩阵种发现了有概率值为0的情况，这会导致连乘积为0.

为减少此影响，可以用`式a2`进行平滑，初始分子置1，分母N取2.

另外，在程序运行过程中，由于太多较小小数相乘，程序可能会下溢，所以可以使用对数进行放缩。

```python
def trainNB1(trainMatrix,trainCategory):
    numTrainDocs = len(trainMatrix)                       #计算训练的文档数目
    numWords = len(trainMatrix[0])                        #计算词条数
    pAbusive = sum(trainCategory)/float(numTrainDocs)     #文档属于侮辱类的概率
#     p0Num = np.zeros(numWords); p1Num = np.zeros(numWords)#创建numpy.zeros数组,词条出现数初始化为0
    p0Num = np.ones(numWords); p1Num = np.ones(numWords)#创建numpy.ONES数组,词条出现数初始化为1
#     p0Denom = 0.0; p1Denom = 0.0    #分母初始化为0
    p0Denom = 2.0; p1Denom = 2.0    #分母初始化
    for i in range(numTrainDocs):
        if trainCategory[i] == 1:   #统计属于侮辱类的条件概率所需的数据，即P(w0|1),P(w1|1),P(w2|1)···
            p1Num += trainMatrix[i]
            p1Denom += sum(trainMatrix[i]) ## 当前文档词数
        else:                      #统计属于非侮辱类的条件概率所需的数据，即P(w0|0),P(w1|0),P(w2|0)···
            p0Num += trainMatrix[i]
            p0Denom += sum(trainMatrix[i])
    p1Vect = log(p1Num/p1Denom)
    p0Vect = log(p0Num/p0Denom)
    return p0Vect,p1Vect,pAbusive#返回属于侮辱类的条件概率数组，属于非侮辱类的条件概率数组，文档属于侮辱类的概率
```

## 测试模型

```python
'''
Parameters:
    vec2Classify - 待分类的词条数组
    p0Vec - 侮辱类的条件概率数组
    p1Vec -非侮辱类的条件概率数组
    pClass1 - 文档属于侮辱类的概率
Returns:
    0 - 属于非侮辱类
    1 - 属于侮辱类
'''
# 函数说明:朴素贝叶斯分类器分类函数
def classifyNB(vec2Classify, p0Vec, p1Vec, pClass1):
    p1 = sum(vec2Classify * p1Vec) + log(pClass1)      #element-wise mult
    p0 = sum(vec2Classify * p0Vec) + log(1.0 - pClass1)
    if p1 > p0:
        return 1
    else:
        return 0

# 函数说明:朴素贝叶斯分类器测试函数
def testingNB():
    listOPosts,listClasses = loadDataSet()
    myVocabList = createVocabList(listOPosts)
    trainMat=[]
    for postinDoc in listOPosts:
        trainMat.append(setOfWords2Vec(myVocabList, postinDoc))
    p0V,p1V,pAb = trainNB0(np.array(trainMat),np.array(listClasses))
    testEntry = ['love', 'my', 'dalmation']
    thisDoc = np.array(setOfWords2Vec(myVocabList, testEntry))
    print(testEntry,'classified as: ',classifyNB(thisDoc,p0V,p1V,pAb))
    testEntry = ['stupid', 'garbage']
    thisDoc = np.array(setOfWords2Vec(myVocabList, testEntry))
    print(testEntry,'classified as: ',classifyNB(thisDoc,p0V,p1V,pAb))
```

```python
testingNB()
```

    ['love', 'my', 'dalmation'] classified as:  0
    ['stupid', 'garbage'] classified as:  1

## 实现词袋模型

原来的模型可以称为“词集模型”，只表现词是否出现；可以考虑“词袋模型”的使用，不仅表现词是否出现，而且表现了词出现的次数。

```python
def bagOfWords2VecMN(vocabList,inputSet):
    returnVec = [0]*len(vocabList)
    for word in inputSet:
        if word in vocabList:
            returnVec[vocabList.index(word)] += 1
    return returnVec
```

# 实战：使用朴素贝叶斯过滤垃圾邮件

```python
# 切分文本
def textParse(bigString):
    import re
    listOfTokens = re.split(r'\W*', bigString)
    return [tok.lower() for tok in listOfTokens if len(tok) > 2]
```

```python
def spamTest():
    docList=[]; classList = []; fullText =[]
    for i in range(1,26):
        wordList = textParse(open('./data/email/spam/%d.txt' % i,encoding='utf-8',errors='replace').read())
        docList.append(wordList)
        fullText.extend(wordList)
        classList.append(1)
        wordList = textParse(open('./data/email/ham/%d.txt' % i,encoding='utf-8',errors='replace').read())
        docList.append(wordList)
        fullText.extend(wordList)
        classList.append(0)
    vocabList = createVocabList(docList) #构建词表
    trainingSet = list(range(50)); testSet=[]
    for i in range(10):
        randIndex = int(random.uniform(0,len(trainingSet)))
        testSet.append(trainingSet[randIndex])
        del(trainingSet[randIndex])
    trainMat=[]; trainClasses = []
    for docIndex in trainingSet:
        trainMat.append(bagOfWords2VecMN(vocabList, docList[docIndex]))
        trainClasses.append(classList[docIndex])
    p0V,p1V,pSpam = trainNB0(np.array(trainMat),np.array(trainClasses))
    errorCount = 0
    for docIndex in testSet:
        wordVector = bagOfWords2VecMN(vocabList, docList[docIndex])
        if classifyNB(np.array(wordVector),p0V,p1V,pSpam) != classList[docIndex]:
            errorCount += 1
            print("classification error",docList[docIndex])
    print('the error rate is: ',float(errorCount)/len(testSet))
```

```python
import random

spamTest()
spamTest()
spamTest()
```

    classification error ['home', 'based', 'business', 'opportunity', 'knocking', 'your', 'door', 'don', 'rude', 'and', 'let', 'this', 'chance', 'you', 'can', 'earn', 'great', 'income', 'and', 'find', 'your', 'financial', 'life', 'transformed', 'learn', 'more', 'here', 'your', 'success', 'work', 'from', 'home', 'finder', 'experts']
    classification error ['get', 'off', 'online', 'watchesstore', 'discount', 'watches', 'for', 'all', 'famous', 'brands', 'watches', 'arolexbvlgari', 'dior', 'hermes', 'oris', 'cartier', 'and', 'more', 'brands', 'louis', 'vuitton', 'bags', 'wallets', 'gucci', 'bags', 'tiffany', 'jewerly', 'enjoy', 'full', 'year', 'warranty', 'shipment', 'via', 'reputable', 'courier', 'fedex', 'ups', 'dhl', 'and', 'ems', 'speedpost', 'you', 'will', '100', 'recieve', 'your', 'order', 'save', 'off', 'quality', 'watches']
    classification error ['get', 'off', 'online', 'watchesstore', 'discount', 'watches', 'for', 'all', 'famous', 'brands', 'watches', 'arolexbvlgari', 'dior', 'hermes', 'oris', 'cartier', 'and', 'more', 'brands', 'louis', 'vuitton', 'bags', 'wallets', 'gucci', 'bags', 'tiffany', 'jewerly', 'enjoy', 'full', 'year', 'warranty', 'shipment', 'via', 'reputable', 'courier', 'fedex', 'ups', 'dhl', 'and', 'ems', 'speedpost', 'you', 'will', '100', 'recieve', 'your', 'order']
    classification error ['experience', 'with', 'biggerpenis', 'today', 'grow', 'inches', 'more', 'the', 'safest', 'most', 'effective', 'methods', 'of_penisen1argement', 'save', 'your', 'time', 'and', 'money', 'bettererections', 'with', 'effective', 'ma1eenhancement', 'products', 'ma1eenhancement', 'supplement', 'trusted', 'millions', 'buy', 'today']
    classification error ['bargains', 'here', 'buy', 'phentermin', 'buy', 'genuine', 'phentermin', 'low', 'cost', 'visa', 'accepted', '130', '219', '292', '120', '366', '180', '513']
    classification error ['oem', 'adobe', 'microsoft', 'softwares', 'fast', 'order', 'and', 'download', 'microsoft', 'office', 'professional', 'plus', '2007', '2010', '129', 'microsoft', 'windows', 'ultimate', '119', 'adobe', 'photoshop', 'cs5', 'extended', 'adobe', 'acrobat', 'pro', 'extended', 'windows', 'professional', 'thousand', 'more', 'titles']
    the error rate is:  0.6
    the error rate is:  0.0
    classification error ['linkedin', 'julius', 'requested', 'add', 'you', 'connection', 'linkedin', 'peter', 'looking', 'forward', 'the', 'book', 'accept', 'view', 'invitation', 'from', 'julius']
    classification error ['ryan', 'whybrew', 'commented', 'your', 'status', 'ryan', 'wrote', 'turd', 'ferguson', 'butt', 'horn']
    classification error ['that', 'cold', 'there', 'going', 'retirement', 'party', 'are', 'the', 'leaves', 'changing', 'color']
    classification error ['thanks', 'peter', 'definitely', 'check', 'this', 'how', 'your', 'book', 'going', 'heard', 'chapter', 'came', 'and', 'was', 'good', 'shape', 'hope', 'you', 'are', 'doing', 'well', 'cheers', 'troy']
    the error rate is:  0.4

    /usr/lib64/python3.6/re.py:212: FutureWarning: split() requires a non-empty pattern match.
      return _compile(pattern, flags).split(string, maxsplit)

# 实战：使用朴素贝叶斯分类器从个人广告中获取区域倾向

## 失效的案例

### 收集数据：导入RSS源……

```python
!pip3 install feedparser
```

    WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
    Collecting feedparser
      Downloading https://mirrors.aliyun.com/pypi/packages/1c/21/faf1bac028662cc8adb2b5ef7a6f3999a765baa2835331df365289b0ca56/feedparser-6.0.2-py3-none-any.whl (80kB)
        100% |████████████████████████████████| 81kB 9.3MB/s ta 0:00:011
    Collecting sgmllib3k (from feedparser)
      Downloading https://mirrors.aliyun.com/pypi/packages/9e/bd/3704a8c3e0942d711c1299ebf7b9091930adae6675d7c8f476a7ce48653c/sgmllib3k-1.0.0.tar.gz
    Installing collected packages: sgmllib3k, feedparser
      Running setup.py install for sgmllib3k ... done
    Successfully installed feedparser-6.0.2 sgmllib3k-1.0.0

```python
import feedparser
ny = feedparser.parse('http://newyork.craigslist.org/stp/index.rss')
```

```python
len(ny['entries'])
```

    0

1202年，rss基本无人问津。。。书本提供的两个网站都无法获取新的entry，所以随便找了两个，但是这样搞意义不大了。

```python
hv = feedparser.parse('http://www.hup.harvard.edu/hup_rss.php?new=n')
len(hv['entries'])
```

    223

```python
su = feedparser.parse('https://www.sup.org/rss/?feed=history')
len(su['entries'])
```

    23

```python
def calcMostFreq(vocabList,fullText):
    import operator
    freqDict = {}
    for token in vocabList:
        freqDict[token]=fullText.count(token)
    sortedFreq = sorted(freqDict.items(), key=operator.itemgetter(1), reverse=True)
    return sortedFreq[:30]       #统计词出现次数，返回排序最高的30个词

def localWords(feed1,feed0):#与spanTest类似
    import feedparser
    docList=[]; classList = []; fullText =[]
    minLen = min(len(feed1['entries']),len(feed0['entries']))
    for i in range(minLen):
        wordList = textParse(feed1['entries'][i]['summary'])
        docList.append(wordList)
        fullText.extend(wordList)
        classList.append(1) #NY is class 1
        wordList = textParse(feed0['entries'][i]['summary'])
        docList.append(wordList)
        fullText.extend(wordList)
        classList.append(0)
    vocabList = createVocabList(docList)#create vocabulary
    #作用：移除高频词。尝试注释掉下面三行代码，观察模型表现效果
    top30Words = calcMostFreq(vocabList,fullText)   #remove top 30 words
    for pairW in top30Words:
        if pairW[0] in vocabList: vocabList.remove(pairW[0])
    trainingSet = list(range(2*minLen)); testSet=[]           #create test set
    for i in range(20):
        randIndex = int(random.uniform(0,len(trainingSet)))
        testSet.append(trainingSet[randIndex])
        del(trainingSet[randIndex])
    trainMat=[]; trainClasses = []
    for docIndex in trainingSet:#train the classifier (get probs) trainNB0
        trainMat.append(bagOfWords2VecMN(vocabList, docList[docIndex]))
        trainClasses.append(classList[docIndex])
    p0V,p1V,pSpam = trainNB0(np.array(trainMat),np.array(trainClasses))
    errorCount = 0
    for docIndex in testSet:        #classify the remaining items
        wordVector = bagOfWords2VecMN(vocabList, docList[docIndex])
        if classifyNB(np.array(wordVector),p0V,p1V,pSpam) != classList[docIndex]:
            errorCount += 1
    print('the error rate is: ',float(errorCount)/len(testSet))
    return vocabList,p0V,p1V

```

```python
vocabList,pHV,pSU = localWords(hv,su)
```

    the error rate is:  0.0

👆注释了去除高频词代码

👇未注释代码

```python
vocabList,pHV,pSU = localWords(hv,su)
```

    the error rate is:  0.6

这不是扯淡吗，rss没选好，但是找不到好的rss了。

可改进：通过函数caclMostFreq()改变要移除的单词数目，然后观察错误率的变化情况。

### 分析数据：显示地域相关用词？

```python
def getTopWords(hv,su):
    import operator
    vocabList,p0V,p1V=localWords(hv,su)
    topHV=[]; topSU=[]
    for i in range(len(p0V)):
        if p0V[i] > -6.0 : topSU.append((vocabList[i],p0V[i]))
        if p1V[i] > -6.0 : topHV.append((vocabList[i],p1V[i]))
    sortedSU = sorted(topSU, key=lambda pair: pair[1], reverse=True)
    print("Su**"*10)
    for item in sortedSU:
        print(item[0])
    sortedHV = sorted(topHV, key=lambda pair: pair[1], reverse=True)
    print("HV**"*10)
    for item in sortedHV:
        print(item[0])
```

```python
getTopWords(hv,su)
```

    the error rate is:  0.3
    Su**Su**Su**Su**Su**Su**Su**Su**Su**Su**
    german
    east
    germany
    between
    about
    century
    through
    religious
    western
    not
    over
    jewish
    into
    islam
    most
    they
    india
    arab
    under
    also
    who
    dance
    life
    people
    drawing
    policy
    region
    historical
    diderot
    cultural
    democracy
    oil
    will
    which
    islamic
    political
    iraq
    yalom
    while
    middle
    social
    united
    economy
    states
    palestine
    politics
    contemporary
    such
    twentieth
    have
    europe
    enlightenment
    origins
    memories
    letters
    communist
    work
    was
    republic
    her
    city
    national
    muslim
    soviet
    were
    out
    consumer
    has
    country
    offers
    concerns
    sovereignty
    ultimately
    economic
    own
    movements
    labor
    scenes
    lives
    babayan
    covert
    his
    marilyn
    relations
    key
    modern
    violence
    one
    around
    implications
    neoliberal
    together
    independence
    communities
    them
    lasting
    documents
    then
    home
    isfahan
    offering
    yet
    close
    ways
    friends
    conflict
    young
    those
    writing
    understanding
    well
    culture
    obscured
    west
    everyday
    did
    shared
    story
    what
    influence
    study
    dancing
    provides
    cold
    hunnicutt
    since
    wolfe
    examines
    power
    development
    british
    uprisings
    light
    remain
    studies
    consumers
    demonstrates
    argues
    regional
    last
    movement
    style
    many
    sexual
    preoccupations
    scarcity
    largest
    eurozone
    beyond
    research
    spheres
    debates
    witnesses
    today
    paranoid
    gender
    general
    crisis
    elites
    consumption
    encounter
    imperial
    whose
    shaped
    periphery
    global
    army
    moment
    action
    israel
    process
    ipc
    postcolonial
    presents
    powerful
    relationship
    centuries
    only
    literature
    raj
    capitalist
    course
    behind
    princely
    rise
    form
    attributed
    personal
    literary
    view
    efforts
    nationalism
    deep
    abbas
    archival
    sex
    managers
    are
    included
    way
    ethnic
    residents
    very
    point
    women
    traveled
    extraordinary
    left
    both
    childhood
    recently
    broader
    all
    control
    activism
    back
    military
    1948
    stories
    catholic
    skotnicki
    anthologies
    historian
    capitalism
    understand
    objects
    intellectuals
    acculturation
    indelible
    responses
    far
    ethic
    activists
    marriage
    complex
    gollance
    dear
    starting
    caught
    extensive
    narrative
    might
    neoliberalism
    mixed
    examining
    declassified
    trauma
    went
    perspective
    academic
    eastern
    contested
    whether
    essential
    analysis
    figures
    international
    integration
    six
    interests
    experienced
    goods
    emerged
    forces
    urban
    attention
    vivid
    faith
    individual
    violent
    archives
    connections
    reforms
    french
    family
    transnational
    forged
    germans
    came
    gumbrecht
    fully
    empire
    children
    human
    authority
    eighteenth
    coleman
    change
    intellectual
    dynamic
    crucial
    generation
    men
    propaganda
    questions
    fallout
    iraqi
    illustrates
    armies
    forefront
    counterintuitive
    divulging
    associated
    based
    existential
    algeria
    constituted
    readers
    modes
    seeing
    recasts
    fear
    polity
    important
    places
    transcends
    innocent
    civil
    physical
    demanded
    master
    mid
    anxieties
    topics
    less
    site
    famous
    fledgling
    see
    collections
    returning
    brankley
    forging
    intentionally
    early
    twenty
    internal
    administrations
    forebears
    received
    engagement
    ruling
    internationally
    leaves
    selves
    kingdom
    notoriously
    lifetime
    king
    ideologies
    belief
    push
    pre
    official
    weber
    decreased
    prohibits
    academics
    now
    mixing
    emergence
    accounts
    traditional
    vanishing
    cosmopolitan
    sensual
    typically
    major
    gratification
    when
    modernity
    sudan
    context
    marvelous
    abolitionist
    worldly
    success
    weaves
    led
    agents
    race
    series
    frustrated
    universities
    more
    several
    find
    contemporaries
    offer
    socialist
    pleasures
    guide
    2003
    vantage
    centrifugal
    coped
    theologians
    orders
    anonymous
    editor
    recover
    foreign
    rule
    hungary
    sociologists
    beginnings
    current
    wide
    commodity
    price
    law
    sectarianism
    widow
    transformative
    territorial
    practices
    money
    reverberations
    battle
    wwi
    greater
    universal
    largely
    highlights
    luminaries
    ground
    set
    turn
    debt
    hegemonic
    takes
    soldiers
    fueled
    capital
    divided
    charged
    phones
    sign
    became
    cruelty
    wither
    dark
    transatlantic
    plenitude
    infinite
    architects
    division
    rebuilding
    lichtenberg
    probing
    producing
    independent
    1952
    france
    seeking
    reader
    spiritual
    megan
    sense
    norms
    anglo
    punjab
    thus
    academia
    perils
    scholar
    conventionally
    compact
    details
    ethical
    generations
    first
    dances
    voltaire
    become
    portraits
    trade
    themes
    telangana
    resilience
    diplomats
    protagonists
    nationalists
    bureaucrat
    creation
    christian
    addressing
    fickle
    brings
    platitudes
    conceptually
    forceful
    place
    roots
    archipelago
    shines
    unofficial
    converge
    worked
    rate
    friendship
    reimagine
    pamphlets
    uncovers
    bound
    feature
    erasure
    coordinated
    troubling
    time
    texts
    startling
    sheds
    promoted
    fashion
    reminds
    system
    indoctrinate
    same
    animating
    capturing
    lays
    anyone
    events
    privileged
    competition
    bringing
    balls
    indebted
    kant
    producers
    shows
    before
    dearly
    1970s
    attack
    elegant
    invasion
    center
    representations
    bombardment
    sensibilities
    belatedly
    everything
    enemies
    laborers
    disciplines
    information
    give
    hegel
    enjoyment
    calls
    raises
    during
    foremost
    hearts
    hop
    experiences
    fair
    regarded
    colonialism
    bretton
    sanctioned
    denis
    sweden
    challenges
    competitiveness
    testimonies
    tells
    enticing
    deeply
    anthropologists
    configured
    character
    would
    painful
    truman
    designs
    commodities
    touch
    vividness
    decline
    exposes
    collage
    fascinated
    grand
    ranks
    calculation
    presidency
    concluded
    collected
    imperative
    franchise
    even
    space
    flexible
    illuminates
    foundational
    advancing
    encroachment
    occurred
    boundary
    turns
    supply
    reconciling
    arrived
    domestic
    prefer
    two
    making
    readings
    roll
    our
    voices
    respects
    popularity
    reveals
    numbers
    grew
    spend
    provocative
    government
    writings
    sacramental
    found
    keeping
    formally
    leaders
    order
    identify
    liveliest
    legacy
    english
    outsiders
    revealing
    books
    conceptual
    works
    helped
    eroticism
    bay
    russian
    operations
    kathryn
    positions
    characterized
    patterns
    reimagines
    federal
    truth
    repercussions
    negotiated
    actors
    ranging
    fate
    long
    choices
    impacts
    anglocentric
    poet
    contracts
    inescapable
    right
    campaigns
    rich
    notions
    opened
    indian
    trajectories
    insiders
    establish
    intent
    aftermath
    discontinuities
    throughout
    wishes
    promote
    turbulent
    memory
    had
    preserving
    czechoslovakia
    attempt
    considers
    peace
    self
    magazines
    eisenhower
    some
    reveal
    discussions
    era
    liberation
    simultaneously
    partitioning
    took
    lucky
    originating
    writes
    discipline
    partners
    linking
    little
    builders
    amidst
    pieces
    welfare
    venues
    charly
    widely
    sonia
    fissures
    indonesia
    histories
    appear
    accomplished
    any
    opportunities
    hume
    exchange
    leadership
    miraculous
    undermined
    radio
    experts
    reaching
    church
    spread
    inflated
    mozart
    eight
    educations
    ones
    interest
    across
    shock
    holds
    iranian
    arc
    uncanny
    export
    class
    raise
    affluence
    shay
    inherited
    specific
    shifting
    afar
    consortium
    reform
    instead
    heavenly
    trump
    lies
    hans
    arrogance
    interpret
    1945
    functions
    firsthand
    woods
    1949
    irritation
    protestant
    face
    responsible
    finland
    broadcasts
    ostermann
    reagan
    question
    lines
    dangers
    lebanon
    common
    bravery
    markets
    activist
    dissent
    covers
    considerations
    painter
    america
    increased
    liberal
    eventually
    tradition
    distinctly
    hip
    vietnam
    manners
    conjuring
    once
    part
    seventeenth
    combining
    growing
    pragmatic
    actions
    acclaimed
    clearly
    pressing
    undermine
    different
    collects
    defense
    israeli
    petroleum
    perception
    fight
    geo
    examination
    turned
    gave
    protected
    arena
    consequences
    household
    casts
    quiet
    crafted
    predicted
    ultimate
    she
    longest
    engagements
    oeuvre
    volume
    security
    lens
    task
    significant
    viewing
    just
    clothes
    driven
    insights
    fallen
    theory
    months
    characteristics
    hyderabad
    safety
    meet
    founding
    phenomena
    globe
    nevertheless
    giving
    syrian
    1953
    colony
    hazkani
    consider
    focusing
    however
    paying
    schiller
    holland
    partition
    philosopher
    prosperous
    makers
    translator
    surprising
    remember
    measures
    from1945
    continuities
    ulrich
    elaborates
    colors
    execs
    motif
    each
    tell
    side
    approach
    incisive
    tends
    writers
    society
    acts
    indonesian
    principles
    pioneering
    tension
    talismans
    2020
    constituent
    return
    diverse
    lack
    interviews
    entanglement
    lively
    pressure
    england
    washington
    correspond
    potential
    madrasas
    norway
    golden
    perplexing
    transforms
    detail
    struggled
    been
    uncertain
    paid
    flirt
    access
    abandonment
    narratives
    extant
    building
    assembly
    join
    obsessive
    rationale
    qualities
    archive
    gestures
    perennial
    framework
    decades
    repeated
    understood
    belonged
    can
    tensions
    saudi
    displacement
    nationalization
    company
    thatcher
    records
    officials
    critic
    constructed
    democratic
    come
    brandon
    conjunctures
    reflation
    knowledge
    populace
    delineate
    boundaries
    unlike
    regime
    endemic
    result
    reasoning
    private
    ideas
    nazi
    partially
    containing
    seen
    picture
    prejudice
    contrast
    sugar
    decolonization
    themselves
    rational
    arabs
    wrestled
    engages
    broke
    keynesian
    created
    gradually
    three
    transformation
    safely
    imprints
    age
    1946
    invisible
    look
    art
    its
    entertaining
    bits
    transitions
    genesis
    involvement
    chain
    relationships
    past
    evidence
    explores
    emancipation
    republican
    exaggerations
    2010
    original
    bare
    already
    force
    civic
    production
    refined
    revolutionary
    transgression
    desiring
    prevailing
    thought
    investigates
    transformed
    anthologized
    dominated
    ordinary
    asks
    final
    entangled
    limits
    volcker
    nineteenth
    encyclopédie
    interventions
    manage
    quelling
    metaphor
    scientists
    launched
    jews
    sovereign
    deployed
    minds
    itself
    policymakers
    studying
    societies
    contours
    similarities
    luxury
    tad
    cloaked
    attest
    pioneers
    speak
    top
    assume
    poems
    vague
    end
    sympathizing
    apprehend
    communism
    unconscious
    university
    destabilized
    prioritized
    according
    dimensions
    impact
    protect
    post
    pundits
    goya
    wealth
    standing
    psychological
    alliance
    experience
    parallel
    multifaceted
    great
    delayed
    rousseau
    date
    experiment
    election
    circle
    comparative
    thousands
    mundane
    taking
    stabilize
    deconstructs
    reshaped
    made
    southern
    historians
    schools
    romeo
    disrupted
    confrontation
    unique
    juliet
    daily
    warfare
    networks
    novelist
    sustained
    inaugurated
    heart
    reading
    industry
    rigors
    marks
    diplomacy
    disenchanted
    pride
    forgets
    intervention
    sympathetic
    empirically
    roles
    identity
    march
    plugged
    rdquo
    following
    secular
    unearthing
    tanugi
    doing
    waste
    gabriel
    technocrats
    correlations
    elise
    millennia
    competitive
    causes
    equally
    obsessed
    career
    powers
    needed
    philippe
    balkans
    influential
    overcome
    nations
    dispossessed
    breen
    winant
    recognition
    forgotten
    overseas
    tehran
    local
    armenians
    establishment
    boldly
    decried
    horde
    belonging
    vindicated
    simon
    select
    exporting
    forms
    drama
    within
    disruptions
    earliest
    required
    soon
    material
    april
    unusual
    role
    elite
    learn
    duration
    finds
    surveys
    000
    statistical
    sources
    susan
    classrooms
    merchants
    mit
    9780674244214
    ethnographic
    sets
    dictate
    among
    pariah
    greek
    lesjak
    engaging
    prevailed
    terry
    failed
    mdash
    used
    advisors
    aberrations
    claims
    alan
    specialized
    anti
    printing
    caspian
    unpacks
    nail
    didn
    china
    kleeman
    celestial
    service
    away
    mia
    happened
    coincided
    1908
    treatises
    enable
    lorenzo
    saw
    cuba
    words
    hold
    redefined
    jack
    nation
    diversity
    joon
    fossil
    unprecedented
    peninsula
    lived
    plays
    breslin
    candlelit
    mineral
    japanese
    endorsing
    9780674251281
    evolution
    deeper
    lost
    boredom
    conception
    niccol
    business
    9780674916494
    happening
    newly
    exploring
    witty
    ecological
    community
    day
    continued
    established
    follows
    supplied
    methods
    boulevards
    record
    like
    undertook
    transported
    blue
    creative
    earth
    koreans
    bulgaria
    better
    market
    remains
    where
    9780674247949
    latest
    matthes
    criminal
    unrestricted
    pilgrims
    priest
    carter
    enriched
    sensitivity
    9780674241282
    minerals
    boring
    minorities
    processes
    9780674237162
    adolescents
    thomas
    9780674238091
    grow
    along
    park
    unexplored
    wine
    feel
    nature
    özden
    gain
    deficits
    possibilities
    afterlife
    client
    structural
    working
    george
    ideal
    servant
    imagine
    bodies
    scrutinized
    iran
    nothing
    universally
    too
    9780674251403
    tourists
    begin
    supposedly
    introduction
    alternate
    allegory
    globally
    solely
    underpinnings
    played
    call
    gentry
    legal
    myths
    meditation
    mobilization
    field
    actually
    korean
    schilling
    senses
    geological
    guerilla
    south
    hill
    reflect
    rarely
    operators
    corporate
    materialist
    compelling
    arguments
    9780674251397
    localized
    narrators
    cult
    write
    sixth
    9780674971165
    compensating
    wwii
    egalitarian
    creating
    wars
    ograve
    anticolonial
    occupied
    freymann
    ethnography
    pointed
    herero
    embracing
    gained
    hail
    campaign
    publications
    charles
    seriously
    minister
    effects
    1821
    accusation
    credibility
    abusive
    individuals
    expeditions
    utterly
    seething
    reins
    keep
    stretched
    reckless
    alive
    solution
    easily
    judge
    having
    della
    hussam
    traces
    until
    david
    dare
    600
    perhaps
    mainstream
    ought
    technological
    colonial
    array
    citizens
    peripheral
    operation
    yemen
    coverage
    towering
    eve
    kinds
    speaks
    moves
    provide
    canay
    outdated
    origin
    magna
    always
    engaged
    hussein
    travel
    defined
    medicine
    second
    road
    preserved
    9780674251229
    bulgarian
    alike
    conflicting
    central
    citizen
    issues
    active
    devoted
    destruction
    anecdote
    committed
    directions
    givens
    foot
    ldquo
    kurt
    thinkers
    rail
    collar
    diamonds
    large
    skills
    plastic
    crossroads
    edge
    territories
    admiration
    africa
    300
    definitions
    provinces
    trained
    european
    analyzes
    immense
    hitherto
    longstanding
    short
    collection
    9780674251137
    temporary
    nurture
    existing
    verve
    being
    skyrocketed
    futurists
    segregation
    1877
    overlooked
    health
    paperback
    sent
    humankind
    9780674975262
    historiographies
    subjects
    dramatic
    ghervas
    myself
    fighters
    9780674987432
    prospect
    conservation
    oldest
    nonetheless
    flourishing
    redefines
    ahmed
    renaissance
    9780674916500
    advice
    9780674251175
    should
    reasons
    sink
    enclosure
    project
    engineers
    9780674983687
    status
    locates
    whitman
    surrounded
    materials
    founders
    asia
    selfhood
    thinking
    bones
    contributed
    african
    yung
    hands
    montgomery
    degradation
    stephanie
    jobs
    centralized
    land
    alexis
    cosmos
    unintended
    lessons
    population
    affords
    backfired
    masters
    jim
    spirit
    chen
    deal
    1830
    sequencing
    requirements
    noble
    introduces
    goes
    discussion
    shift
    occur
    egypt
    1787
    1973
    fieldwork
    path
    deemed
    disappear
    capture
    natural
    experimental
    ndash
    daoism
    gaza
    koyagi
    rights
    constantinos
    stored
    breaking
    biocentric
    former
    melissa
    cosmic
    xinyu
    descendants
    route
    distinction
    other
    representing
    bus
    unionized
    plant
    witness
    erik
    approaches
    written
    remaining
    genome
    know
    burgeoning
    burton
    oriented
    opening
    completed
    thereby
    pyongyang
    decolonizing
    period
    looked
    9780674247963
    unity
    proclaimed
    episode
    railway
    booker
    organisms
    especially
    sizable
    analysts
    bunel
    taverns
    russo
    expertise
    mass
    isolated
    turk
    peoples
    taha
    emphasis
    workers
    matters
    turks
    graduate
    response
    visual
    mongols
    planet
    contributing
    battlefield
    persian
    appealed
    intended
    constitution
    invited
    various
    carolyn
    intersection
    memoirs
    allegorical
    sees
    than
    heterogenous
    claim
    exercised
    financed
    nahdawi
    sea
    beronda
    armenian
    front
    financial
    recovering
    woodson
    regroup
    patriotic
    singular
    trans
    mccurry
    1878
    convoluted
    realist
    demand
    beau
    renouncing
    november
    chul
    forecasted
    scales
    mobility
    ninger
    challenging
    voluntary
    eliot
    leading
    lifelong
    grip
    appropriations
    strata
    redefine
    grid
    hyping
    geneticists
    nonviolent
    ümit
    instruction
    privatization
    rewrites
    president
    watching
    considerable
    lands
    constitutional
    produced
    travelogues
    coddled
    paschalis
    debate
    conquerors
    imported
    figuration
    milena
    politically
    redding
    cradle
    larger
    truly
    ask
    another
    present
    highlight
    pivotal
    projects
    water
    suspected
    may
    migrant
    built
    minority
    respecting
    changed
    1922
    police
    stalled
    edmundson
    noh
    attend
    mysterious
    eye
    canonical
    happens
    imaginary
    changes
    iconic
    controversy
    anecdotal
    clear
    function
    ottoman
    desegregation
    uninteresting
    characters
    freedom
    animals
    dharma
    schooling
    planetary
    constitutions
    cohen
    prominent
    suggest
    immature
    jodie
    humanity
    believer
    tribesmen
    continue
    allegories
    significance
    subversive
    nama
    account
    group
    airline
    adjustment
    need
    navigated
    communal
    glasses
    nancy
    lincoln
    means
    flows
    congress
    developments
    hardy
    defining
    mean
    libationer
    remembered
    essays
    third
    infrastructural
    crime
    against
    brought
    mikiya
    inconsistent
    chinese
    inclusion
    commons
    closer
    detailing
    countries
    formation
    observations
    jefferson
    genocide
    novel
    sklansky
    missing
    responsibility
    indispensable
    basic
    novice
    act
    1950s
    underpaid
    slow
    abraham
    energies
    kinetic
    draws
    covering
    recent
    looks
    competitively
    earlier
    enduring
    technology
    belongs
    feudal
    jinping
    utopian
    achieve
    insight
    program
    personalities
    collective
    citizenship
    terrorist
    kim
    quirky
    nationalist
    justice
    aghion
    reconceives
    imperialist
    diffuse
    instance
    terrestrial
    tale
    detect
    landscape
    budding
    9780674988194
    philosophy
    wake
    korea
    innocently
    reinvented
    conversations
    insightful
    printer
    environmental
    mark
    tracing
    position
    particular
    italy
    public
    extended
    humanlike
    continental
    commonplace
    education
    injustice
    methodieva
    motivated
    ago
    patronage
    clout
    mobile
    cannot
    lorenz
    reoriented
    newspapers
    above
    warning
    enterprises
    1960s
    birth
    backdrop
    transport
    kyung
    available
    daoist
    policies
    tsoukalas
    there
    rethink
    relieved
    strong
    philosophical
    using
    genetics
    euroskeptics
    1920s
    care
    identities
    geology
    klein
    populations
    turkey
    homes
    nor
    mourned
    crafting
    five
    hospital
    something
    egyptian
    levels
    ritual
    böninger
    reshaping
    typical
    sidelines
    argue
    manufacturing
    atmosphere
    anthropology
    science
    years
    sought
    goals
    ouml
    overthrow
    radical
    connected
    gripping
    mental
    revolutions
    blood
    students
    enact
    press
    flux
    favereau
    could
    steven
    challenge
    hardly
    tribute
    developing
    strip
    returns
    contest
    jarvis
    plants
    number
    systematic
    politicians
    certain
    rsquo
    hometown
    reconsider
    refer
    multinational
    wrote
    biography
    heavily
    biblical
    college
    motion
    religion
    suggests
    activities
    beaches
    show
    song
    neither
    think
    infrastructures
    profound
    streets
    medieval
    does
    brother
    dead
    blakeley
    scientific
    concepts
    living
    foundations
    changing
    activity
    urges
    9780674983519
    technologically
    imaginations
    gaziantep
    unfolding
    genetic
    highly
    céline
    illuminating
    cultures
    debated
    worldview
    educators
    inequality
    answer
    madison
    lighting
    1889
    longer
    arguing
    structure
    build
    deserts
    energy
    term
    trends
    stella
    terms
    revolution
    9780674979963
    pulled
    james
    inflected
    denizens
    horizon
    dickens
    liberalization
    gulf
    often
    make
    incarceration
    azhar
    publication
    continent
    weaving
    assist
    aims
    dispossession
    resonances
    relinquished
    endure
    parliamentary
    expenditure
    known
    simplistic
    why
    struggle
    ethics
    north
    huge
    engineering
    multi
    fact
    danish
    cutting
    antonin
    preachers
    enclosures
    pursuing
    marie
    innovation
    gradual
    crane
    9780674248908
    seems
    conjecture
    language
    rather
    sermons
    crimes
    developmental
    uuml
    megaproject
    mourning
    data
    detailed
    constantly
    must
    muslims
    possibly
    crises
    southwest
    pro
    crow
    1938
    unparalleled
    unified
    implemented
    9780674247840
    primary
    millennial
    balkan
    rely
    black
    tragedies
    chicken
    outlook
    achievement
    imprint
    electricity
    fascinating
    tribal
    momentum
    subject
    nomads
    forests
    kitromilides
    steer
    effortlessly
    dive
    disruption
    formations
    flow
    adaptive
    transform
    belt
    shishuo
    makes
    ancient
    elevating
    union
    volunteer
    civilizations
    dissolution
    realities
    model
    use
    prose
    dissemination
    map
    idea
    educating
    forced
    taken
    authors
    electric
    imperialism
    take
    forward
    run
    adults
    craft
    fundamental
    majority
    convention
    bearer
    infrastructure
    challenged
    breakthroughs
    walt
    practice
    artifact
    event
    renowned
    combined
    larson
    markers
    humans
    eyck
    disappointed
    behaviors
    climate
    remembering
    here
    rehearsal
    followers
    hand
    reconstruction
    catch
    media
    HV**HV**HV**HV**HV**HV**HV**HV**HV**HV**
    april
    march
    rsquo
    mdash
    today
    more
    shows
    have
    women
    political
    were
    black
    civil
    hill
    are
    mass
    than
    redding
    story
    been
    has
    gabriel
    causes
    movement
    winant
    united
    finds
    alan
    mia
    his
    working
    century
    violence
    traces
    david
    they
    givens
    kurt
    thinkers
    before
    european
    paperback
    ghervas
    whitman
    europe
    stephanie
    alexis
    jim
    then
    who
    bay
    turks
    mongols
    long
    mccurry
    peace
    young
    any
    edmundson
    capitalism
    class
    continue
    nancy
    was
    genocide
    sklansky
    mark
    what
    press
    steven
    jarvis
    life
    come
    brother
    while
    stella
    since
    violent
    power
    crow
    rdquo
    unearthing
    tanugi
    competitive
    obsessed
    philippe
    influential
    dispossessed
    recognition
    forgotten
    mid
    local
    less
    armenians
    decried
    horde
    simon
    within
    soon
    role
    elite
    classrooms
    merchants
    mit
    9780674244214
    terry
    didn
    economy
    kleeman
    celestial
    service
    enable
    saw
    now
    nation
    lived
    research
    states
    mineral
    evolution
    9780674916494
    newly
    supplied
    methods
    like
    undertook
    blue
    creative
    better
    about
    market
    remains
    9780674247949
    latest
    criminal
    price
    unrestricted
    law
    priest
    carter
    enriched
    9780674237162
    adolescents
    politics
    9780674238091
    gain
    deficits
    whose
    fueled
    ideal
    universally
    9780674251403
    solely
    played
    gentry
    legal
    operators
    corporate
    first
    sixth
    9780674971165
    compensating
    egalitarian
    wars
    pointed
    herero
    through
    effects
    brings
    accusation
    abusive
    place
    solution
    judge
    literature
    mainstream
    peripheral
    western
    provide
    always
    travel
    second
    9780674251229
    central
    citizen
    devoted
    destruction
    ldquo
    rail
    collar
    diamonds
    edge
    africa
    300
    definitions
    under
    nurture
    skyrocketed
    segregation
    view
    health
    9780674975262
    dramatic
    during
    myself
    prospect
    9780674916500
    advice
    engineers
    9780674983687
    status
    asia
    selfhood
    degradation
    jobs
    land
    masters
    spirit
    noble
    goes
    shift
    deemed
    disappear
    daoism
    breaking
    distinction
    other
    reveals
    representing
    bus
    unionized
    leaders
    thereby
    unity
    close
    especially
    bunel
    peoples
    battlefield
    all
    rich
    financed
    armenian
    financial
    woodson
    demand
    back
    mobility
    challenging
    stories
    nonviolent
    ümit
    coddled
    conquerors
    politically
    highlight
    may
    built
    police
    stalled
    undermined
    not
    eye
    clear
    shifting
    understanding
    desegregation
    freedom
    reform
    instead
    schooling
    cohen
    immature
    jodie
    believer
    subversive
    nama
    airline
    need
    work
    republic
    common
    libationer
    remembered
    crime
    against
    inconsistent
    inclusion
    indispensable
    novice
    act
    complex
    underpaid
    protected
    draws
    covering
    she
    enduring
    feudal
    achieve
    justice
    aghion
    budding
    innocently
    founding
    environmental
    commonplace
    education
    motivated
    ago
    clout
    warning
    1960s
    german
    daoist
    policies
    society
    east
    euroskeptics
    care
    turkey
    five
    hospital
    ritual
    typical
    sidelines
    argue
    manufacturing
    years
    sought
    radical
    gripping
    students
    access
    favereau
    analysis
    hardly
    returns
    contest
    decades
    number
    politicians
    hometown
    heavily
    college
    show
    people
    song
    democratic
    provides
    between
    gaziantep
    unfolding
    céline
    themselves
    inequality
    created
    middle
    its
    revolution
    9780674979963
    past
    explores
    incarceration
    continent
    individual
    known
    simplistic
    why
    struggle
    huge
    cutting
    antonin
    transformed
    pursuing
    dominated
    marie
    innovation
    ordinary
    9780674248908
    language
    crimes
    uuml
    detailed
    empire
    luxury
    southwest
    pro
    children
    development
    implemented
    consumer
    achievement
    imprint
    nomads
    standing
    disruption
    studies
    makes
    elevating
    union
    great
    volunteer
    realities
    model
    educating
    authors
    imperialism
    adults
    challenged
    argues
    walt
    men
    combined
    markers
    behaviors
    roles
    followers
    reconstruction
    illustrates
    plugged
    armies
    forefront
    following
    secular
    counterintuitive
    regional
    doing
    divulging
    waste
    concerns
    technocrats
    associated
    correlations
    last
    elise
    based
    sovereignty
    millennia
    existential
    equally
    algeria
    constituted
    readers
    modes
    seeing
    career
    recasts
    powers
    fear
    needed
    polity
    balkans
    important
    overcome
    places
    nations
    transcends
    breen
    innocent
    physical
    demanded
    master
    overseas
    tehran
    style
    anxieties
    topics
    site
    famous
    establishment
    boldly
    fledgling
    belonging
    vindicated
    select
    see
    collections
    ultimately
    returning
    brankley
    forging
    exporting
    forms
    drama
    intentionally
    disruptions
    early
    earliest
    required
    economic
    twenty
    many
    internal
    material
    unusual
    administrations
    learn
    duration
    sexual
    forebears
    preoccupations
    surveys
    received
    000
    own
    statistical
    movements
    sources
    engagement
    susan
    ruling
    internationally
    ethnographic
    sets
    scarcity
    leaves
    largest
    dictate
    among
    pariah
    selves
    greek
    into
    kingdom
    lesjak
    engaging
    notoriously
    prevailed
    failed
    lifetime
    used
    advisors
    aberrations
    claims
    king
    specialized
    anti
    printing
    caspian
    ideologies
    unpacks
    belief
    nail
    push
    china
    pre
    official
    historical
    weber
    away
    decreased
    happened
    prohibits
    coincided
    1908
    treatises
    eurozone
    lorenzo
    labor
    academics
    cuba
    mixing
    words
    hold
    emergence
    accounts
    redefined
    traditional
    jack
    vanishing
    cosmopolitan
    sensual
    typically
    germany
    scenes
    diversity
    joon
    major
    fossil
    unprecedented
    beyond
    gratification
    when
    peninsula
    modernity
    sudan
    context
    marvelous
    plays
    islam
    abolitionist
    lives
    breslin
    worldly
    success
    weaves
    candlelit
    led
    agents
    race
    series
    spheres
    frustrated
    universities
    japanese
    endorsing
    9780674251281
    several
    find
    deeper
    palestine
    lost
    contemporaries
    boredom
    conception
    niccol
    business
    debates
    offer
    socialist
    happening
    witnesses
    exploring
    witty
    ecological
    paranoid
    community
    day
    continued
    established
    follows
    pleasures
    boulevards
    record
    guide
    2003
    vantage
    transported
    centrifugal
    coped
    earth
    koreans
    theologians
    bulgaria
    gender
    orders
    anonymous
    editor
    recover
    foreign
    rule
    hungary
    sociologists
    beginnings
    current
    diderot
    where
    wide
    matthes
    babayan
    commodity
    pilgrims
    sectarianism
    general
    widow
    transformative
    territorial
    practices
    covert
    sensitivity
    9780674241282
    minerals
    boring
    minorities
    money
    crisis
    reverberations
    elites
    processes
    battle
    wwi
    thomas
    consumption
    encounter
    greater
    imperial
    universal
    grow
    along
    largely
    park
    highlights
    luminaries
    ground
    set
    turn
    unexplored
    wine
    feel
    nature
    marilyn
    cultural
    özden
    debt
    hegemonic
    contemporary
    relations
    possibilities
    takes
    afterlife
    client
    structural
    soldiers
    capital
    divided
    george
    charged
    phones
    sign
    became
    cruelty
    shaped
    wither
    servant
    imagine
    bodies
    democracy
    periphery
    dark
    transatlantic
    plenitude
    scrutinized
    infinite
    iran
    nothing
    global
    architects
    division
    too
    rebuilding
    lichtenberg
    army
    tourists
    begin
    probing
    producing
    independent
    supposedly
    introduction
    1952
    alternate
    allegory
    france
    moment
    globally
    action
    seeking
    underpinnings
    reader
    key
    spiritual
    call
    israel
    megan
    sense
    norms
    anglo
    myths
    meditation
    mobilization
    punjab
    field
    actually
    thus
    academia
    korean
    schilling
    perils
    scholar
    senses
    geological
    guerilla
    conventionally
    south
    process
    compact
    reflect
    rarely
    ipc
    details
    ethical
    materialist
    compelling
    generations
    postcolonial
    arguments
    9780674251397
    dances
    voltaire
    presents
    oil
    localized
    become
    narrators
    cult
    portraits
    trade
    write
    modern
    wwii
    themes
    creating
    telangana
    ograve
    resilience
    anticolonial
    occupied
    freymann
    such
    powerful
    diplomats
    protagonists
    ethnography
    nationalists
    embracing
    gained
    hail
    campaign
    publications
    bureaucrat
    creation
    charles
    seriously
    christian
    addressing
    minister
    fickle
    1821
    credibility
    platitudes
    individuals
    expeditions
    conceptually
    relationship
    utterly
    seething
    forceful
    reins
    religious
    centuries
    keep
    roots
    stretched
    reckless
    archipelago
    shines
    unofficial
    alive
    converge
    easily
    having
    della
    hussam
    worked
    until
    only
    dare
    raj
    rate
    friendship
    600
    perhaps
    ought
    reimagine
    technological
    colonial
    array
    pamphlets
    uncovers
    citizens
    one
    around
    bound
    operation
    yemen
    capitalist
    feature
    most
    coverage
    course
    towering
    eve
    erasure
    kinds
    behind
    coordinated
    speaks
    moves
    canay
    outdated
    origin
    troubling
    magna
    implications
    engaged
    time
    hussein
    india
    texts
    startling
    defined
    princely
    rise
    medicine
    arab
    twentieth
    road
    preserved
    bulgarian
    alike
    conflicting
    sheds
    promoted
    fashion
    neoliberal
    issues
    reminds
    active
    system
    indoctrinate
    same
    form
    animating
    capturing
    will
    anecdote
    lays
    committed
    anyone
    directions
    foot
    attributed
    events
    privileged
    competition
    bringing
    personal
    balls
    indebted
    kant
    large
    producers
    together
    skills
    plastic
    crossroads
    territories
    dearly
    which
    admiration
    1970s
    attack
    elegant
    invasion
    center
    provinces
    independence
    representations
    trained
    bombardment
    sensibilities
    belatedly
    everything
    analyzes
    immense
    hitherto
    longstanding
    short
    collection
    9780674251137
    temporary
    enemies
    laborers
    disciplines
    existing
    information
    verve
    communities
    being
    give
    futurists
    1877
    hegel
    literary
    enjoyment
    overlooked
    calls
    sent
    humankind
    historiographies
    subjects
    raises
    foremost
    hearts
    hop
    fighters
    experiences
    9780674987432
    efforts
    fair
    regarded
    colonialism
    bretton
    sanctioned
    conservation
    denis
    oldest
    nonetheless
    flourishing
    them
    redefines
    ahmed
    sweden
    challenges
    competitiveness
    testimonies
    renaissance
    tells
    lasting
    9780674251175
    should
    enticing
    reasons
    deeply
    anthropologists
    sink
    nationalism
    configured
    character
    enclosure
    project
    deep
    would
    painful
    locates
    surrounded
    materials
    founders
    truman
    designs
    commodities
    thinking
    bones
    touch
    contributed
    vividness
    decline
    exposes
    african
    yung
    hands
    montgomery
    collage
    abbas
    fascinated
    centralized
    grand
    cosmos
    unintended
    lessons
    population
    affords
    documents
    backfired
    enlightenment
    ranks
    archival
    calculation
    presidency
    concluded
    collected
    sex
    imperative
    chen
    managers
    deal
    1830
    sequencing
    franchise
    requirements
    even
    space
    introduces
    flexible
    illuminates
    discussion
    also
    foundational
    occur
    egypt
    1787
    1973
    fieldwork
    included
    path
    advancing
    encroachment
    occurred
    capture
    way
    natural
    experimental
    ndash
    ethnic
    boundary
    turns
    supply
    gaza
    residents
    koyagi
    reconciling
    rights
    very
    point
    arrived
    constantinos
    domestic
    islamic
    prefer
    traveled
    stored
    two
    making
    readings
    biocentric
    extraordinary
    roll
    former
    melissa
    cosmic
    xinyu
    our
    voices
    respects
    descendants
    route
    popularity
    numbers
    home
    left
    isfahan
    grew
    plant
    spend
    witness
    provocative
    both
    erik
    government
    writings
    sacramental
    offering
    approaches
    written
    found
    remaining
    keeping
    genome
    formally
    know
    burgeoning
    burton
    oriented
    opening
    completed
    pyongyang
    order
    identify
    liveliest
    decolonizing
    legacy
    english
    period
    outsiders
    revealing
    looked
    9780674247963
    yet
    childhood
    books
    recently
    conceptual
    works
    proclaimed
    episode
    railway
    booker
    helped
    organisms
    sizable
    analysts
    eroticism
    russian
    operations
    kathryn
    taverns
    russo
    expertise
    positions
    characterized
    isolated
    patterns
    origins
    turk
    taha
    reimagines
    emphasis
    federal
    workers
    truth
    matters
    repercussions
    negotiated
    broader
    graduate
    response
    actors
    visual
    ranging
    fate
    planet
    contributing
    persian
    choices
    appealed
    intended
    impacts
    constitution
    invited
    anglocentric
    various
    carolyn
    poet
    contracts
    inescapable
    right
    campaigns
    intersection
    memoirs
    allegorical
    memories
    sees
    control
    heterogenous
    claim
    notions
    exercised
    opened
    activism
    indian
    trajectories
    insiders
    establish
    intent
    aftermath
    ways
    nahdawi
    sea
    beronda
    front
    discontinuities
    friends
    recovering
    throughout
    wishes
    promote
    regroup
    turbulent
    patriotic
    memory
    singular
    trans
    had
    preserving
    czechoslovakia
    attempt
    considers
    1878
    convoluted
    realist
    conflict
    beau
    self
    military
    magazines
    renouncing
    eisenhower
    some
    november
    chul
    forecasted
    scales
    reveal
    discussions
    ninger
    era
    liberation
    simultaneously
    voluntary
    eliot
    1948
    leading
    partitioning
    took
    lifelong
    lucky
    originating
    grip
    appropriations
    strata
    letters
    writes
    redefine
    discipline
    grid
    hyping
    partners
    catholic
    geneticists
    linking
    instruction
    privatization
    rewrites
    president
    little
    watching
    considerable
    lands
    constitutional
    produced
    travelogues
    builders
    paschalis
    amidst
    pieces
    debate
    skotnicki
    anthologies
    imported
    welfare
    venues
    charly
    widely
    figuration
    milena
    sonia
    fissures
    cradle
    indonesia
    larger
    histories
    truly
    ask
    appear
    another
    present
    accomplished
    iraq
    pivotal
    projects
    water
    opportunities
    suspected
    hume
    migrant
    minority
    respecting
    changed
    1922
    exchange
    leadership
    noh
    miraculous
    radio
    attend
    historian
    experts
    mysterious
    reaching
    canonical
    those
    church
    spread
    inflated
    understand
    happens
    mozart
    eight
    imaginary
    changes
    educations
    ones
    interest
    across
    shock
    holds
    iranian
    arc
    uncanny
    objects
    export
    iconic
    controversy
    intellectuals
    anecdotal
    acculturation
    raise
    affluence
    shay
    inherited
    indelible
    function
    ottoman
    writing
    specific
    communist
    uninteresting
    afar
    characters
    consortium
    animals
    dharma
    well
    heavenly
    trump
    lies
    planetary
    constitutions
    prominent
    hans
    arrogance
    suggest
    interpret
    1945
    humanity
    functions
    responses
    far
    tribesmen
    allegories
    significance
    culture
    firsthand
    woods
    account
    1949
    group
    irritation
    adjustment
    navigated
    communal
    glasses
    protestant
    face
    responsible
    finland
    lincoln
    means
    broadcasts
    ostermann
    obscured
    ethic
    flows
    congress
    developments
    reagan
    question
    lines
    dangers
    lebanon
    hardy
    bravery
    markets
    activist
    defining
    dissent
    covers
    considerations
    painter
    america
    mean
    increased
    liberal
    activists
    essays
    third
    eventually
    tradition
    infrastructural
    distinctly
    hip
    vietnam
    brought
    manners
    marriage
    conjuring
    once
    mikiya
    chinese
    commons
    part
    closer
    seventeenth
    combining
    detailing
    countries
    formation
    observations
    growing
    pragmatic
    jefferson
    west
    actions
    acclaimed
    clearly
    pressing
    novel
    undermine
    different
    collects
    defense
    everyday
    israeli
    her
    missing
    petroleum
    responsibility
    did
    basic
    dance
    perception
    fight
    1950s
    geo
    examination
    turned
    gave
    arena
    consequences
    slow
    household
    abraham
    casts
    quiet
    energies
    kinetic
    gollance
    crafted
    predicted
    ultimate
    recent
    longest
    looks
    engagements
    competitively
    oeuvre
    earlier
    technology
    belongs
    jinping
    utopian
    dear
    volume
    insight
    program
    security
    lens
    personalities
    collective
    task
    citizenship
    shared
    significant
    terrorist
    kim
    quirky
    nationalist
    reconceives
    imperialist
    viewing
    diffuse
    instance
    just
    terrestrial
    tale
    clothes
    driven
    insights
    fallen
    theory
    detect
    starting
    landscape
    caught
    months
    characteristics
    hyderabad
    9780674988194
    philosophy
    wake
    safety
    korea
    meet
    phenomena
    reinvented
    globe
    conversations
    insightful
    nevertheless
    printer
    giving
    tracing
    position
    syrian
    particular
    1953
    italy
    city
    colony
    public
    hazkani
    extensive
    consider
    focusing
    extended
    however
    humanlike
    paying
    schiller
    continental
    holland
    partition
    philosopher
    prosperous
    injustice
    makers
    translator
    methodieva
    surprising
    remember
    measures
    from1945
    patronage
    mobile
    continuities
    ulrich
    cannot
    lorenz
    reoriented
    newspapers
    above
    elaborates
    colors
    enterprises
    narrative
    birth
    execs
    backdrop
    motif
    each
    transport
    tell
    kyung
    side
    approach
    available
    incisive
    tends
    tsoukalas
    writers
    influence
    there
    acts
    indonesian
    principles
    pioneering
    tension
    rethink
    relieved
    strong
    talismans
    study
    philosophical
    might
    using
    genetics
    neoliberalism
    1920s
    identities
    geology
    mixed
    national
    2020
    klein
    muslim
    populations
    examining
    constituent
    return
    diverse
    homes
    nor
    declassified
    mourned
    lack
    interviews
    crafting
    something
    egyptian
    levels
    böninger
    entanglement
    reshaping
    lively
    atmosphere
    pressure
    england
    trauma
    anthropology
    washington
    science
    correspond
    potential
    madrasas
    went
    perspective
    norway
    goals
    ouml
    overthrow
    golden
    perplexing
    transforms
    academic
    connected
    eastern
    dancing
    detail
    contested
    struggled
    mental
    whether
    revolutions
    blood
    uncertain
    enact
    paid
    flirt
    essential
    abandonment
    flux
    could
    narratives
    extant
    building
    assembly
    join
    obsessive
    challenge
    rationale
    qualities
    tribute
    developing
    archive
    gestures
    strip
    perennial
    framework
    repeated
    understood
    plants
    belonged
    systematic
    figures
    certain
    can
    tensions
    reconsider
    international
    saudi
    refer
    displacement
    multinational
    integration
    wrote
    nationalization
    biography
    biblical
    company
    motion
    thatcher
    six
    religion
    records
    suggests
    interests
    officials
    activities
    critic
    constructed
    beaches
    neither
    think
    brandon
    conjunctures
    infrastructures
    profound
    streets
    medieval
    does
    reflation
    knowledge
    dead
    blakeley
    experienced
    goods
    populace
    delineate
    scientific
    boundaries
    concepts
    living
    foundations
    changing
    unlike
    regime
    over
    endemic
    result
    drawing
    activity
    reasoning
    urges
    private
    9780674983519
    ideas
    technologically
    nazi
    imaginations
    partially
    containing
    seen
    picture
    emerged
    forces
    genetic
    highly
    prejudice
    urban
    illuminating
    contrast
    sugar
    cultures
    debated
    yalom
    decolonization
    worldview
    rational
    arabs
    educators
    cold
    wrestled
    engages
    broke
    keynesian
    hunnicutt
    gradually
    three
    answer
    madison
    lighting
    1889
    transformation
    longer
    arguing
    attention
    structure
    safely
    build
    deserts
    energy
    imprints
    term
    age
    1946
    trends
    invisible
    look
    art
    vivid
    entertaining
    terms
    bits
    pulled
    james
    inflected
    transitions
    denizens
    genesis
    involvement
    chain
    relationships
    horizon
    dickens
    liberalization
    evidence
    gulf
    often
    emancipation
    make
    republican
    azhar
    publication
    exaggerations
    weaving
    assist
    2010
    wolfe
    aims
    dispossession
    resonances
    relinquished
    original
    bare
    endure
    parliamentary
    faith
    already
    examines
    expenditure
    soviet
    force
    policy
    civic
    archives
    production
    ethics
    north
    refined
    connections
    engineering
    revolutionary
    transgression
    multi
    fact
    desiring
    prevailing
    danish
    thought
    reforms
    investigates
    preachers
    enclosures
    anthologized
    french
    family
    gradual
    transnational
    crane
    asks
    final
    forged
    entangled
    limits
    seems
    volcker
    conjecture
    nineteenth
    encyclopédie
    interventions
    germans
    rather
    sermons
    came
    manage
    quelling
    developmental
    metaphor
    megaproject
    mourning
    scientists
    gumbrecht
    launched
    fully
    data
    jews
    sovereign
    constantly
    must
    muslims
    deployed
    minds
    itself
    policymakers
    possibly
    studying
    societies
    contours
    similarities
    crises
    tad
    cloaked
    out
    1938
    unparalleled
    attest
    pioneers
    speak
    top
    unified
    assume
    poems
    vague
    british
    uprisings
    end
    sympathizing
    apprehend
    communism
    9780674247840
    human
    unconscious
    primary
    university
    millennial
    destabilized
    prioritized
    balkan
    rely
    according
    dimensions
    impact
    tragedies
    chicken
    outlook
    protect
    post
    electricity
    pundits
    fascinating
    goya
    authority
    tribal
    wealth
    momentum
    subject
    psychological
    alliance
    forests
    light
    social
    experience
    kitromilides
    steer
    remain
    effortlessly
    dive
    formations
    flow
    adaptive
    transform
    belt
    eighteenth
    parallel
    shishuo
    ancient
    country
    multifaceted
    consumers
    civilizations
    dissolution
    delayed
    rousseau
    date
    experiment
    election
    use
    circle
    prose
    comparative
    dissemination
    map
    idea
    thousands
    coleman
    demonstrates
    mundane
    taking
    change
    forced
    taken
    stabilize
    electric
    deconstructs
    reshaped
    take
    made
    intellectual
    southern
    forward
    region
    dynamic
    run
    historians
    schools
    crucial
    romeo
    craft
    disrupted
    confrontation
    fundamental
    majority
    convention
    bearer
    infrastructure
    unique
    juliet
    daily
    warfare
    networks
    novelist
    generation
    breakthroughs
    sustained
    inaugurated
    heart
    practice
    reading
    offers
    industry
    artifact
    event
    renowned
    propaganda
    questions
    rigors
    larson
    marks
    diplomacy
    disenchanted
    humans
    pride
    forgets
    eyck
    disappointed
    intervention
    fallout
    sympathetic
    climate
    remembering
    here
    jewish
    rehearsal
    empirically
    hand
    iraqi
    identity
    catch
    media

程序输出了大量的停用词，可以考虑移除固定的停用词

## csdn--中文rss

参考了博文[基于概率论的分类方法：朴素贝叶斯及CSDN_RSS源分析](https://blog.csdn.net/u010665216/article/details/78231982)

### 导入rss源

[博主OraYang的博客](http://blog.csdn.net/u010665216)及[博主j_shine的博客](http://blog.csdn.net/J_Shine)均支持RSS订阅。

```python
ora = feedparser.parse('http://blog.csdn.net/u010665216/rss/list')
lujie = feedparser.parse('http://blog.csdn.net/j_shine/rss/list')
```

### 构造rss源分类器

```python
def localWords(feed1,feed0):
    import feedparser
    docList=[]; classList = []; fullText =[]
    minLen = min(len(feed1['entries']),len(feed0['entries']))
    for i in range(minLen):
        wordList = textParse(feed1['entries'][i]['summary'])
        docList.append(wordList)
        fullText.extend(wordList)
        classList.append(1) #NY is class 1
        wordList = textParse(feed0['entries'][i]['summary'])
        docList.append(wordList)
        fullText.extend(wordList)
        classList.append(0)
    vocabList = createVocabList(docList)#create vocabulary
    top30Words = calcMostFreq(vocabList,fullText)   #remove top 30 words
    for pairW in top30Words:
        if pairW[0] in vocabList: vocabList.remove(pairW[0])
    trainingSet = list(range(2*minLen)); testSet=[]           #create test set
    for i in range(20):
        randIndex = int(random.uniform(0,len(trainingSet)))
        testSet.append(trainingSet[randIndex])
        del(trainingSet[randIndex])
    trainMat=[]; trainClasses = []
    for docIndex in trainingSet:#train the classifier (get probs) trainNB0
        trainMat.append(bagOfWords2VecMN(vocabList, docList[docIndex]))
        trainClasses.append(classList[docIndex])
    p0V,p1V,pSpam = trainNB0(np.array(trainMat),np.array(trainClasses))
    errorCount = 0
    for docIndex in testSet:        #classify the remaining items
        wordVector = bagOfWords2VecMN(vocabList, docList[docIndex])
        if classifyNB(np.array(wordVector),p0V,p1V,pSpam) != classList[docIndex]:
            errorCount += 1
    print('the error rate is: ',float(errorCount)/len(testSet))
    return vocabList,p0V,p1V
```

### 显示最具有表征性的单词

```python
def getTopWords(ny,sf):
    import operator
    vocabList,p0V,p1V=localWords(ny,sf)
    topNY=[]; topSF=[]
    for i in range(len(p0V)):
        if p0V[i] > -6.5 : topSF.append((vocabList[i],p0V[i]))
        if p1V[i] > -6.5 : topNY.append((vocabList[i],p1V[i]))
    sortedSF = sorted(topSF, key=lambda pair: pair[1], reverse=True)
    print("Lujie***********************************************************************************************************Lujie")
    for item in sortedSF:
        print(item[0])
    sortedNY = sorted(topNY, key=lambda pair: pair[1], reverse=True)
    print("Ora*****************************************************************************************************************Ora")
    for item in sortedNY:
        print(item[0])
```

### 测试

```python
getTopWords(ora,lujie)
```

    the error rate is:  0.55
    Lujie***********************************************************************************************************Lujie
    str
    79367331
    80571612
    79673575
    80232463
    79342737
    79337918
    79339556
    79668822
    blob以及其变形的字段的话
    static
    void
    public
    text以及其变形
    string
    79437288
    如果要查
    可以类比字典
    子类使用extends关键字来继承抽象类
    我们都知道cpu是很快的
    索引的目的在于提高查询效率
    依赖注入
    使用线程池可以进行统一分配
    几乎所有需要异步或者并发执行任务的程序都可以使用线程池
    spring数据访问
    缓冲池的设计是为了协调cpu速度和磁盘速度不一致
    报告情况
    382
    就是说每条记录所占用的字节一样
    与正常java类的区别
    树索引
    icmp全称internet
    数据库需要把新数据刷新到磁盘
    我们肯定需要定位到m字母
    如果无限制的创建
    如果子类不是抽象类的话
    接口不能有构造器
    它需要提供接口中所有声明的方法的实现
    空字符串不处理
    main
    而且如果在将数据刷新到磁盘的过程中发生了宕机
    spring注解
    class
    util包下的treemappublic
    在java中
    那此时的页就是脏页
    106
    即缓冲池中的页的数据比磁盘的新
    提高线程的可管理性
    按长度为8拆分每个字符串后输出到新的字符串数组
    这就相当于古代行军的时候
    若一张表里面存在varchar
    args
    会想到ping一下
    互联网控制报文协议
    抽象类
    当我们遇到网络不通的问题时
    1413
    再找到剩下的sql
    当遇到问题
    线程是稀缺资源
    提高相应速度
    2049
    mysql
    如果是一个页发生变化
    2321
    69道spring面试题和答案
    同时降低系统的稳定性
    protocol
    那么张这个表其实也叫动态表
    如果我想找到m开头的单词呢
    子类使用关键字implements来实现接口
    接口完全是抽象的
    要想提高数据库的访问效率
    当我们执行update操作时
    为了避免数据丢失
    不仅消耗系统资源
    按键排序
    若一张表里面不存在varchar
    什么是spring
    cutstring
    aop
    那么你可能需要把所有单词看一遍才能找到你想要的
    这个开销是非常大的
    其优点读取快
    抽象类可以有构造器
    就把新数据刷回磁盘
    那你知道ping是如何工作的吗
    是不是觉得如果没有索引
    429
    可以说非常大的
    首先是降低资源消耗
    在mysql中
    合理的使用线程池能够带来3个好处
    是个java企业级应用的开源开发框架
    beans
    按键排序jdk内置的java
    当任务到达时
    它根本不存在方法的实现
    ping是基于icmp协议工作的
    632
    原文地址
    在开发过程中
    spring面向切面编程
    默认的方法实现
    然后从下往下找到y字母
    mvc
    如果没有索引
    磁盘是很慢的
    总不能死的不明不白
    message
    key
    即该表的row_format是fixed
    那么张这个表其实也叫静态表
    缺点浪费额外一部分空间
    228
    或者ze开头的单词呢
    这个事情根本无法完成
    那么数据就不能恢复了
    对于页的操作首先都会在缓冲池中进行
    这样才可以调整传输策略
    改变了页中的记录
    这里记录下自己总结的两种比较常用的方式
    事务数据库
    常常会遇到各种各样的问题
    以满足数据一致性
    网络包在异常复杂的网络环境中传输时
    除了你不能实例化抽象类之外
    即该表的row_format是dynamic
    length
    这个单词
    null
    value
    spring主要用来开发j
    任务可以不需要等待线程创建就立即执行
    为将为帅者
    长度不是8整数倍的字符串请在后面补数字0
    control
    1790
    它可以有默认的方法实现
    return
    mapsortdemo
    调优和
    按值排序
    通过重复利用已创建的线程降低创建线程和销毁线程所带来的开销
    构造器
    它需要提供抽象类中所有声明的方法的实现
    要传出消息来
    map排序的方式有很多种
    这是程序设计的要求
    buffer
    什么是tcp粘包问题
    就会改变modcount的值
    本次项目实现主要采用cnn卷积神经网络
    similar
    modcount
    安装时产生的错误
    如果你参考国内的论坛或者教材上
    filter不是滤波
    本项目的实现流程如下所示
    283
    following
    首先我们第一步是导入数据
    connected
    总是会下意识认为这就是个滤波器
    这种存储方式的表称为索引组织表
    649
    在innodb存储引擎中
    oldthr
    either
    step
    80043791
    它的基本原理又是什么
    letters
    本篇博客tensorflow1
    tools
    grid
    time
    刷新邻接页
    times
    intervals
    交通标志的识别
    defined
    second
    output
    cookie
    的区别
    可以使用ifconfig或者ip
    resuirements
    subsequence
    pivot
    constant
    自适应哈希索引
    是有格式的
    frequency
    returns
    基础知识
    oldtab
    your
    102369930
    这是一个文本预处理的python库
    设计思想
    317
    服务端接收的数据会出现两个数据包粘在一起的情况
    那对于ip地址呢
    indexed
    kalman
    本题要求将一个链表进行排序
    trap
    快速失败
    four
    为什么
    将emotion表情替换成文字描述
    117
    如果对命令行比较熟悉的
    can
    same
    smallest
    after
    explanation
    diagonal
    negative
    test
    raining
    any
    page
    一个很好的角度就是
    degree
    80234170
    water
    may
    79446254
    79634980
    matrix
    经过java编译器把java代码编译为存储字节码的class文件
    _blank
    80774772
    every
    计算机科学领域的任何问题都可以通过增加一个间接的中间层来解决
    代码实现及解释
    equal
    hash
    not
    many
    double
    horizontal
    elevation
    eth1
    start
    txt
    insert
    大部分都是一些复杂公式与枯燥抽象的说明
    我这里想要重点声明的是
    next
    which
    341
    接下来我们将按照自己的思路来实现并完善整个project
    addr
    如果在创建时没有显式得定义主键
    79537326
    mapping
    definition
    79342703
    计算机整个体系从上到下都是按照严格的层次结构设计的
    minimum
    请求的
    集合在被遍历期间如果内容发生变化
    原文出处
    comments
    简单来说
    6735
    重载和重写的区别
    去除控制字符
    大到电商系统
    281
    elements
    为什么网络要分层
    digits
    并在rgb及hsv色彩空间可视化部分数据
    into
    那具体是怎么来的呢
    table
    characters
    failed
    containing
    分布式处理
    addr进行配置
    reach
    思考一个问题
    being
    insertion
    java语言是在运行期动态加载的
    pip
    spring是轻量级的
    dev
    有什么区别
    strings
    this
    design
    profit
    exception
    用来找中间结点
    assigned
    每张表都有个主键
    fatal
    80306425
    special
    much
    group
    now
    79437269
    整个项目源码
    mvc框架
    插入缓冲
    need
    虚拟机所处理的正是这些class文件
    necessary
    我们所写的java程序
    width
    360
    安装方法
    基本的版本大小为2mb
    tcp是面向连接的
    在用迭代器遍历一个集合对象时
    将长数字转换成特殊字符
    subarray
    查看评论
    接下来我们就按照项目流程图来逐块实现
    file
    complete
    list
    http
    udp是否存在粘包问题
    should
    common
    its
    bits
    它在那些方面有着应用
    ifconfig
    uses
    348
    我们采用归并排序的方法
    抽象类和接口有什么区别
    并对数据进行校验
    climb
    character
    典型的插入排序
    val
    程序运行时
    unsorted
    say
    2019
    have
    小到单机应用
    textsimilarscore
    1077
    async
    并且把应用业务逻辑和系统服务分开
    several
    表是关于特定实体的数据集合
    their
    once
    如何保证多个机器上的定时任务只有一个机器上的任务被执行
    很多人刚听到这个名词时
    positive
    每当迭代器使用hashnext
    80324425
    maximum
    说说反射的用途及实现
    day
    linked
    如果客户端连续不断的向服务端发送数据包时
    element
    flush
    转换解析和初始化
    我们知道mac地址是在网卡出厂时就确定了
    like
    79607484
    具体的网络结构参考lecun提出的lenet结构
    去除超链接tag
    一次性进行加载的
    algorithm
    bit
    216
    land
    method
    possible
    new
    79553305
    366
    和数据页一样
    而不是创建或查找依赖的对象们
    去除emotion表情
    可以跑在服务器上
    package
    spring支持面向切面的编程
    innodb存储引擎的关键特性innodb存储引擎的关键特性包括
    missing
    79616535
    168
    imp
    get
    paper
    where
    本篇博客从以下四个问题进行分析
    123
    github
    node
    price
    384
    类加载器
    来理解tcp粘包问题
    370
    final
    generated
    我们使用hsv色彩空间来识别交通灯
    313
    space
    想象网络包就是一段buffer
    continuous
    空间复杂度为o
    merge
    were
    complexity
    textsim
    integer
    are
    bottom
    可以采用faster
    scores
    80406743
    该列即为主键
    edges
    是物理页的一个组成部分
    longest
    interval
    79620515
    在这个项目中
    with
    sum
    面向对象的特征
    gcc
    首先判断表中是否存在非空的唯一索引
    threshold
    对象们给出它们的依赖
    fail
    方式的区别
    set
    singly
    quartz是一个开源的作业调度包
    它是一种信息融合的过程
    error
    finally
    able
    vertical
    127
    或者一块内存
    task
    说说自定义注解的场景及实现
    jdbc
    sorted
    resize
    numbers
    227
    79436470
    全角转半角
    representing
    bar
    迭代器在遍历时直接访问集合中的内容
    3852
    left
    top
    assume
    toeplitz
    则会按如下方式选择主键
    import
    jpype
    79612960
    去除http超链接
    这里我们将通过尽量通俗易懂的讲解来给大家解释下什
    351
    36076
    334
    textsimilarscore这是个计算两个短文本相似度的算法
    session
    buy
    79443778
    staircase
    found
    primary
    stock
    include
    对于每一个定时任务job都有一个唯一id
    79439158
    这就是tcp协议中经常会遇到的粘包以
    according
    501
    79636440
    即我们所写的类并不是在程序启动时
    transactions
    compute
    spring通过控制反转实现了松散耦合
    native
    post
    island
    listnode
    log
    对文本进行一些预处理工作
    how
    虚拟机把描述类的数据从class文件加载到内存
    modification
    这也是关系型数据库模型的核心
    79339359
    define
    面向切面的编程aop
    为什么会存在tcp粘包问题
    80569028
    两次写
    328
    add
    spring包含并管理应用中对象的生命周期和配置
    adaptive
    理解计算机网路中的概念
    quartz能够
    过滤括号及括号内的内容
    oldcap
    textprocess
    true
    from
    参考文献
    如果有
    前面我们讲完交通标志的识别
    102369701
    464
    has
    finalize
    异步i
    rcnn或ssd来实现交通灯的识别
    empty
    overlapping
    first
    控制反转
    80564649
    warning
    quartz的分布式解决方案
    steps
    write
    585
    newthr
    而是在实际使用到时才进行动态加载
    79436370
    最终形成可以被虚拟机直接使用的java类型
    nbsp
    如果遍历过程中对集合对象的内容进行了修改
    increas
    cost
    input
    当发现改job处于运行状态时
    现在我们开始尝试来实现交通信号灯的识别
    11643
    你一定会发现
    spring框架的作用
    本次博客将分享udacity无人驾驶纳米学位的另一个项目
    each
    target
    newcap
    对于一个部署在多台机器上的应用
    主要是在做自然语言处理任务时
    fast
    192
    run
    并且在遍历过程中使用一个
    可以改善及提高的地方
    能够运行在几乎任何java项目中
    96997204
    我们先来看看如何配置ip地址
    80043698
    quartz介绍
    represented
    方法直接看代码
    支持的功能
    lecun
    all
    neighbor
    4171
    那么kalman
    increasing
    right
    79436449
    unique
    如何解决tcp粘包问题
    网络分层
    文本相似度计算
    pay
    然后实现一个getmid函数
    首先我们实现一个merge函数
    ip地址的分类和配置都是人为设定的
    using
    79615009
    即客户端和服务端要成对维护socket连接
    filter
    command
    英文字母大写转小写
    416
    中文简体转繁体
    最后用递归实现
    朱小厮
    nums
    中文繁体转简体
    项目流程图
    80556000
    因为复杂的程序都要分层
    directionally
    而且这个程序可以跑在电脑上
    encoded
    github地址
    dete
    使用方法
    only
    376
    initially
    install
    其他机器都不会去调度这个job
    ith
    索引组织表
    470
    想象自己是一个处理网络包的程序
    one
    filter到底是什么
    表都是根据主键顺序组织存放的
    that
    在innodb存储引擎表中
    则会抛出concurrent
    some
    Ora*****************************************************************************************************************Ora
    matrix
    error
    nbsp
    represented
    80556000
    pivot
    kalman
    can
    negative
    79446254
    79634980
    pip
    this
    80306425
    now
    character
    2019
    have
    textsimilarscore
    maximum
    element
    79553305
    79616535
    where
    left
    toeplitz
    79612960
    include
    compute
    102369701
    79436370
    96997204
    79615009
    nums
    install
    one
    本次项目实现主要采用cnn卷积神经网络
    similar
    安装时产生的错误
    如果你参考国内的论坛或者教材上
    filter不是滤波
    本项目的实现流程如下所示
    总是会下意识认为这就是个滤波器
    它的基本原理又是什么
    本篇博客tensorflow1
    tools
    time
    交通标志的识别
    defined
    second
    resuirements
    constant
    frequency
    returns
    your
    本题要求将一个链表进行排序
    trap
    same
    smallest
    after
    diagonal
    test
    raining
    any
    degree
    water
    may
    _blank
    every
    代码实现及解释
    equal
    not
    many
    elevation
    txt
    大部分都是一些复杂公式与枯燥抽象的说明
    我这里想要重点声明的是
    which
    definition
    comments
    elements
    characters
    failed
    strings
    design
    profit
    用来找中间结点
    fatal
    special
    much
    整个项目源码
    width
    安装方法
    查看评论
    接下来我们就按照项目流程图来逐块实现
    file
    complete
    list
    common
    its
    bits
    它在那些方面有着应用
    我们采用归并排序的方法
    say
    1077
    several
    很多人刚听到这个名词时
    day
    linked
    like
    具体的网络结构参考lecun提出的lenet结构
    algorithm
    bit
    method
    possible
    366
    imp
    paper
    github
    price
    384
    generated
    313
    space
    空间复杂度为o
    complexity
    textsim
    bottom
    scores
    with
    sum
    gcc
    它是一种信息融合的过程
    able
    task
    numbers
    representing
    bar
    3852
    top
    import
    jpype
    这里我们将通过尽量通俗易懂的讲解来给大家解释下什
    351
    36076
    334
    textsimilarscore这是个计算两个短文本相似度的算法
    buy
    found
    stock
    transactions
    native
    log
    how
    define
    328
    true
    from
    参考文献
    has
    empty
    first
    warning
    write
    你一定会发现
    本次博客将分享udacity无人驾驶纳米学位的另一个项目
    each
    target
    length
    lecun
    那么kalman
    right
    string
    文本相似度计算
    然后实现一个getmid函数
    首先我们实现一个merge函数
    using
    filter
    command
    最后用递归实现
    return
    项目流程图
    使用方法
    only
    376
    ith
    470
    filter到底是什么
    that
    这是程序设计的要求
    buffer
    如果要查
    什么是tcp粘包问题
    可以类比字典
    就会改变modcount的值
    modcount
    283
    following
    首先我们第一步是导入数据
    connected
    这种存储方式的表称为索引组织表
    649
    在innodb存储引擎中
    子类使用extends关键字来继承抽象类
    oldthr
    either
    step
    80043791
    我们都知道cpu是很快的
    letters
    索引的目的在于提高查询效率
    依赖注入
    使用线程池可以进行统一分配
    几乎所有需要异步或者并发执行任务的程序都可以使用线程池
    grid
    刷新邻接页
    times
    intervals
    spring数据访问
    缓冲池的设计是为了协调cpu速度和磁盘速度不一致
    报告情况
    output
    382
    cookie
    的区别
    可以使用ifconfig或者ip
    subsequence
    自适应哈希索引
    是有格式的
    基础知识
    oldtab
    102369930
    这是一个文本预处理的python库
    设计思想
    就是说每条记录所占用的字节一样
    317
    服务端接收的数据会出现两个数据包粘在一起的情况
    那对于ip地址呢
    indexed
    与正常java类的区别
    树索引
    快速失败
    icmp全称internet
    four
    为什么
    将emotion表情替换成文字描述
    117
    如果对命令行比较熟悉的
    数据库需要把新数据刷新到磁盘
    explanation
    我们肯定需要定位到m字母
    如果无限制的创建
    page
    一个很好的角度就是
    80234170
    如果子类不是抽象类的话
    接口不能有构造器
    它需要提供接口中所有声明的方法的实现
    经过java编译器把java代码编译为存储字节码的class文件
    空字符串不处理
    80774772
    main
    计算机科学领域的任何问题都可以通过增加一个间接的中间层来解决
    hash
    double
    horizontal
    79367331
    80571612
    79673575
    eth1
    start
    而且如果在将数据刷新到磁盘的过程中发生了宕机
    insert
    spring注解
    80232463
    next
    341
    接下来我们将按照自己的思路来实现并完善整个project
    addr
    如果在创建时没有显式得定义主键
    79537326
    mapping
    79342703
    计算机整个体系从上到下都是按照严格的层次结构设计的
    minimum
    请求的
    集合在被遍历期间如果内容发生变化
    原文出处
    简单来说
    class
    6735
    重载和重写的区别
    79342737
    去除控制字符
    大到电商系统
    281
    util包下的treemappublic
    为什么网络要分层
    digits
    在java中
    并在rgb及hsv色彩空间可视化部分数据
    into
    那具体是怎么来的呢
    那此时的页就是脏页
    table
    106
    即缓冲池中的页的数据比磁盘的新
    containing
    79337918
    提高线程的可管理性
    按长度为8拆分每个字符串后输出到新的字符串数组
    分布式处理
    这就相当于古代行军的时候
    若一张表里面存在varchar
    addr进行配置
    args
    reach
    思考一个问题
    being
    insertion
    会想到ping一下
    互联网控制报文协议
    抽象类
    java语言是在运行期动态加载的
    spring是轻量级的
    dev
    有什么区别
    当我们遇到网络不通的问题时
    1413
    再找到剩下的sql
    exception
    当遇到问题
    assigned
    线程是稀缺资源
    每张表都有个主键
    提高相应速度
    group
    79437269
    mvc框架
    插入缓冲
    need
    虚拟机所处理的正是这些class文件
    2049
    necessary
    79339556
    mysql
    我们所写的java程序
    如果是一个页发生变化
    360
    2321
    基本的版本大小为2mb
    69道spring面试题和答案
    tcp是面向连接的
    同时降低系统的稳定性
    在用迭代器遍历一个集合对象时
    protocol
    将长数字转换成特殊字符
    subarray
    那么张这个表其实也叫动态表
    http
    udp是否存在粘包问题
    如果我想找到m开头的单词呢
    should
    ifconfig
    uses
    348
    抽象类和接口有什么区别
    并对数据进行校验
    climb
    子类使用关键字implements来实现接口
    接口完全是抽象的
    典型的插入排序
    val
    程序运行时
    unsorted
    要想提高数据库的访问效率
    小到单机应用
    当我们执行update操作时
    async
    为了避免数据丢失
    并且把应用业务逻辑和系统服务分开
    不仅消耗系统资源
    表是关于特定实体的数据集合
    their
    once
    如何保证多个机器上的定时任务只有一个机器上的任务被执行
    positive
    每当迭代器使用hashnext
    80324425
    按键排序
    说说反射的用途及实现
    如果客户端连续不断的向服务端发送数据包时
    若一张表里面不存在varchar
    flush
    转换解析和初始化
    我们知道mac地址是在网卡出厂时就确定了
    什么是spring
    79607484
    去除超链接tag
    一次性进行加载的
    cutstring
    aop
    那么你可能需要把所有单词看一遍才能找到你想要的
    216
    land
    这个开销是非常大的
    new
    和数据页一样
    而不是创建或查找依赖的对象们
    其优点读取快
    去除emotion表情
    可以跑在服务器上
    package
    spring支持面向切面的编程
    innodb存储引擎的关键特性innodb存储引擎的关键特性包括
    missing
    抽象类可以有构造器
    168
    get
    本篇博客从以下四个问题进行分析
    就把新数据刷回磁盘
    123
    node
    类加载器
    来理解tcp粘包问题
    那你知道ping是如何工作的吗
    是不是觉得如果没有索引
    370
    429
    可以说非常大的
    final
    首先是降低资源消耗
    我们使用hsv色彩空间来识别交通灯
    想象网络包就是一段buffer
    continuous
    merge
    在mysql中
    were
    合理的使用线程池能够带来3个好处
    是个java企业级应用的开源开发框架
    integer
    are
    beans
    可以采用faster
    80406743
    该列即为主键
    edges
    是物理页的一个组成部分
    longest
    interval
    79620515
    在这个项目中
    面向对象的特征
    首先判断表中是否存在非空的唯一索引
    threshold
    对象们给出它们的依赖
    按键排序jdk内置的java
    fail
    当任务到达时
    方式的区别
    set
    singly
    quartz是一个开源的作业调度包
    它根本不存在方法的实现
    finally
    vertical
    127
    或者一块内存
    79668822
    ping是基于icmp协议工作的
    说说自定义注解的场景及实现
    jdbc
    sorted
    resize
    632
    原文地址
    227
    blob以及其变形的字段的话
    79436470
    全角转半角
    在开发过程中
    迭代器在遍历时直接访问集合中的内容
    spring面向切面编程
    默认的方法实现
    assume
    则会按如下方式选择主键
    然后从下往下找到y字母
    去除http超链接
    mvc
    session
    79443778
    staircase
    primary
    如果没有索引
    对于每一个定时任务job都有一个唯一id
    79439158
    这就是tcp协议中经常会遇到的粘包以
    according
    501
    79636440
    即我们所写的类并不是在程序启动时
    spring通过控制反转实现了松散耦合
    磁盘是很慢的
    总不能死的不明不白
    post
    island
    message
    listnode
    key
    static
    void
    对文本进行一些预处理工作
    虚拟机把描述类的数据从class文件加载到内存
    即该表的row_format是fixed
    modification
    那么张这个表其实也叫静态表
    缺点浪费额外一部分空间
    public
    这也是关系型数据库模型的核心
    79339359
    228
    或者ze开头的单词呢
    面向切面的编程aop
    为什么会存在tcp粘包问题
    80569028
    这个事情根本无法完成
    那么数据就不能恢复了
    两次写
    add
    spring包含并管理应用中对象的生命周期和配置
    adaptive
    理解计算机网路中的概念
    quartz能够
    过滤括号及括号内的内容
    oldcap
    textprocess
    text以及其变形
    对于页的操作首先都会在缓冲池中进行
    这样才可以调整传输策略
    如果有
    改变了页中的记录
    前面我们讲完交通标志的识别
    464
    finalize
    异步i
    这里记录下自己总结的两种比较常用的方式
    rcnn或ssd来实现交通灯的识别
    事务数据库
    overlapping
    控制反转
    常常会遇到各种各样的问题
    80564649
    quartz的分布式解决方案
    steps
    585
    以满足数据一致性
    newthr
    网络包在异常复杂的网络环境中传输时
    而是在实际使用到时才进行动态加载
    最终形成可以被虚拟机直接使用的java类型
    如果遍历过程中对集合对象的内容进行了修改
    increas
    cost
    除了你不能实例化抽象类之外
    input
    当发现改job处于运行状态时
    现在我们开始尝试来实现交通信号灯的识别
    即该表的row_format是dynamic
    11643
    spring框架的作用
    newcap
    对于一个部署在多台机器上的应用
    主要是在做自然语言处理任务时
    fast
    192
    run
    并且在遍历过程中使用一个
    可以改善及提高的地方
    能够运行在几乎任何java项目中
    我们先来看看如何配置ip地址
    这个单词
    80043698
    quartz介绍
    方法直接看代码
    null
    value
    支持的功能
    spring主要用来开发j
    all
    neighbor
    4171
    increasing
    79436449
    unique
    任务可以不需要等待线程创建就立即执行
    如何解决tcp粘包问题
    网络分层
    为将为帅者
    长度不是8整数倍的字符串请在后面补数字0
    pay
    ip地址的分类和配置都是人为设定的
    control
    即客户端和服务端要成对维护socket连接
    英文字母大写转小写
    416
    中文简体转繁体
    1790
    朱小厮
    它可以有默认的方法实现
    中文繁体转简体
    因为复杂的程序都要分层
    directionally
    而且这个程序可以跑在电脑上
    encoded
    mapsortdemo
    github地址
    79437288
    dete
    调优和
    initially
    按值排序
    其他机器都不会去调度这个job
    索引组织表
    想象自己是一个处理网络包的程序
    通过重复利用已创建的线程降低创建线程和销毁线程所带来的开销
    构造器
    它需要提供抽象类中所有声明的方法的实现
    要传出消息来
    str
    表都是根据主键顺序组织存放的
    map排序的方式有很多种
    在innodb存储引擎表中
    则会抛出concurrent
    some

# sklearn使用

参考了一个比较全面的sklearn朴素贝叶斯博文：

[使用sklearn学习朴素贝叶斯](https://blog.csdn.net/qq_38163244/article/details/109154089)

https://zhuanlan.zhihu.com/p/30745924

正常的输出本应该长这样，但是不知道为什么下载并不会开始，而且国内下载相当慢！！！
```
Downloading 20news dataset. This may take a few minutes.
Downloading dataset from https://ndownloader.figshare.com/files/5975967 (14 MB)
18846
From: Mamatha Devineni Ratnam <mr47+@andrew.cmu.edu>
Subject: Pens fans reactions
Organization: Post Office, Carnegie Mellon, Pittsburgh, PA
Lines: 12
NNTP-Posting-Host: po4.andrew.cmu.edu

I am sure some bashers of Pens fans are pretty confused about the lack
of any kind of posts about the recent Pens massacre of the Devils. Actually,
I am  bit puzzled too and a bit relieved. However, I am going to put an end
to non-PIttsburghers' relief with a bit of praise for the Pens. Man, they
are killing those Devils worse than I thought. Jagr just showed you why
he is much better than his regular season stats. He is also a lot
fo fun to watch in the playoffs. Bowman should let JAgr have a lot of
fun in the next couple of games since the Pens are going to beat the pulp out of Jersey anyway. I was very disappointed not to see the Islanders lose the final
regular season game.          PENS RULE!!!
```
建议notebook翻过GFW，或者直接自己翻GFW用colab。

```python
from sklearn.datasets import fetch_20newsgroups
#与之前预存的数据不同,fetch_20newsgroups
#与之前预存的数据不同,fetch_20newsgroups需要即时从互联网下载数据
news=fetch_20newsgroups(subset='all')
#查验数据规模和细节
print (len(news.data))
print (news.data[0])
```

    Downloading 20news dataset. This may take a few minutes.
    Downloading dataset from https://ndownloader.figshare.com/files/5975967 (14 MB)

    18846
    From: Mamatha Devineni Ratnam <mr47+@andrew.cmu.edu>
    Subject: Pens fans reactions
    Organization: Post Office, Carnegie Mellon, Pittsburgh, PA
    Lines: 12
    NNTP-Posting-Host: po4.andrew.cmu.edu

    I am sure some bashers of Pens fans are pretty confused about the lack
    of any kind of posts about the recent Pens massacre of the Devils. Actually,
    I am  bit puzzled too and a bit relieved. However, I am going to put an end
    to non-PIttsburghers' relief with a bit of praise for the Pens. Man, they
    are killing those Devils worse than I thought. Jagr just showed you why
    he is much better than his regular season stats. He is also a lot
    fo fun to watch in the playoffs. Bowman should let JAgr have a lot of
    fun in the next couple of games since the Pens are going to beat the pulp out of Jersey anyway. I was very disappointed not to see the Islanders lose the final
    regular season game.          PENS RULE!!!

该数据共有18846条新闻；不同于前面的样例数据，这些文本数据既没有被设定特征，也没有数字化的量度。因此，在交给朴素贝叶斯分类器学习之前要对数据做进一步的处理。不过在此之前，我们仍然需要如以下代码所示，对数据进行分割并且随机采样出一部分用于测试。

```python
#20类新闻文本数据分割
from sklearn.model_selection import train_test_split
#随机采样25%的数据样本作为测试集
X_train,X_test,y_train,y_test=train_test_split(news.data,news.target,test_size=0.25,random_state=33)
```

```python
#使用朴素贝叶斯分类器对新闻文本数据进行类别预测
#从sklearn.feature_extraction.text里导入用于文本特征向量转化模块。
from sklearn.feature_extraction.text import CountVectorizer
vec=CountVectorizer()
X_train=vec.fit_transform(X_train)
X_test=vec.transform(X_test)

#sklearn.naive_bayes里导入朴素贝叶斯模型
from sklearn.naive_bayes import MultinomialNB
#使用默认配置初始化朴素贝叶斯模型
mnb=MultinomialNB()
#利用训练数据对模型参数进行估计
mnb.fit(X_train,y_train)
#对测试样本进行类别预测，结果存储在变量y_predict中
y_predict=mnb.predict(X_test)
```

```python
#对朴素贝叶斯分类器在新闻文本数据上的表现性能进行评估
#从sklearn.metrics里导入classification_report用于详细的分类性能报告
from sklearn.metrics import classification_report
print ('The accuracy of Naive Bayes Classifier is',mnb.score(X_test,y_test))
print(classification_report(y_test,y_predict))
```

    The accuracy of Naive Bayes Classifier is 0.8397707979626485
                  precision    recall  f1-score   support

               0       0.86      0.86      0.86       201
               1       0.59      0.86      0.70       250
               2       0.89      0.10      0.17       248
               3       0.60      0.88      0.72       240
               4       0.93      0.78      0.85       242
               5       0.82      0.84      0.83       263
               6       0.91      0.70      0.79       257
               7       0.89      0.89      0.89       238
               8       0.98      0.92      0.95       276
               9       0.98      0.91      0.95       251
              10       0.93      0.99      0.96       233
              11       0.86      0.98      0.91       238
              12       0.85      0.88      0.86       249
              13       0.92      0.94      0.93       245
              14       0.89      0.96      0.92       221
              15       0.78      0.96      0.86       232
              16       0.88      0.96      0.92       251
              17       0.90      0.98      0.94       231
              18       0.79      0.89      0.84       188
              19       0.93      0.44      0.60       158

        accuracy                           0.84      4712
       macro avg       0.86      0.84      0.82      4712
    weighted avg       0.86      0.84      0.82      4712

# 作业1：使用朴素贝叶斯预测电脑销售

**解** 使用朴素贝叶斯，假设表中列出的所有属性相互独立。

`age`,`income`,`student`,`credit`均为离散型特征，所以可以使用计数计算概率值。

`age`取值：<30, 30-40, >40；`income`取值：low, medium, high；`student`取值：yes, no；`credit`取值：fair, excellent.
$$
\begin{align}
P(Yes) = \dfrac{9}{14} \ \
&P(No) = \dfrac{5}{14} \\
P(age \lt 30 | Yes) = \dfrac{2}{9} \ \
&P(age \lt 30 | No) = \dfrac{3}{5} \\
P(30 \le age \le 40 | Yes) = \dfrac{4}{9}\ \
&P(30 \le age \le 40 | No) = 0 \\
P(age \gt 40 | Yes) = \dfrac{3}{9} \ \
&P(age \gt 40 | No) = \dfrac{2}{5} \\
P(income=low|Yes) = \dfrac{3}{9} \ \
&P(income=low|No) = \dfrac{1}{5} \\
P(income=medium|Yes)= \dfrac{4}{9}\ \
&P(income=medium|No) = \dfrac{2}{5}\\
P(income=high|Yes) = \dfrac{2}{9}\ \
&P(income=high|No) = \dfrac{2}{5}\\
P(student=no|Yes) = \dfrac{3}{9} \ \
&P(student=no|No) = \dfrac{4}{5} \\
P(student=yes|Yes) = \dfrac{6}{9} \ \
&P(student=yes|No) = \dfrac{1}{5} \\
P(credit=fair|Yes) = \dfrac{6}{9}\ \
&P(credit=fair|No) = \dfrac{2}{5}\\
P(credit=excellent|Yes) = \dfrac{3}{9}\ \
&P(credit=excellent|No) = \dfrac{3}{5}\\
\end{align}
$$

根据观察，存在样本不充分的现象，即有某一些项的概率为0，这样在进行预测时可能得出某些样本概率为0。

处理的方法是采用==拉普拉斯平滑==
$$
\hat{P}(c)=\dfrac{|D_c|+1}{|D|+N} \\
$$
其中$N$为可取类别数。
$$
\begin{align}
\hat{P}(Yes) = \dfrac{9+1}{14+2} =\dfrac{5}{8} \ \
&\hat{P}(No) = \dfrac{5+1}{14+2} =\dfrac{3}{8}\\
\hat{P}(age \lt 30 | Yes) = \dfrac{2+1}{9+3} =\dfrac{1}{4}\ \
&\hat{P}(age \lt 30 | No) = \dfrac{3+1}{5+3} =\dfrac{1}{2}\\
\hat{P}(30 \le age \le 40 | Yes) = \dfrac{4+1}{9+3}=\dfrac{5}{12}\ \
&\hat{P}(30 \le age \le 40 | No) = \dfrac{0+1}{5+3} =\dfrac{1}{8}\\
\hat{P}(age \gt 40 | Yes) = \dfrac{3+1}{9+3} =\dfrac{1}{3}\ \
&\hat{P}(age \gt 40 | No) = \dfrac{2+1}{5+3} =\dfrac{3}{8}\\
\hat{P}(income=low|Yes) = \dfrac{3+1}{9+3} =\dfrac{1}{3}\ \
&\hat{P}(income=low|No) = \dfrac{1+1}{5+3} =\dfrac{1}{4}\\
\end{align}
$$

$$
\begin{align}
\hat{P}(income=medium|Yes) = \dfrac{4+1}{9+3}=\dfrac{5}{12}\ \
&\hat{P}(income=medium|No) = \dfrac{2+1}{5+3}=\dfrac{3}{8}\\
\hat{P}(income=high|Yes) = \dfrac{2+1}{9+3}=\dfrac{1}{4}\ \
&\hat{P}(income=high|No) = \dfrac{2+1}{5+3}=\dfrac{3}{8}\\
\hat{P}(student=no|Yes) = \dfrac{3+1}{9+2}=\dfrac{4}{11} \ \
&\hat{P}(student=no|No) = \dfrac{4+1}{5+2} =\dfrac{5}{7}\\
\hat{P}(student=yes|Yes) = \dfrac{6+1}{9+2}=\dfrac{7}{11} \ \
&\hat{P}(student=yes|No) = \dfrac{1+1}{5+2}=\dfrac{2}{7} \\
\hat{P}(credit=fair|Yes) = \dfrac{6+1}{9+2}=\dfrac{7}{11}\ \
&\hat{P}(credit=fair|No) = \dfrac{2+1}{5+2}=\dfrac{3}{7}\\
\hat{P}(credit=excellent|Yes) = \dfrac{3+1}{9+2}=\dfrac{4}{11}\ \
&\hat{P}(credit=excellent|No) = \dfrac{3+1}{5+2}=\dfrac{4}{7}\\
\end{align}
$$

可以将上述概率依次累乘，得到每一类样本是否为电脑购买者的概率：
$$
P(\boldsymbol{X}|c_i) = \prod\limits_{x_i\in X}P(x_i|c_i).\\
(\boldsymbol{X}=\{\text{Age, Income,isStudent,Credit.}\}, \ c_i \in \{\text{Yes,No}\})
$$

| Age   | $P(Age|Yes)$ | $p(Age|No)$ | Income | $P(Income|Yes)$ | $P(Income|No)$ | isStudent | $P(isStudent|Yes)$ | $P(isStudent|No)$ | Credit    | $P(Credit|Yes)$ | $P(Credit|No)$ | $P(Yes)$ | $P(No)$ | $P(\boldsymbol{x}\in X|Yes)$ | $P(\boldsymbol{x}\in X|No)$ | Result |
| ----- | ------------ | ----------- | ------ | --------------- | -------------- | --------- | ------------------ | ----------------- | --------- | --------------- | -------------- | -------- | ------- | ---------------------------- | --------------------------- | ------ |
| <30   | 1/4          | 1/2         | low    | 1/3             | 1/4            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.1092E-02                   | 5.7398E-03                  | yes    |
| <30   | 1/4          | 1/2         | low    | 1/3             | 1/4            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.2052E-02                   | 7.6531E-03                  | yes    |
| <30   | 1/4          | 1/2         | low    | 1/3             | 1/4            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 1.2052E-02                   | 1.4349E-02                  | no     |
| <30   | 1/4          | 1/2         | low    | 1/3             | 1/4            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 6.8871E-03                   | 1.9133E-02                  | no     |
| <30   | 1/4          | 1/2         | medium | 5/12            | 3/8            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.6364E-02                   | 8.6097E-03                  | yes    |
| <30   | 1/4          | 1/2         | medium | 5/12            | 3/8            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.5065E-02                   | 1.1480E-02                  | yes    |
| <30   | 1/4          | 1/2         | medium | 5/12            | 3/8            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 1.5065E-02                   | 2.1524E-02                  | no     |
| <30   | 1/4          | 1/2         | medium | 5/12            | 3/8            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 8.6088E-03                   | 2.8699E-02                  | no     |
| <30   | 1/4          | 1/2         | high   | 1/4             | 3/8            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 1.5819E-02                   | 8.6097E-03                  | yes    |
| <30   | 1/4          | 1/2         | high   | 1/4             | 3/8            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 9.0393E-03                   | 1.1480E-02                  | no     |
| <30   | 1/4          | 1/2         | high   | 1/4             | 3/8            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 9.0393E-03                   | 2.1524E-02                  | no     |
| <30   | 1/4          | 1/2         | high   | 1/4             | 3/8            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 5.1653E-03                   | 2.8699E-02                  | no     |
| 30~40 | 5/12         | 1/8         | low    | 1/3             | 1/4            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 3.5153E-02                   | 1.4349E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | low    | 1/3             | 1/4            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 2.0087E-02                   | 1.9133E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | low    | 1/3             | 1/4            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.0087E-02                   | 3.5874E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | low    | 1/3             | 1/4            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.1478E-02                   | 4.7832E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | medium | 5/12            | 3/8            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 4.3941E-02                   | 2.1524E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | medium | 5/12            | 3/8            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 2.5109E-02                   | 2.8699E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | medium | 5/12            | 3/8            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.5109E-02                   | 5.3811E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | medium | 5/12            | 3/8            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.4348E-02                   | 7.1747E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | high   | 1/4             | 3/8            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.6364E-02                   | 2.1524E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | high   | 1/4             | 3/8            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.5065E-02                   | 2.8699E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | high   | 1/4             | 3/8            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 1.5065E-02                   | 5.3811E-03                  | yes    |
| 30~40 | 5/12         | 1/8         | high   | 1/4             | 3/8            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 8.6088E-03                   | 7.1747E-03                  | yes    |
| >40   | 1/3          | 3/8         | low    | 1/3             | 1/4            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.8122E-02                   | 4.3048E-03                  | yes    |
| >40   | 1/3          | 3/8         | low    | 1/3             | 1/4            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.6070E-02                   | 5.7398E-03                  | yes    |
| >40   | 1/3          | 3/8         | low    | 1/3             | 1/4            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 1.6070E-02                   | 1.0762E-02                  | yes    |
| >40   | 1/3          | 3/8         | low    | 1/3             | 1/4            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 9.1827E-03                   | 1.4349E-02                  | no     |
| >40   | 1/3          | 3/8         | medium | 5/12            | 3/8            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 3.5153E-02                   | 6.4573E-03                  | yes    |
| >40   | 1/3          | 3/8         | medium | 5/12            | 3/8            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 2.0087E-02                   | 8.6097E-03                  | yes    |
| >40   | 1/3          | 3/8         | medium | 5/12            | 3/8            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.0087E-02                   | 1.6143E-02                  | yes    |
| >40   | 1/3          | 3/8         | medium | 5/12            | 3/8            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.1478E-02                   | 2.1524E-02                  | no     |
| >40   | 1/3          | 3/8         | high   | 1/4             | 3/8            | yes       | 7/11               | 2/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 2.1092E-02                   | 6.4573E-03                  | yes    |
| >40   | 1/3          | 3/8         | high   | 1/4             | 3/8            | yes       | 7/11               | 2/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 1.2052E-02                   | 8.6097E-03                  | yes    |
| >40   | 1/3          | 3/8         | high   | 1/4             | 3/8            | no        | 4/11               | 5/7               | fair      | 7/11            | 3/7            | 5/8      | 3/8     | 1.2052E-02                   | 1.6143E-02                  | no     |
| >40   | 1/3          | 3/8         | high   | 1/4             | 3/8            | no        | 4/11               | 5/7               | excellent | 4/11            | 4/7            | 5/8      | 3/8     | 6.8871E-03                   | 2.1524E-02                  | no     |

对于给定属性值，可根据上表确定其`Buyer`=Yes和`Buyer`=No的概率，比较大小可得其是否为电脑购买者的分类。**例如**

$$
样本X=\{\text{Age}\lt 30,\text{Income}:low,\text{isStudent}:Yes,\text{Credit}:fair\}\\
\begin{align}
P(\text{Age}\lt30, \text{Income}:low, \text{isStudent}:Yes, \text{Credit}:fair|Yes) &= P(\text{Age}\lt 30|Yes)P(\text{Income:low}|Yes)P(\text{isStudent}:Yes)P(\text{Credit}:fair|Yes)P(Yes) \\
&= \dfrac{1}{4} \times\dfrac{1}{3} \times\dfrac{7}{11} \times\dfrac{7}{11} \times\dfrac{5}{8} \\
&\approx 2.1092\times10^{-2}\\
P(\text{Age}\lt30, \text{Income}:low, \text{isStudent}:Yes, \text{Credit}:fair|No) &= P(\text{Age}\lt 30|No)P(\text{Income:low}|No)P(\text{isStudent}:No)P(\text{Credit}:fair|No)P(No) \\
&= \dfrac{1}{2} \times\dfrac{1}{4} \times\dfrac{2}{7} \times\dfrac{3}{7} \times\dfrac{3}{8} \\
&\approx 5.7398\times10^{-3} \lt P(\text{Age}\lt30, \text{Income}:low, \text{isStudent}:Yes, \text{Credit}:fair|Yes)\\
\end{align}
$$
故预测样本X为**yes**

```python

```