Use more efficient use of regexes for Twitter hashtag normalization

This commit is contained in:
BrokenEagle
2020-01-10 15:27:57 +00:00
parent 2eef73e8fe
commit 114637f594

View File

@@ -139,8 +139,9 @@ module Sources::Strategies
def normalize_tag(tag) def normalize_tag(tag)
COMMON_TAG_REGEXES.each do |rg| COMMON_TAG_REGEXES.each do |rg|
if tag.match(rg) norm_tag = tag.gsub(rg,"")
return tag.gsub(rg,"") if norm_tag != tag
return norm_tag
end end
end end
tag tag