텍스트 to 해시태그 생성기
모든 텍스트에서 관련 해시태그를 자동으로 생성합니다. 빈도 분석으로 키워드를 추출합니다.
자주 묻는 질문
코드 구현
import re
from collections import Counter
STOP_WORDS = {
"a","an","the","and","or","but","in","on","at","to","for","of","with",
"by","from","is","are","was","were","be","been","have","has","had",
"do","does","did","will","would","could","should","this","that","it",
"i","you","he","she","we","they","not","so","if","as","up","out",
"about","into","just","also","get","make","go","come","see","use"
}
def generate_hashtags(text, min_length=3, max_count=20, remove_stop=True):
words = re.findall(r"[a-z0-9']+", text.lower())
cleaned = [w.strip("'") for w in words if len(w.strip("'")) >= min_length]
if remove_stop:
cleaned = [w for w in cleaned if w not in STOP_WORDS]
freq = Counter(cleaned)
top = freq.most_common(max_count)
return [f"#{word}" for word, _ in top]
text = """Machine learning is transforming the software industry.
AI tools help developers write better code faster and improve productivity."""
hashtags = generate_hashtags(text)
print(" ".join(hashtags))Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.