On May 25, 5:39 am, Steven D'Aprano
wrote:
> On Mon, 25 May 2009 00:16:19 +0200, Piet van Oostrum wrote:
> > By the way, it is better to add python code as attachment instead of
> > inline text because some news software might fold the lines like in your
> > posting, making it difficult to reconst
#Gui
import re, collections
from Tkinter import *
from nltk_lite import tokenize
def words(text): return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
return model
NWORDS = train(words(fi
On May 20, 12:37 pm, Mike Kazantsev
wrote:
> abosalim wrote:
> > I used this code.It works fine,but on word not whole text.I want to
> > extend this code to correct
> > text file not only a word,but i don't know.If you have any help,please
> > infor
I used this code.It works fine,but on word not whole text.I want to
extend this code to correct
text file not only a word,but i don't know.If you have any help,please
inform me.
This is the code:
import re, collections
def words(text): return re.findall('[a-z]+', text.lower())
def train(feature