本文整理汇总了Python中document.Document.getName方法的典型用法代码示例。如果您正苦于以下问题:Python Document.getName方法的具体用法?Python Document.getName怎么用?Python Document.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类document.Document
的用法示例。
在下文中一共展示了Document.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import getName [as 别名]
def __init__(self, questions, ngram=1):
self.documents = {}
self.index = {}
Posting.index = self
#questions is formatted as a list of dictionaries with attributes 'docID', 'text' and 'cluster'
for d in range(len(questions)):
#print questions[d]
doc = Document(title=questions[d]['title'],body=questions[d]['body'], docID = questions[d]['qid'], gram=ngram)
self.documents[doc.getName()] = doc
#print 'loading', doc.getName(), '...'
#doc.printPostingsList()
pl = doc.getPostingsList()
for term in pl:
self.addTerm(term,pl[term])
self.setIDFForAll()
示例2: NewDocumentDialog
# 需要导入模块: from document import Document [as 别名]
# 或者: from document.Document import getName [as 别名]
class NewDocumentDialog(QDialog):
openElementSignal = pyqtSignal(str)
def __init__(self, parent, project, document=None):
super(NewDocumentDialog, self).__init__(parent)
self.project = project
self.document = document
self.ui = Ui_NewDocumentDialog.Ui_NewDocumentDialog()
self.ui.setupUi(self)
self.accepted.connect(self.setDocument)
def setDocument(self):
title = unicode(self.ui.titleEdit.text())
prefix = unicode(self.ui.prefixEdit.text())
name = unicode(self.ui.nameEdit.text())
if (self.document is None):
self.document = Document()
self.document.setTitle(title)
self.document.setPrefix(prefix)
self.document.setName(name)
self.project.addDocument(self.document)
self.document.setProject(self.project)
self.openElementSignal.emit("document:" + self.document.getName())