<pre><code>output = [('the', 'B', 'NNP'), ('wall', 'I', 'NNP'), ('street', 'I', 'NNP'), ('journal', 'I', 'NNP'), ('reported', 'O', 'VB'), ('today', 'O', 'NNP'), ('that', 'O', 'NNP'), ('apple', 'B', 'NNP'), ('corporation', 'I', 'NNP'), ('made', 'O', 'VB'), ('money', 'O', 'NNP'), ('.', 'O', '.'), ('georgia', 'B', 'NNP'), ('tech', 'I', 'NNP'), ('is', 'O', 'NNP'), ('a', 'O', '.'), ('university', 'O', 'NNP'), ('in', 'O', 'NNP'), ('georgia', 'B', 'NNP'),('.', 'O', '.')]
result, words, tokens = [], [], []
for word, token, _ in output: # this is tuple like ('the', 'B', 'NNP')
if word == '.': # end of sentence, save current and start new one
result.append((words, tokens))
words, tokens = [], []
else: # add new word to current sentence
words.append(word)
tokens.append(token)
print(result)
</code></pre>
<p>输出:</p>
<blockquote>
<p>[(['the', 'wall', 'street', 'journal', 'reported', 'today', 'that', 'apple', 'corporation', 'made', 'money'], ['B', 'I', 'I', 'I', 'O', 'O', 'O', 'B', 'I', 'O', 'O']), (['georgia', 'tech', 'is', 'a', 'university', 'in', 'georgia'], ['B', 'I', 'O', 'O', 'O', 'O', 'B'])]</p>
</blockquote>