当前位置: 首页>>代码示例>>Python>>正文


Python Concepts.saveConcepts方法代码示例

本文整理汇总了Python中nl_lib.Concepts.Concepts.saveConcepts方法的典型用法代码示例。如果您正苦于以下问题:Python Concepts.saveConcepts方法的具体用法?Python Concepts.saveConcepts怎么用?Python Concepts.saveConcepts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nl_lib.Concepts.Concepts的用法示例。


在下文中一共展示了Concepts.saveConcepts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: exportNeo4JToConcepts

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
    def exportNeo4JToConcepts(self, concepts, fileNodes=u"nodes.p"):

        qs = u"Match n return n"

        lq, qd = self.cypherQuery(qs)

        for x in lq:
            if len(x) == 2:
                logger.info(u"%s[%s]" % (x[0], x[1]))
                concepts.addConceptKeyType(x[0], x[1])
            else:
                logger.warn(u"Not a standard node : %d : %s" % (len(x), x))

        # Match r relations
        qs = u"match n-[r]-m return n, r, m"
        lq, qd = self.cypherQuery(qs)

        for x in lq:
            if len(x) == 6:
                logger.info(u"%s[%s]" % (x[0], x[1]))
                concepts.addConceptKeyType(x[0], x[1])
            else:
                logger.warn(u"Not a standard node : %d : %s" % (len(x), x))

        Concepts.saveConcepts(concepts, fileNodes)

        return concepts
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:29,代码来源:Neo4JLib.py

示例2: test_ExportArchiFolderModels

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def test_ExportArchiFolderModels(cleandir):

    if __name__ == u"__main__":
        cleandir()

    assert (os.path.isfile(fileArchimateTest) is True)
    al = ArchiLib(fileArchimateTest)

    folder = u"Scenarios"

    logger.info(u"Exporting Folder : %s" % folder)
    listMTE = al.getModelsInFolder(folder)
    assert (listMTE is not None)

    logger.info(u"len(listMTE) = %d" % len(listMTE))
    assert (len(listMTE) == 2)

    concepts = Concepts(u"Export", u"Pickle")

    for ModelToExport in listMTE:
        logger.info(u"  Model : %s" % ModelToExport)
        d = concepts.addConceptKeyType(ModelToExport, u"Model")
        al.recurseModel(ModelToExport)

    al.outputCSVtoFile(concepts, fileExport=fileCSVExport)
    assert (os.path.isfile(fileCSVExport) is True)

    Concepts.saveConcepts(concepts, fileConceptsExport)
    logger.info(u"Save Concepts : %s" % fileConceptsExport)

    assert (os.path.isfile(fileConceptsExport) is True)
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:33,代码来源:test_ArchiLib.py

示例3: collectDependancyAnalysisNodes

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
    def collectDependancyAnalysisNodes(self):

        count = 0
        listTSort = list()
        for x in self.al.dictEdges.keys():
            logger.debug(u"[%s]=%s" % (self.al.dictEdges[x][u"id"], x))

            if u"source" in self.al.dictEdges[x]:
                source = self.al.dictEdges[x][u"source"]
                target = self.al.dictEdges[x][u"target"]

                logger.debug(u"  Rel    : %s" % (self.al.dictEdges[x][ARCHI_TYPE]))

                if self.al.dictEdges[x][ARCHI_TYPE] in (u"archimate:FlowRelationship"):

                    # al.countNodeType(al.dictNodes[source][ARCHI_TYPE])
                    # al.countNodeType(al.dictNodes[target][ARCHI_TYPE])
                    # al.countNodeType(al.dictEdges[x][ARCHI_TYPE])

                    if (self.al.dictNodes[source][ARCHI_TYPE] == u"archimate:BusinessProcess") and \
                            self.al.dictNodes[target][ARCHI_TYPE] == u"archimate:BusinessProcess":

                        sourceName = self.al.getNodeName(source)
                        targetName = self.al.getNodeName(target)

                        if sourceName[0].isdigit() or targetName[0].isdigit():
                            continue

                        logger.debug(u" %s:%s" % (sourceName, targetName))

                        l = list()

                        sc = self.findConcept(self.concepts, sourceName)
                        if sc is None:
                            logger.debug(u"New Target - %s" % sourceName)
                            sc = self.concepts.addConceptKeyType(self.al.getNodeName(source), u"Source")
                            self.getWords(sourceName, sc)
                        else:
                            logger.debug(u"Prior Target %s" % sourceName)

                        tc = self.findConcept(self.concepts, targetName)
                        if tc is None:
                            logger.debug(u"New Target %s" % targetName)
                            tc = sc.addConceptKeyType(self.al.getNodeName(target), u"Target")
                            self.getWords(sourceName, tc)
                        else:
                            logger.debug(u"Prior Target %s" % targetName)
                            sc.addConcept(tc)

                        l.append(target)
                        l.append(source)
                        listTSort.append(l)

        logger.debug(u"Edges = %s" % listTSort)

        Concepts.saveConcepts(self.concepts, fileConceptsTraversal)

        self.dependancyAnalysis(listTSort)

        return self.concepts, listTSort
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:62,代码来源:DependencyAnalysis.py

