コード例 #1
0
ファイル: classes.py プロジェクト: python-recsys/nl_ptools
    def tokenize(cls, text, ascii=False):
        tokens = re.split(r"[ \t\r\f\v]*\n[ \t\r\f\v]*\n[ \t\r\f\v]*", text,
            re.UNICODE)

        tokens = [token if not ascii else asciize(token[1]) \
                    for token  in tokens]
        return tokens
コード例 #2
0
ファイル: classes.py プロジェクト: python-recsys/nl_ptools
    def tokenize(cls, text, ascii=False):
        tokens, remainder = cls.scanner.scan(text)
        if remainder:
            print "****input failed syntax*****"
            print "tokens:%s" % str(tokens)
            print "remainder:%s" % remainder
            raise TokenizerException

        tokens = [token if not ascii else asciize(token[1]) \
                    for token  in tokens]
        return tokens
コード例 #3
0
ファイル: base.py プロジェクト: python-recsys/nl_ptools
 def tokenize(cls, text, ascii=False):
     tokens, remainder = cls.scanner.scan(text)
     if remainder:
         print "****input failed syntax*****"
         print "tokens:%s" % str(tokens)
         print "remainder:%s" % remainder
         raise TokenizerException
     include = ("WORD",)
     tokens = [t[1] if not ascii else asciize(t[1])
                 for t in tokens if t[0] in include]
     return tokens
コード例 #4
0
ファイル: classes.py プロジェクト: python-recsys/nl_ptools
    def tokenize(cls, text, ascii=False):
        tokens = sent_tokenize(text)

        tokens = [token if not ascii else asciize(token[1]) \
                    for token  in tokens]
        return tokens