Use more efficient use of regexes for Twitter hashtag normalization
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user