示例#1
0
 def __init__(self, filename_, minsupp,thrshld):
   stringlist.__init__(self)
   self.db = DB(filename_, minsupp)
   self.CandidateTerms = []
   self.FreqCandidates = []
   self.Candidates = []   
   self.threshold = thrshld
   stringlist.extend(self,self.db.T)
   self.getCandidates()
   self.trashterms = []
   totalmensions = 0.0
   for candidate in self.Candidates:
     totalmensions += candidate[0]
   for candidate in self.Candidates:
     candidate[0] /= totalmensions
     if candidate[0] > self.threshold:
       stringlist.append(self,candidate[1])
   self.normalizeterms()
 def __init__(self, filename_, minsupp, thrshld):
     stringlist.__init__(self)
     self.db = DB(filename_, minsupp)
     self.CandidateTerms = []
     self.FreqCandidates = []
     self.Candidates = []
     self.threshold = thrshld
     stringlist.extend(self, self.db.T)
     self.getCandidates()
     self.trashterms = []
     totalmensions = 0.0
     for candidate in self.Candidates:
         totalmensions += candidate[0]
     for candidate in self.Candidates:
         candidate[0] /= totalmensions
         if candidate[0] > self.threshold:
             stringlist.append(self, candidate[1])
     self.normalizeterms()
示例#3
0
  def recompute(self, mins, thresh):
    self.CandidateTerms = []
    self.FreqCandidates = []
    self.Candidates = []   
    self.threshold = thresh
    stringlist.__init__(self)
    self.db.getCandidateTermsMinsupp(mins)
    self.extend(self.db.T)
    self.getCandidates()

    totalmensions = 0.0
    for candidate in self.Candidates:
      totalmensions += candidate[0]
    for candidate in self.Candidates:
      candidate[0] /= totalmensions
      if candidate[0] > self.threshold:
        stringlist.append(self,candidate[1])
    for trashterm in self.trashterms:
      if trashterm in self:
        stringlist.remove(self,trashterm)
    self.normalizeterms()
    def recompute(self, mins, thresh):
        self.CandidateTerms = []
        self.FreqCandidates = []
        self.Candidates = []
        self.threshold = thresh
        stringlist.__init__(self)
        self.db.getCandidateTermsMinsupp(mins)
        self.extend(self.db.T)
        self.getCandidates()

        totalmensions = 0.0
        for candidate in self.Candidates:
            totalmensions += candidate[0]
        for candidate in self.Candidates:
            candidate[0] /= totalmensions
            if candidate[0] > self.threshold:
                stringlist.append(self, candidate[1])
        for trashterm in self.trashterms:
            if trashterm in self:
                stringlist.remove(self, trashterm)
        self.normalizeterms()