示例4: findSimilarties

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
    def findSimilarties(self):

        logger.info(u"Compute Similarity")

        self.conceptsSimilarity = Concepts(u"ConceptsSimilarity", u"Similarities")

        # Compute similarity between documents / concepts
        similarityThreshold = self.similarity

        for document in self.documentsList:
            indexNum = self.documentsList.index(document)

            self.df = self.concepts.getConcepts().keys()

            logger.info(u"++conceptsDoc %s" % (self.df[indexNum]))
            logger.info(u"  documentsList[" + str(indexNum) + u"]=" + u"".join(x + u" " for x in document))

            # Show common topics
            d = [unicode(x).strip().replace(u"'", u"") for x in document]
            e = [unicode(y).strip().replace(u"\"", u"") for y in self.listTopics]

            s1 = set(e)
            s2 = set(d)
            common = s1 & s2
            lc = [x for x in common]
            logger.info(u"  Common Topics : %s{%s}" % (lc, self.al.dictName[document][ARCHI_TYPE]))

            self.doComputation(indexNum, similarityThreshold, tfAddWords=True)

        Concepts.saveConcepts(self.conceptsSimilarity, conceptsSimilarityFile)

        logger.info(u"Saved Concepts : %s" % conceptsSimilarityFile)

        return self.conceptsSimilarity
开发者ID:RichDijk,项目名称:ArchiConcepts,代码行数:36,代码来源:al_GapSimilarity.py

示例5: requirementAnalysis

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def requirementAnalysis(fileArchimate=None):

    if fileArchimate is None:
        fileArchimate = u"/Users/morrj140/Documents/SolutionEngineering/Archimate Models/DVC v38.archimate"

    al = ArchiLib(fileArchimate)

    conceptsFile = fileConceptsRequirements

    searchTypes = list()
    searchTypes.append(u"archimate:Requirement")
    nl = al.getTypeNodes(searchTypes)

    logger.info(u"Find Words in Requirements...")
    concepts = Concepts(u"Requirement", u"Requirements")
    n = 0
    for sentence in nl:
        n += 1
        logger.debug(u"%s" % sentence)

        c = concepts.addConceptKeyType(u"Document" + str(n), u"Document")
        d = c.addConceptKeyType(sentence, u"Sentence" + str(n))

        if True and sentence is not None:
            cleanSentence = ' '.join([word for word in sentence.split(u" ") if word not in stop])
            for word, pos in nltk.pos_tag(nltk.wordpunct_tokenize(cleanSentence)):
                if len(word) > 1 and pos[0] == u"N":
                    e = d.addConceptKeyType(word, u"Word")
                    f = e.addConceptKeyType(pos, u"POS")

    Concepts.saveConcepts(concepts, conceptsFile)
    logger.info(u"Saved : %s" % conceptsFile)

    chunks = Chunks(concepts)
    chunks.createChunks()
开发者ID:Darth-Neo,项目名称:ArchiConcepts,代码行数:37,代码来源:al_RequirementAnalysis.py

示例6: saveTopics

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
 def saveTopics(self, topics):
     wordConcepts = Concepts(u"TopicConcepts", u"Topics")
     for topic in topics:
         logger.debug(u"Topic:" + topic[0])
         w = wordConcepts.addConceptKeyType(topic[0], u"Topic")
         w.count = topic[1]
     Concepts.saveConcepts(wordConcepts, self.topicsFile)
     return wordConcepts
开发者ID:Darth-Neo,项目名称:nl_lib,代码行数:10,代码来源:TopicsModel.py

