本文整理汇总了Python中nl_lib.Concepts.Concepts.loadConcepts方法的典型用法代码示例。如果您正苦于以下问题:Python Concepts.loadConcepts方法的具体用法?Python Concepts.loadConcepts怎么用?Python Concepts.loadConcepts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nl_lib.Concepts.Concepts
的用法示例。
在下文中一共展示了Concepts.loadConcepts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: importConceptsIntoArchi
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def importConceptsIntoArchi():
logger.info(u"Using : %s" % fileArchimateTest)
conceptFile = fileConceptsBatches
logger.info(u"Loading :" + conceptFile)
concepts = Concepts.loadConcepts(conceptFile)
al = ArchiLib()
# Create Subfolder
folder = u"Implementation & Migration"
subfolder = u"Dependancy Analysis - %s" % time.strftime(u"%Y%d%m_%H%M%S")
attrib = dict()
attrib[u"id"] = al.getID()
attrib[u"name"] = subfolder
al.insertNode(u"folder", folder, attrib)
logger.info(u"--- Insert Nodes ---")
insertConceptNode(al, concepts, subfolder)
logger.info(u"--- Insert Relations ---")
insertConceptRelation(al, concepts)
al.outputXMLtoFile(filename=u"import_concepts.archimate")
示例2: importConceptsIntoNeo4J
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def importConceptsIntoNeo4J(fileArchimate, gdb, ClearNeo4J=True):
icnj = ConceptsImportNeo4J(fileArchimate, gdb, ClearNeo4J=ClearNeo4J)
importConcepts = Concepts.loadConcepts(fileConceptsExport)
icnj.importNeo4J(importConcepts)
示例3: conceptsImportNeo4J
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def conceptsImportNeo4J(fileArchimate, gdb):
logger.info(u"Using : %s" % fileConceptsExport)
importConcepts = Concepts.loadConcepts(fileConceptsExport)
in4j = ConceptsImportNeo4J(fileArchimateTest, gdbTest, ClearNeo4J=True)
in4j.importNeo4J(importConcepts)
示例4: __init__
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def __init__(self, concepts=None):
if concepts is None:
logger.info(u"Loading : %s" % self.conceptFile)
self.concepts = Concepts.loadConcepts(self.conceptFile)
else:
logger.info(u"Using : %s" % concepts.name)
self.concepts = concepts
self.chunkConcepts = Concepts(u"Chunk", u"Chunks")
示例5: test_importConceptsIntoNeo4J
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def test_importConceptsIntoNeo4J(fileArchimate, gdb):
assert (os.path.isfile(fileArchimate) is True)
icnj = ConceptsImportNeo4J(fileArchimate, gdb, ClearNeo4J=True)
assert (os.path.isfile(fileConceptsExport) is True)
importConcepts = Concepts.loadConcepts(fileConceptsExport)
icnj.importNeo4J(importConcepts)
示例6: __init__
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def __init__(self, conceptFile=None):
if conceptFile == None:
conceptFile = u"documents.p"
logger.info(u"Load Concepts from %s " % (conceptFile))
self.concepts = Concepts.loadConcepts(conceptFile)
logger.info(u"Loaded Concepts")
self.conceptsNGram = Concepts(u"n-gram", u"NGRAM")
self.conceptsNGramScore = Concepts(u"NGram_Score", u"Score")
self.conceptsNGramSubject = Concepts(u"Subject", u"Subjects")
示例7: createTagCloud
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def createTagCloud(conceptFile, topic):
start_time = ArchiLib.startTimer()
concepts = Concepts.loadConcepts(conceptFile)
tc = TopicCloud(concepts, font_path=u"/Users/morrj140/Fonts/DroidSans.ttf", imageFile=u"Topics.png")
tc.createTagCloud(topic)
ArchiLib.stopTimer(start_time)
示例8: graphConcepts
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def graphConcepts(graph, conceptFile):
concepts = Concepts.loadConcepts(conceptFile)
# concepts.logConcepts()
graph.addGraphNodes(concepts)
graph.addGraphEdges(concepts)
if isinstance(graph, NetworkXGraph):
graph.saveJSON(concepts)
if isinstance(graph, GraphVizGraph):
graph.exportGraph()
if isinstance(graph, PatternGraph):
graph.exportGraph()
示例9: createArchiFromConcepts
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def createArchiFromConcepts(fileArchimate, fileConceptsImport, fileArchimateImport):
logger.info(u"Using : %s" % fileArchimate)
logger.info(u"Loading :" + fileConceptsImport)
ic = ConceptsImportArchi(fileArchimate, fileConceptsImport)
concepts = Concepts.loadConcepts(fileConceptsImport)
# Create Subfolder
folder = u"Implementation & Migration"
subfolder = u"Dependancy Analysis - %s" % time.strftime(u"%Y%d%m_%H%M%S")
ic.importConcepts(concepts, folder, subfolder)
ic.exportXML(fileArchimateImport)
示例10: analyzeNetworkX
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def analyzeNetworkX(self, concepts, fileConceptsExport=None):
if concepts is None and fileConceptsExport is not None:
concepts = Concepts.loadConcepts(fileConceptsExport)
logger.info(u" Concepts : %s[%d][%s]" % (concepts.name, len(concepts.getConcepts()), concepts.typeName))
self.graph = NetworkXGraph()
logger.info(u"Adding NetworkX nodes to the graph ...")
self.addGraphNodes(concepts)
logger.info(u"Adding NetworkX edges to the graph ...")
self.addGraphEdges(concepts)
gl = nx.pagerank(self.graph.G)
self.analyzeGraph(gl, u"PageRank")
示例11: test_GraphConcepts
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def test_GraphConcepts(cleandir):
assert (os.path.isfile(fileConceptsNGramsSubject) is True)
c = Concepts(u"GraphConcepts", u"GRAPH")
concepts = Concepts.loadConcepts(fileConceptsNGramsSubject)
# c.logConcepts()
# graph = PatternGraph()
graph = GraphVizGraph()
cg = ConceptsGraph(graph=graph, fileImage=fileImageExport)
cg.conceptsGraph(concepts)
assert (os.path.isfile(fileImageExport) is True)
示例12: test_ConceptsImportArchi
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def test_ConceptsImportArchi():
start_time = ArchiLib.startTimer()
logger.info(u"Using : %s" % fileArchimateTest)
logger.info(u"Loading :" + fileConceptsExport)
ic = ConceptsImportArchi(fileArchimateTest, fileConceptsExport)
concepts = Concepts.loadConcepts(fileConceptsExport)
# Create Subfolder
folder = u"Implementation & Migration"
subfolder = u"Dependancy Analysis - %s" % time.strftime(u"%Y%d%m_%H%M%S")
ic.importConcepts(concepts, folder, subfolder)
ic.exportXML()
ArchiLib.stopTimer(start_time)
示例13: test_CreateArchiFromConcepts
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def test_CreateArchiFromConcepts(cleandir, fileArchimate):
assert (os.path.isfile(fileArchimate) is True)
assert (os.path.isfile(fileConceptsImport) is True)
logger.info(u"Using : %s" % fileArchimate)
logger.info(u"Loading : %s" % fileConceptsImport)
ic = ConceptsImportArchi(fileArchimate, fileConceptsImport)
concepts = Concepts.loadConcepts(fileConceptsImport)
# Create Subfolder
folder = u"Implementation & Migration"
subfolder = u"Dependancy Analysis - %s" % time.strftime(u"%Y%d%m_%H%M%S")
ic.importConcepts(concepts, folder, subfolder)
ic.exportXML(fileArchimateImport)
assert (os.path.isfile(fileArchimateImport) is True)
示例14: createTopics
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def createTopics(self, conceptsFile, concepts=None):
if concepts is None:
logger.info(u"Load Concepts from " + conceptsFile)
self.concepts = Concepts.loadConcepts(conceptsFile)
logger.info(u"Loaded Concepts")
else:
self.concepts = concepts
self.tm = TopicsModel()
logger.info(u"Load Documents from Concepts")
self.documentsList, self.wordcount = self.tm.loadConceptsWords(self.concepts)
self.mapDocuments = { self.documentsList.index(x) : x for x in self.documentsList}
self.df = self.concepts.getConcepts().keys()
logger.info(u"Read " + str(len(self.documentsList)) + u" Documents, with " + str(self.wordcount) + u" words.")
if self.wordcount == 0:
logger.error(u"No topics to use!")
return None
logger.info(u"Compute Topics")
self.topics = self.tm.computeTopics(self.documentsList, nt=num_topics, nw=num_words)
logger.info(u"Log Topics")
self.tm.logTopics(self.topics)
self.listTopics = [unicode(x[0]).strip().replace(u"\"", u"") for x in self.topics]
logger.info(u"Saving Topics")
self.topicConcepts = self.tm.saveTopics(self.topics)
logger.info(u"Complete createTopics")
return self.concepts
示例15: getChunkTopics
# 需要导入模块: from nl_lib.Concepts import Concepts [as 别名]
# 或者: from nl_lib.Concepts.Concepts import loadConcepts [as 别名]
def getChunkTopics():
# conceptFile = u"documents.p"
conceptFile = u"chunks.p"
# conceptFile = u"topicsDict.p"
# conceptFile = u"TopicChunks.p"
# conceptFile = u"ngramsubject.p"
conceptPathFile = os.getcwd() + os.sep + u"run" + os.sep + conceptFile
logger.info(u"Loading :" + os.getcwd() + os.sep + u"run" + os.sep + conceptFile)
concepts = Concepts.loadConcepts(conceptPathFile)
listTopics = list()
cf = open(conceptFile[:-2] + u".txt", u"wb")
for conceptDoc in concepts.getConcepts().values():
logger.debug(u"len %d" % len(conceptDoc.getConcepts()))
if len(conceptDoc.getConcepts()) > 1:
logger.debug(u"%d:%s" % (len(conceptDoc.getConcepts()), conceptDoc.name))
listTopics.append((len(conceptDoc.getConcepts()), conceptDoc))
for concept in conceptDoc.getConcepts().values():
logger.debug(u"--->" + concept.name)
logger.info(u"---- Sorted Topics ----")
cf.write(u"---- Sorted Topics ----" + os.linesep)
lt = sorted(listTopics, key=lambda c: c[0], reverse=True)
for x in lt:
logger.info(u"%s" % x[1].name)
cf.write(x[1].name + os.linesep)
for concept in x[1].getConcepts().values():
logger.info(u"--->%s" % concept.name)
cf.write(u"--->" + concept.name + os.linesep)
cf.close()