This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#coding: utf8 | |
import re | |
import pymongo | |
import MeCab | |
sub_url = re.compile('(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)').sub | |
sub_user_hash = re.compile('(@|#)[a-zA-Z0-9_]+').sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from MeCab import Tagger | |
''' | |
Example: | |
>>> import MeCab | |
>>> import mecab_wakachi_patch.py | |
>>> m = Mecab.Tagger() | |
>>> m.wakachi('僕と契約して魔法少女になってよ') | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MethodMissing(object): | |
def __getattr__(self, name): | |
try: | |
return self.__getattribute__(name) | |
except AttributeError: | |
def method(*args, **kw): | |
return self.method_missing(name, *args, **kw) | |
return method | |
def method_missing(self, name, *args, **kw): |
NewerOlder