示例7: _saveConcepts

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
    def _saveConcepts(self):
        logger.info(u"Saving %s" % self.documentsConceptsFile)
        Concepts.saveConcepts(self.documentsConcepts, self.documentsConceptsFile)
        logger.info(u"Saving %s" % self.wordsConceptsFile)
        Concepts.saveConcepts(self.wordsConcepts, self.wordsConceptsFile)

        logger.info(u"Saving Documents %s" % os.getcwd() + os.sep + self.documentsConceptsFile)
        logger.info(u"Saving Words%s" % os.getcwd() + os.sep + self.wordsConceptsFile)
开发者ID:Darth-Neo,项目名称:DirCrawler,代码行数:10,代码来源:nl_phase_a_DirCrawl.py

示例8: exportArchi

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
    def exportArchi(self):

        m = hashlib.md5()

        concepts = Concepts(u"Node", u"Nodes")

        logger.info(u"Found %d Nodes" % len(self.al.dictNodes))
        logger.info(u"Found %d Edges" % len(self.al.dictEdges))

        count = 0
        listTSort = list()
        for x in self.al.dictEdges.keys():
            logger.debug(u"Edge [%s]=%s" % (self.al.dictEdges[x], x))

            if self.al.dictEdges[x].has_key(u"source") and self.al.dictEdges[x].has_key(u"target"):

                typeEdge = self.al.dictEdges[x][ARCHI_TYPE]
                logger.debug(u"Edge   : %s" % typeEdge)

                source = self.al.dictEdges[x][u"source"]
                logger.debug(u"Source : %s" % source)

                target = self.al.dictEdges[x][u"target"]
                logger.debug(u"Target : %s" % target)

                logger.debug(u"  Rel    : %s" % (self.al.dictEdges[x][ARCHI_TYPE]))

                sourceName = self.al.getNodeName(source)
                targetName = self.al.getNodeName(target)

                logger.debug(u" %s--%s--%s" % (sourceName, self.al.dictEdges[x][ARCHI_TYPE][10:], targetName))

                if source in self.al.dictNodes:
                    l = list()
                    sc = concepts.addConceptKeyType(sourceName, self.al.dictNodes[source][ARCHI_TYPE][10:])
                    # getWords(sourceName, sc)

                nameEdge = u"(" + sourceName + u"," + targetName + u")"
                logger.debug(u"nameEdge : %s[%d]" % (nameEdge, len(nameEdge)))
                logger.debug(u"typeEdge : %s" % typeEdge[10:])

                ne = str(self.al.cleanString(nameEdge))
                hl = hashlib.sha224(str(ne)).hexdigest()

                logger.debug(u"hash : %s" % hl)

                nh = u"%s-%s" % (typeEdge[10:], hl)

                rc = sc.addConceptKeyType(nh, typeEdge[10:])

                if self.al.dictNodes.has_key(target):
                    tc = rc.addConceptKeyType(targetName, self.al.dictNodes[target][ARCHI_TYPE][10:])
                    # getWords(sourceName, tc)

        Concepts.saveConcepts(concepts, self.fileConceptsExport)

        return concepts
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:59,代码来源:ExportArchi.py

示例9: test_ExportArchi

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def test_ExportArchi(cleandir):

    if __name__ == u"__main__":
        cleandir()

    logger.info(u"Using : %s" % fileArchimateTest)

    assert (os.path.isfile(fileArchimateTest) is True)

    al = None
    concepts = None

    al = ArchiLib(fileArchimateTest)

    assert (al is not None)

    concepts = Concepts(u"Node", u"Nodes")

    assert (concepts is not None)

    logger.info(u"Found %d Nodes" % len(al.dictNodes))
    logger.info(u"Found %d Edges" % len(al.dictEdges))

    assert (len(al.dictNodes) == 45)
    assert (len(al.dictEdges) == 36)

    count = 0
    listTSort = list()
    for x in al.dictEdges.keys():
        logger.info(u"[%s]=%s" % (al.dictEdges[x][u"id"], x))

        if u"source" in al.dictEdges[x]:
            source = al.dictEdges[x][u"source"]
            target = al.dictEdges[x][u"target"]

            logger.info(u"  Rel    : %s" % (al.dictEdges[x][ARCHI_TYPE]))

            sourceName = al.getNodeName(source)
            targetName = al.getNodeName(target)

            logger.info(u" %s--%s--%s" % (sourceName, al.dictEdges[x][ARCHI_TYPE][10:], targetName))

            sc = concepts.addConceptKeyType(sourceName, al.dictNodes[source][ARCHI_TYPE][10:])
            # getWords(sourceName, sc)

            tc = sc.addConceptKeyType(targetName, al.dictNodes[target][ARCHI_TYPE][10:])
            # getWords(sourceName, tc)

    Concepts.saveConcepts(concepts, fileConceptsExport)

    assert(len(concepts.cd) == 17)

    assert (os.path.isfile(fileConceptsExport) is True)

    assert(concepts.typeName == u"Nodes")
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:57,代码来源:test_ArchiLib.py

