def tests_inspection(): word = 'あんぱん' assert InspectionWord.inspection(word) == False word = '死' assert InspectionWord.inspection(word) word = 'チンポには絶対に負けない(プラグ)なキャラと' assert InspectionWord.inspection(word) for x in range(10000): assert InspectionWord.inspection(word)
def run(self, word): if word is None: raise ValueError('word is None: python manage.py check --word="あいう"') # insert InspectionWord.register(INSPECTION_WORD) # ck if InspectionWord.inspection(word): print('True NGワードに該当') return if inspection_affiliate(word): print('True アフィチェックに該当') return print('False 該当せず')
def run(self, word): if word is None: raise ValueError( 'word is None: python manage.py check --word="あいう"') # insert InspectionWord.register(INSPECTION_WORD) # ck if InspectionWord.inspection(word): print('True NGワードに該当') return if inspection_affiliate(word): print('True アフィチェックに該当') return print('False 該当せず')
def self_check(self, r): """ 自己診断する """ # NGワード if InspectionWord.inspection(''.join(self.post_message_for_output)): self.set_cheap() # レス数の検知 if self.count_link > 1: self.set_cheap() return # 未来に向けたレス for res_num in self.res: if self.num <= res_num: self.set_cheap() else: # レスによる重み付け if res_num in r: parent = r[res_num] parent.res_from(self.num) self.set_i_am_child() else: print("NOT FOUND ERROR:{}".format(res_num)) # 画像かURL入っていたら除外 for x in self.post_message_for_output: if '://' in x: self.set_cheap() # postedに触っておく self.post_message
def self_check(self, r): """ 自己診断する """ # NGワード if InspectionWord.inspection(''.join(self.post_message_for_output)): self.set_cheap() # レス数の検知 if self.count_link > 1: self.set_cheap() return # 未来に向けたレス for res_num in self.res: if self.num <= res_num: self.set_cheap() else: # レスによる重み付け if res_num in r: parent = r[res_num] parent.res_from(self.num) self.set_i_am_child() else: print("NOT FOUND ERROR:{}".format(res_num)) # 画像かURL入っていたら除外 for x in self.post_message_for_output: if '://' in x: self.set_cheap() # postedに触っておく self.post_message
def is_enable(self): """ 出現数が一定以上のキーワードのみ有効 :return: bool """ # NGワードチェック if InspectionWord.inspection(self.keyword): return False return 4 <= self.count
def is_enable(self): """ 出現数が一定以上のキーワードのみ有効 :return: bool """ # NGワードチェック if InspectionWord.inspection(self.keyword): return False return 4 <= self.count
def run(self): InspectionWord.register(INSPECTION_WORD)
def init(self): # NGワードを再読み込み InspectionWord.register(INSPECTION_WORD)
def init(self): # NGワードを再読み込み InspectionWord.register(INSPECTION_WORD)