Beispiel #1
0
def getDictionaryFromFile(name, extn=""):
    disk_dictionary = None
    validName = globalobjs.validatedLdaFileName(name, globalobjs.DICT_FILE_TYPE)
    if validName == "":
        return disk_dictionary

    disk_dictionary = corpora.Dictionary.load(validName)
    return disk_dictionary
Beispiel #2
0
def getModelFromFile(name, extn=globalobjs.LDA_MODEL_TYPE):
    disk_model = None
    validName = globalobjs.validatedLdaFileName(name, extn)
    if validName == "":
        return disk_model

    if(extn == globalobjs.LDA_MODEL_TYPE):
        disk_model = models.ldamodel.LdaModel.load(validName)

    return disk_model
Beispiel #3
0
def getBOWCorpusFromFile(name, extn=globalobjs.MM_CORPUS_TYPE):
    disk_bowcorpus = None
    validName = globalobjs.validatedLdaFileName(name, extn)
    if validName == "":
        return disk_bowcorpus

    if(extn == globalobjs.MM_CORPUS_TYPE):
        disk_bowcorpus = corpora.MmCorpus(validName)
    elif(extn == globalobjs.BLEI_CORPUS_TYPE):
        disk_bowcorpus = corpora.BleiCorpus(validName)
    elif(extn == globalobjs.SVMLIGHT_CORPUS_TYPE):
        disk_bowcorpus = corpora.SvmLightCorpus(validName)
    elif(extn == globalobjs.LOW_CORPUS_TYPE):
        disk_bowcorpus = corpora.LowCorpus(validName)

    return disk_bowcorpus