예제 #1
0
def clean_string(s):
    for c in sep[:-2]: # do not remove dashes ('-')
        s = s.replace(c, ' ')
    parts = s.split()
    result = ' '.join(p for p in parts if p != '')

    # now also remove dashes on the outer part of the string
    while result and result[0] in sep:
        result = result[1:]
    while result and result[-1] in sep:
        result = result[:-1]

    return result
예제 #2
0
def clean_string(s):
    for c in sep[:-2]:  # do not remove dashes ('-')
        s = s.replace(c, ' ')
    parts = s.split()
    result = ' '.join(p for p in parts if p != '')

    # now also remove dashes on the outer part of the string
    while result and result[0] in sep:
        result = result[1:]
    while result and result[-1] in sep:
        result = result[:-1]

    return result
예제 #3
0
def find_words(s):
    return _words_rexp.findall(s.replace('_', ' '))
예제 #4
0
def iter_words(s):
    return _words_rexp.finditer(s.replace('_', ' '))
예제 #5
0
def find_words(s):
    return _words_rexp.findall(s.replace('_', ' '))
예제 #6
0
def iter_words(s):
    return _words_rexp.finditer(s.replace('_', ' '))
예제 #7
0
파일: textutils.py 프로젝트: roh85/SickRage
def iter_words(s):
    return _words_rexp.finditer(s.replace("_", " "))
예제 #8
0
파일: textutils.py 프로젝트: roh85/SickRage
def find_words(s):
    return _words_rexp.findall(s.replace("_", " "))