Example #1
0
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
Example #2
0
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
Example #3
0
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)
Example #4
0
    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()
Example #5
0
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
Example #6
0
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
Example #7
0
    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()
Example #8
0
def main():
    array_data, classifications = process.extract(IGNORE_INCOMPLETE_ENTRIES)
    best_tree = findBestTree(array_data, classifications)
Example #9
0
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)