コード例 #1
0
ファイル: fuzzylas.py プロジェクト: linwang741/fuzzylas
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
コード例 #2
0
ファイル: covid19.py プロジェクト: LionStudent/eagle
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
コード例 #3
0
ファイル: MLP.py プロジェクト: dfletch99/cs436_final
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)
コード例 #4
0
ファイル: gui.py プロジェクト: NikhilMeduri/notam-visualiser
    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()
コード例 #5
0
ファイル: fuzzylas.py プロジェクト: rayosclx/fuzzylas
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
コード例 #6
0
ファイル: fuzzylas.py プロジェクト: amunozNFX/fuzzylas
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
コード例 #7
0
ファイル: gui.py プロジェクト: nando/notam-visualiser
    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()
コード例 #8
0
def main():
    array_data, classifications = process.extract(IGNORE_INCOMPLETE_ENTRIES)
    best_tree = findBestTree(array_data, classifications)
コード例 #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)