5
|
1 '''Illustrate problem with writable cache in LazySubsequence'''
|
|
2
|
|
3 from nltk.corpus import brown
|
|
4 import nltk, sys
|
|
5
|
|
6 data = brown.tagged_sents(categories='news', tagset='universal')
|
|
7 train_data=data[:1000]
|
|
8 y=train_data[0]
|
|
9 print('initial:',y==train_data[0],train_data[0][:2])
|
|
10 train_data[0].insert(0,('<s>','<s>'))
|
|
11 print('modified:',y==train_data[0],train_data[0][:2])
|
|
12 z=len([s for s in train_data])
|
|
13 print('post-view:',y==train_data[0],train_data[0][:2])
|
|
14
|
|
15 print("\nnltk: %s\npython: %s"%(nltk.version_info,sys.version))
|