當前位置: 首頁>>代碼示例>>Python>>正文


Python LinkedList.count方法代碼示例

本文整理匯總了Python中LinkedList.LinkedList.count方法的典型用法代碼示例。如果您正苦於以下問題:Python LinkedList.count方法的具體用法?Python LinkedList.count怎麽用?Python LinkedList.count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在LinkedList.LinkedList的用法示例。


在下文中一共展示了LinkedList.count方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _getProximityQueryTermPostingList

# 需要導入模塊: from LinkedList import LinkedList [as 別名]
# 或者: from LinkedList.LinkedList import count [as 別名]
 def _getProximityQueryTermPostingList(self, term1String, term2String, distance):
     term1    = self._getQueryTermPostingList(term1String);
     term2    = self._getQueryTermPostingList(term2String);
     docs1    = term1.docs._head;
     docs2    = term2.docs._head;
     newDocs1 = LinkedList();
     newDocs2 = LinkedList();
     termHasDocs = False
     while (docs1 is not None) and (docs2 is not None):
         if docs1.value == docs2.value:
             if self._docHasTokensWithinDistance(docs1.value, docs2.value, distance):
                 newDocs1.insertAfter(docs1.value);
                 newDocs2.insertAfter(docs2.value);
                 termHasDocs = True;
             docs1 = docs1.next;
             docs2 = docs2.next;
         else:
             if docs1.value < docs2.value: docs1 = docs1.next;
             else: docs2 = docs2.next;
     # transfer term count per document to truncated list
     newDocs1.count = term1.count
     newDocs2.count = term2.count
     # exchange full document term count with truncated list
     term1.docs = newDocs1;
     term2.docs = newDocs2;
     if termHasDocs: return term1, term2;
     else: return None, None
開發者ID:anconaesselmann,項目名稱:pySearch,代碼行數:29,代碼來源:SearchEngine.py


注:本文中的LinkedList.LinkedList.count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。