First, thanks very much for your kind help. 1)Further more, I test the function of insert. It did work as follows:
>>> text = ['The', 'Fulton', 'County', 'Grand'] >>> text.insert(3,'like') >>> text ['The', 'Fulton', 'County', 'like', 'Grand'] >>> 2) I tested the text from nltk. It is list actually. See the following: >>> text = nltk.corpus.brown.words(categories = 'news') >>> text[:10] ['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', 'Friday', 'an', 'investigation', 'of'] How come python tells me that it is not a list by prompting "AttributeError: 'ConcatenatedCorpusView' object has no attribute 'insert'"? I am confused. Since we doubt text is not a list, I have to add one more line of code there as follows. Then it seems working. >>> text = nltk.corpus.brown.words(categories = 'news') >>> def hedge(text): text = list(text) for i in range(3,len(text),4): text.insert(i, 'like') return text[:50] >>> hedge(text) ['The', 'Fulton', 'County', 'like', 'Grand', 'Jury', 'said', 'like', 'Friday', 'an', 'investigation', 'like', 'of', "Atlanta's", 'recent', 'like', 'primary', 'election', 'produced', 'like', '``', 'no', 'evidence', 'like', "''", 'that', 'any', 'like', 'irregularities', 'took', 'place', 'like', '.', 'The', 'jury', 'like', 'further', 'said', 'in', 'like', 'term-end', 'presentments', 'that', 'like', 'the', 'City', 'Executive', 'like', 'Committee', ','] Isn't it odd?
-- http://mail.python.org/mailman/listinfo/python-list