示例10: PPTXCrawl

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def PPTXCrawl(filePPTX):

    logger.info(u"Using : %s" % filePPTX)

    cpptx = PPTXCreateArchil(filePPTX)

    c = cpptx.crawlPPTX()

    c.logConcepts()

    Concepts.saveConcepts(c, fileConceptsPPTX)
开发者ID:Darth-Neo,项目名称:ArchiConcepts,代码行数:13,代码来源:al_PPTXCrawl.py

示例11: test_PPTXCrawl

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def test_PPTXCrawl(fileArchimate):

    assert (os.path.isfile(filePPTXIn) is True)

    logger.info(u"Using : %s" % filePPTXIn)

    cpptx = PPTXCreateArchil(filePPTXIn, fileArchimate)

    c = cpptx.crawlPPTX()

    Concepts.saveConcepts(c, fileConceptsPPTX)

    assert (os.path.isfile(fileConceptsPPTX) is True)
开发者ID:RichDijk,项目名称:ArchiConcepts,代码行数:15,代码来源:test_all_phases.py

示例12: PPTXCreateArchi

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def PPTXCreateArchi():

    start_time = ArchiLib.startTimer()

    logger.info(u"Using : %s" % filePPTXIn)

    cpptx = PPTXCreateArchil(filePPTXIn, fileArchimateTest)

    c = cpptx.crawlPPTX()

    c.logConcepts()

    Concepts.saveConcepts(c, fileConceptsPPTX)

    ArchiLib.stopTimer(start_time)
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:17,代码来源:PPTXCreateArchi.py

示例13: createArchimateConcepts

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def createArchimateConcepts(fileArchimate, fileConceptsArch):

    logger.info(u"Using : %s" % fileArchimate)

    concepts = Concepts(fileArchimateModel, u"Archimate")

    al = ArchiLib(fileArchimate)

    al.logTypeCounts()

    #
    # Create Concepts from Archimate
    #
    al.folderConcepts(concepts)
    Concepts.saveConcepts(concepts, fileConceptsArch)
    logger.info(u"Saved concepts to : %s" % fileConceptsArch)
开发者ID:Darth-Neo,项目名称:ArchiConcepts,代码行数:18,代码来源:al_CreateArchimateConcepts.py

示例14: exportArchiFolderModels

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
    def exportArchiFolderModels(self, folder):

        logger.info(u"Exporting Folder : %s" % folder)

        listMTE = self.al.getModelsInFolder(folder)

        concepts = Concepts(u"Export", u"Pickle")

        for ModelToExport in listMTE:
            logger.info(u"  Model : %s" % ModelToExport)
            d = concepts.addConceptKeyType(ModelToExport, u"Model")
            self.al.recurseModel(ModelToExport, d)

        self.al.outputCSVtoFile(concepts, fileCSVExport)

        Concepts.saveConcepts(concepts, self.conceptsFile)

        logger.info(u"Save Concepts : %s" % self.conceptsFile)
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:20,代码来源:ExportFolderModels.py

示例15: test_ArchimateConcepts

# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import saveConcepts [as 别名]
def test_ArchimateConcepts(cleandir):

    if __name__ == u"__main__":
        cleandir()

    logger.info(u"Using : %s" % fileArchimateTest)

    assert (os.path.isfile(fileArchimateTest) is True)

    concepts = Concepts(fileConceptsArch, u"Archimate")

    al = ArchiLib(fileArchimateTest)

    #
    # Create Concepts from Archimate
    #
    al.folderConcepts(concepts)

    Concepts.saveConcepts(concepts, fileConceptsArch)
    logger.info(u"Saved concepts to : %s" % fileConceptsArch)

    assert (os.path.isfile(fileConceptsArch) is True)
开发者ID:Darth-Neo,项目名称:al_lib,代码行数:24,代码来源:test_ArchiLib.py


注:本文中的nl_lib.Concepts.Concepts.saveConcepts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。