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


Python regex.VERBOSE屬性代碼示例

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


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

示例1: setup_parser

# 需要導入模塊: import regex [as 別名]
# 或者: from regex import VERBOSE [as 別名]
def setup_parser():
        from lexnlp.extract.en.amounts import CURRENCY_SYMBOL_MAP
        symbols = '|'.join([k for k in CURRENCY_SYMBOL_MAP]).replace('$', r'\$')
        ParsedTextCorrector.PATTERN_MONEY_BREAK = ParsedTextCorrector.PATTERN_MONEY_BREAK.format(symbols=symbols)
        ParsedTextCorrector.REGEX_MONEY_BREAK = re.compile(
            ParsedTextCorrector.PATTERN_MONEY_BREAK,
            re.IGNORECASE | re.DOTALL | re.MULTILINE | re.VERBOSE | re.UNICODE) 
開發者ID:LexPredict,項目名稱:lexpredict-contraxsuite,代碼行數:9,代碼來源:parsed_text_corrector.py

示例2: _matches

# 需要導入模塊: import regex [as 別名]
# 或者: from regex import VERBOSE [as 別名]
def _matches(regex):
    """Regular expression compiling function decorator."""
    def match_decorator(fn):
        automaton = compile(regex, UNICODE | VERBOSE)
        fn.split = automaton.split
        fn.match = automaton.match
        return fn

    return match_decorator 
開發者ID:fnl,項目名稱:segtok,代碼行數:11,代碼來源:tokenizer.py

示例3: split_sentences

# 需要導入模塊: import regex [as 別名]
# 或者: from regex import VERBOSE [as 別名]
def split_sentences(text):
    """Returns split sentences list
       Reference:
       http://stackoverflow.com/questions/8465335/a-regex-for-extracting-
              sentence-from-a-paragraph-in-python
    """
    sentenceEnders = regex.compile(r"""
        # Split sentences on whitespace between them.
        (?:               # Group for two positive lookbehinds.
          (?<=[.!?])      # Either an end of sentence punct,
        | (?<=[.!?]['"])  # or end of sentence punct and quote.
        )                 # End group of two positive lookbehinds.
        (?<!  Mr\.   )    # Don't end sentence on "Mr."
        (?<!  Mrs\.  )    # Don't end sentence on "Mrs."
        (?<!  Jr\.   )    # Don't end sentence on "Jr."
        (?<!  Dr\.   )    # Don't end sentence on "Dr."
        (?<!  Prof\. )    # Don't end sentence on "Prof."
        (?<!  Sr\.   )    # Don't end sentence on "Sr."
        (?<!  Sen\.  )
        (?<!  Ms\.   )
        (?<!  Rep\.  )
        (?<!  Gov\.  )
        (?<!  et\ al\.  )
        (?<!  i\.e\.  )
        (?<!  U\.S\.  )
        (?<!  p\.  )      # Don't end sentence on "p." (page)
        \s+               # Split on whitespace between sentences.
        """, regex.IGNORECASE | regex.VERBOSE)
    sentenceList = sentenceEnders.split(text)
    return sentenceList 
開發者ID:soodoku,項目名稱:autosum,代碼行數:32,代碼來源:autosum_arxiv.py


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