annotate lazyBug.py @ 11:1b9daa849b0f
A bit further: red col working, finding middle of row 1, formatting off, outer loop in place, but fails overall after 3rd pass achieves nothing
author |
Henry S. Thompson <ht@inf.ed.ac.uk> |
date |
Sun, 15 Mar 2020 17:05:49 +0000 |
parents |
bd1db1ed4c25 |
children |
|
rev |
line source |
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))
|