def guess_fuzzy(data, word, limit=1, maxdist=1): """ Fuzzywuzzy guess Args: limit (int): the max number of items to return. maxdist (int): the max allowed edit distance. """ hits = process.extract(word, data.keys(), limit=limit) output = [] for w, s in hits: d = levenshtein.levenshtein2(word, w) if d > maxdist: continue curves = data[w] for c in curves: result = {"distance": d, "score": s, "mnemonic": w, "curve": c} output.append(result) key = word + '-' + 'fuzzy' + '-' + str(limit) + str(maxdist) memcache.set(key, output) return output
def getImageFilename(options): startDate = options["from"] endDate = options["to"] days = getDailyMeasurements(startDate, endDate) measurementName = options["metric"] measurements = process.extract(days, measurementName) if not options["isTotal"]: measurements = process.dailyIncrease(measurements) if not options["isRaw"]: measurements = process.sevenDayAverage(measurements) numMeasurements = len(measurements) dayCounter = range(1, numMeasurements + 1) filename = saveImage(dayCounter, measurements) return filename
def main(): array_data, classifications = process.extract(IGNORE_INCOMPLETE_ENTRIES) train_data, test_data, train_classes, test_classes = process.split( array_data, classifications, TRAIN_FRACTION) #basicMLP(train_data, train_classes, test_data, test_classes) #parameterMLP(train_data, train_classes, test_data, test_classes) MLPScaling(train_data, train_classes, test_data, test_classes)
def OnOK(self, event): singleChoiceList = process.extract(self.richTextCtrlSource.GetValue()) if singleChoiceList: singleChoiceDialog = wx.SingleChoiceDialog( self, 'Select a NOTAM to process:', 'NOTAM Selection', singleChoiceList) if os.name == 'posix': singleChoiceDialog.Maximize() if singleChoiceDialog.ShowModal() == wx.ID_OK: self.informationList = [ singleChoiceDialog.GetStringSelection() ] singleChoiceDialog.Destroy() informationDialog = InformationDialog(self.informationList) else: stringMessage = 'ERROR: Cannot read source. An incorrectly formatted NOTAM is detected.' messageDialog = wx.MessageDialog(self, stringMessage, 'Error', wx.OK | wx.ICON_EXCLAMATION) messageDialog.ShowModal() messageDialog.Destroy()
def guess_fuzzy(data,word,lim): hits = process.extract(word,data.keys(),limit=lim) output = {} for hit in hits: output[(hit[1],hit[0])] = data[hit[0]] key = word + '-' + 'fuzzy' + '-' + str(lim) memcache.set(key,output) return output
def guess_fuzzy(data, word, lim): hits = process.extract(word, data.keys(), limit=lim) output = {} for hit in hits: output[(hit[1], hit[0])] = data[hit[0]] key = word + '-' + 'fuzzy' + '-' + str(lim) memcache.set(key, output) return output
def OnOK(self, event): singleChoiceList = process.extract(self.richTextCtrlSource.GetValue()) if singleChoiceList: singleChoiceDialog = wx.SingleChoiceDialog(self, 'Select a NOTAM to process:', 'NOTAM Selection', singleChoiceList) if os.name == 'posix': singleChoiceDialog.Maximize() if singleChoiceDialog.ShowModal() == wx.ID_OK: self.informationList = [singleChoiceDialog.GetStringSelection()] singleChoiceDialog.Destroy() informationDialog = InformationDialog(self.informationList) else: stringMessage = 'ERROR: Cannot read source. An incorrectly formatted NOTAM is detected.' messageDialog = wx.MessageDialog(self, stringMessage, 'Error', wx.OK | wx.ICON_EXCLAMATION) messageDialog.ShowModal() messageDialog.Destroy()
def main(): array_data, classifications = process.extract(IGNORE_INCOMPLETE_ENTRIES) best_tree = findBestTree(array_data, classifications)
def main(): array_data, classifications = process.extract(IGNORE_INCOMPLETE_ENTRIES) train_data, test_data, train_classes, test_classes = process.split( array_data, classifications, TRAIN_FRACTION) gnb(train_data, train_classes, test_data, test_classes) cnb(train_data, train_classes, test_data, test_classes)