mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			minimum hashtag length for guessing
							parent
							
								
									0ae87b671c
								
							
						
					
					
						commit
						a088d4dde2
					
				| 
						 | 
				
			
			@ -262,11 +262,11 @@ def set_hashtag_category(base_dir: str, hashtag: str, category: str,
 | 
			
		|||
    return False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def guess_hashtag_category(tagName: str, hashtag_categories: {}) -> str:
 | 
			
		||||
def guess_hashtag_category(tag_name: str, hashtag_categories: {}) -> str:
 | 
			
		||||
    """Tries to guess a category for the given hashtag.
 | 
			
		||||
    This works by trying to find the longest similar hashtag
 | 
			
		||||
    """
 | 
			
		||||
    if len(tagName) < 4:
 | 
			
		||||
    if len(tag_name) < 6:
 | 
			
		||||
        return ''
 | 
			
		||||
 | 
			
		||||
    category_matched = ''
 | 
			
		||||
| 
						 | 
				
			
			@ -274,12 +274,12 @@ def guess_hashtag_category(tagName: str, hashtag_categories: {}) -> str:
 | 
			
		|||
 | 
			
		||||
    for category_str, hashtag_list in hashtag_categories.items():
 | 
			
		||||
        for hashtag in hashtag_list:
 | 
			
		||||
            if len(hashtag) < 4:
 | 
			
		||||
            if len(hashtag) < 6:
 | 
			
		||||
                # avoid matching very small strings which often
 | 
			
		||||
                # lead to spurious categories
 | 
			
		||||
                continue
 | 
			
		||||
            if hashtag not in tagName:
 | 
			
		||||
                if tagName not in hashtag:
 | 
			
		||||
            if hashtag not in tag_name:
 | 
			
		||||
                if tag_name not in hashtag:
 | 
			
		||||
                    continue
 | 
			
		||||
            if not category_matched:
 | 
			
		||||
                tag_matched_len = len(hashtag)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue