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


Python Document.load方法代码示例

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


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

示例1: doc_get

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
 def doc_get(self, docname):
     # Retrieve a document from cache, creating from CPS if necessary.
     if docname in self.cache:
         return self.cache[docname]
     doc = Document({})
     if docname in self:
         json_data = json.loads(self[docname])
         doc.load(json_data)
     self.doc_set(docname, doc)
     self.doc_save(docname)
     return doc
开发者ID:aral,项目名称:ConcurrenTree,代码行数:13,代码来源:user.py

示例2: search_documents

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
    def search_documents(self):
        ws = self.app.config.get('paths', 'workspace')
        if not exists(ws):
            return
        docs = []
        for item in listdir(ws):
            fn = join(ws, item, 'project.json')
            if not exists(fn):
                continue
            doc = Document()
            doc.load(fn)
            docs.append((doc, fn))

        docs.sort(lambda a, b: cmp(a[0].infos.time_modification, b[0].infos.time_modification))
        for doc, filename in docs:
            self.load_document(doc, filename)
开发者ID:arthurfait,项目名称:presemt,代码行数:18,代码来源:project.py

示例3: initData

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
def initData():
   """Load data and mappings from Raw data files and mapping files"""
   Patient.load()
   Med.load()
   Problem.load()
   Lab.load()
   Refill.load()
   VitalSigns.load()
   Immunization.load()
   Procedure.load()
   SocialHistory.load()
   FamilyHistory.load()
   ClinicalNote.load()
   Allergy.load()
   ImagingStudy.load()
   Document.load()
开发者ID:climoli,项目名称:sample-patients,代码行数:18,代码来源:generate.py

示例4: loadURL

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
	def loadURL(self, document):
		command = {
			"command": "LOAD_DOCUMENT", 
			"targetURL": document
		}
		print >> self.gateProcess.stdin, json.dumps(command)

		return Document.load(self.readResponse(), src=document)
开发者ID:GateNLP,项目名称:gateplugin-python,代码行数:10,代码来源:gate.py

示例5: saveURL

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
	def saveURL(self, document, output):
		command = {
			"command": "SAVE_DOCUMENT", 
			"targetURL": document.src,
			"outputURL": output, 
			"documentCommands": document.logger
		}

		print >> self.gateProcess.stdin, json.dumps(command)

		return Document.load(self.readResponse(), src=output)
开发者ID:GateNLP,项目名称:gateplugin-python,代码行数:13,代码来源:gate.py

示例6: on_filename

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
 def on_filename(self, instance, filename):
     start = time()
     doc = Document()
     doc.load(filename)
     self.plane.size = doc.infos.root_size
     self.plane.scale = doc.infos.root_scale
     self.plane.rotation = doc.infos.root_rotation
     self.plane.pos = doc.infos.root_pos
     for obj in doc.objects:
         attrs = [("pos", obj.pos), ("size", obj.size), ("rotation", obj.rotation), ("scale", obj.scale)]
         if obj.dtype == "text":
             attrs += [(attr, obj[attr]) for attr in TextObject.__attrs__]
             self.create_text(**dict(attrs))
         elif obj.dtype == "image":
             attrs += [(attr, obj[attr]) for attr in ImageObject.__attrs__]
             self.create_image(**dict(attrs))
         elif obj.dtype == "video":
             attrs += [(attr, obj[attr]) for attr in VideoObject.__attrs__]
             self.create_video(**dict(attrs))
     for obj in doc.slides:
         self.create_slide(pos=obj.pos, rotation=obj.rotation, scale=obj.scale, thumb=obj.thumb)
     self.is_dirty = False
     print "=== Loading time: %3.4s" % (time() - start)
开发者ID:sizzler293,项目名称:presemt,代码行数:25,代码来源:presentation.py

示例7: start

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
	def start(self):
		self.init()

		line = sys.stdin.readline().strip()
		while line:
			line = codecs.decode(line, "utf8")

			if line:
				self.input_line = line
				input_json = json.loads(line)

				if "command" in input_json:
					if input_json["command"] == "BEGIN_EXECUTION":
						self.corpus = Corpus(input_json)
						self.beginExecution()
					elif input_json["command"] == "ABORT_EXECUTION":
						self.abortExecution()
					elif input_json["command"] == "END_EXECUTION":
						self.endExecution()
				else:
					self.document = Document.load(input_json)
					self.scriptParams = input_json.get("scriptParams")
					self.scriptParams = self.scriptParams if self.scriptParams else {}

					self.scriptParams["inputAS"] = self.document.annotationSets[input_json["inputAS"]]
					self.scriptParams["outputAS"] = self.document.annotationSets[input_json["outputAS"]]

					self.inputAS = self.scriptParams["inputAS"]
					self.outputAS = self.scriptParams["outputAS"]

					self.document = self.execute(self.document, **fill_params(self.scriptParams, self.execute))

					print json.dumps(self.document.logger)
					sys.stdout.flush()

			line = sys.stdin.readline().strip()
开发者ID:GateNLP,项目名称:gateplugin-python,代码行数:38,代码来源:processing_resource.py

示例8: __iter__

# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import load [as 别名]
	def __iter__(self):
		line = sys.stdin.readline().strip()
		while line:
			line = codecs.decode(line, "utf8")

			if line:
				input_line = line
				input_json = json.loads(line)

				if "command" in input_json:
					if input_json["command"] == "BEGIN_EXECUTION":
						corpus = Corpus(input_json)
					elif input_json["command"] == "ABORT_EXECUTION":
						return
					elif input_json["command"] == "END_EXECUTION":
						return
				else:
					try:
						document = Document.load(input_json)
						self.scriptParams = input_json.get("scriptParams")
						self.scriptParams = self.scriptParams if self.scriptParams else {}

						self.scriptParams["inputAS"] = document.annotationSets[input_json["inputAS"]]
						self.scriptParams["outputAS"] = document.annotationSets[input_json["outputAS"]]

						inputAS = self.scriptParams["inputAS"]
						outputAS = self.scriptParams["outputAS"]

						yield document
						print json.dumps(document.logger)
					except InvalidOffsetException as e:
						print >> sys.stderr, "InvalidOffsetException prevented reading a document " + e.message
						print json.dumps([])
					sys.stdout.flush()

			line = sys.stdin.readline().strip()
开发者ID:GateNLP,项目名称:gateplugin-python,代码行数:38,代码来源:iterator.py


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