help in algorithm
paolo_veronelli at tiscali.it
Wed Aug 10 16:51:55 CEST 2005
I have a self organizing net which aim is clustering words.
Let's think the clustering is about their 2-grams set.
Words then are instances of this class.
def __abs__(self):# the set of q-grams (to be calculated only once)
return set([(self+self)[n:n+2] for n in range(len(self))])
def __sub__(self,other): # the q-grams distance between 2 words
I'm looking for the medium of a set of words, as the word which
minimizes the sum of the distances from those words.
Aka:sum([medium-word for word in words])
Thanks for ideas, Paolino
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
More information about the Python-list