<DIV id=RTEContent><BR>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <DIV>hello all</DIV>  <DIV>when i run the code :</DIV>  <DIV># -*- coding: cp1256 -*-<BR>from nltk.tagger import *<BR>from nltk.corpus import brown<BR>from nltk.tokenizer import WhitespaceTokenizer</DIV>  <DIV># Tokenize ten texts from the Brown Corpus<BR>train_tokens = []<BR>xx=Token(TEXT=open('fataha2.txt').read())<BR>WhitespaceTokenizer().tokenize(xx)<BR>for l in xx:<BR>&nbsp;&nbsp;&nbsp; train_tokens.append(l)<BR>#Initialise and train a unigram tagger<BR>mytagger = UnigramTagger(SUBTOKENS='WORDS')<BR>for tok in train_tokens: mytagger.train(tok)<BR>#Once a UnigramTagger has been trained, the tag() method can be used to tag new text: <BR>text_token = Token(TEXT="الحمد لله رب العالمين")<BR>WhitespaceTokenizer(SUBTOKENS='WORDS').tokenize(text_token)<BR>mytagger.tag(text_token)<BR>print 'The first example : Using Unigram Tagger the reseults are : '<BR>print
 <BR>acc = tagger_accuracy(mytagger, train_tokens)<BR>print ' With Accuracy :Accuracy = %4.1f%%,' % (100 * acc) </DIV>  <DIV>&nbsp;</DIV>  <DIV>i got the following error :</DIV>  <DIV>Traceback (most recent call last):<BR>&nbsp; File "F:\MSC first Chapters\unigramgtag1.py", line 14, in -toplevel-<BR>&nbsp;&nbsp;&nbsp; for tok in train_tokens: mytagger.train(tok)<BR>&nbsp; File "C:\Python24\Lib\site-packages\nltk\tagger\__init__.py", line 324, in train<BR>&nbsp;&nbsp;&nbsp; assert chktype(1, tagged_token, Token)<BR>&nbsp; File "C:\Python24\Lib\site-packages\nltk\chktype.py", line 316, in chktype<BR>&nbsp;&nbsp;&nbsp; raise TypeError(errstr)<BR>TypeError: </DIV>  <DIV>&nbsp; Argument 1 to train() must have type: Token<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (got a str)</DIV>  <DIV>&nbsp;</DIV>  <DIV>please i want a help on how to recover this error , in other words how can i convert between type string and token , as im still new in python</DIV>  <DIV>thanks in advance</DIV> 
 <DIV>&nbsp;</DIV></BLOCKQUOTE></DIV><p>
                <hr size=1> <a href="http://us.lrd.yahoo.com/_ylc=X3oDMTFqODRtdXQ4BF9TAzMyOTc1MDIEX3MDOTY2ODgxNjkEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw--/SIG=110oav78o/**http%3a//farechase.yahoo.com/">Yahoo! FareChase - Search multiple travel sites in one click.</a>