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


PHP Definition::stripNumberSign方法代碼示例

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


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

示例1: parseOneDefinition

 /** Parses one definition line, i.e. extracts {{label}}, definition,
  * {{example|Quotation sentence.}}, creates and fills a meaning (WMeaning).
  * @param page_title    word which is described in this article 'text'
  * @param lang_section  language of this section of an article
  * @param line          definition line
  * @return WMeaning or null if the line is not started from "#" or = "# "
  */
 public static function parseOneDefinition($page_title, $lang_section, $line)
 {
     if (preg_match("/\\{\\{Нужен перевод\\}\\}/", $line)) {
         return null;
     }
     // remove empty quotations: {{пример|}} and {{пример}}
     $line = preg_replace("/\\{\\{пример\\|\\}\\}/", "", $line);
     $line = preg_replace("/\\{\\{пример\\}\\}/", "", $line);
     $line = preg_replace("/\\{\\{пример перевод\\|\\}\\}/", "", $line);
     // todo check - does exist this example
     $line = preg_replace("/\\[\\[\\]\\]/", "", $line);
     // empty definition
     $line = Definition::stripNumberSign($page_title, $line);
     if (0 == strlen($line)) {
         return null;
     }
     if (preg_match("/\\A\\{\\{морфема/", $line)) {
         return null;
     }
     // skip now, todo (parse) in future
     $label_text = LabelRu . extractLabelsTrimText(line);
     if (null == label_text) {
         return null;
     }
     /*
             $line = label_text.getText();
             
             // 2. extract text till first {{пример|
             String wiki_definition = WQuoteRu.getDefinitionBeforeFirstQuote(page_title, line);
     
             // 3. parsing wiki-text
             //StringBuffer definition = WikiWord.parseDoubleBrackets(page_title, new StringBuffer(wiki_definition));
     
             // 4. extract wiki-links (internal links)
             //WikiWord[] ww = WikiWord.getWikiWords(page_title, new StringBuffer(wiki_definition));
     
             // 5. extract quotations
             WQuote[] quote = WQuoteRu.getQuotes(page_title, line);        
     
             return new WMeaning(page_title, label_text.getLabels(), wiki_definition, quote, false);
     */
 }
開發者ID:stasonmokoron,項目名稱:nerpa,代碼行數:49,代碼來源:WMeaning.php


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