Suspected Substring Tags

0

Please login or register to vote for this query.

(click on this box to dismiss)

Finds substring tags per http://meta.stackoverflow.com/questions/132756/add-detection-warning-of-and-tools-for-removal-reversal-of-sub-string-tags. For example, the tag [batch] is used about 3200 times, the tag [file] is used about 13,400 times, [batch-file] is used 2700 times, [batch] and [file] together is used 153 times, and [batch] [file] [batch-file] is used 15 times. Hyphens are optional in the concatenation.

Stack Overflow

Q&A for professional and enthusiast programmers

/*
go through all tags
  select a tag to test if it's a concatenation
    go through all tags 
      check if they're substrings of the tag
        add them to a list of substrings
      
    concatenate all substrings
      check if the concatenation forms the test tag
        add the set of tags to the list
        
go through the list of tag sets
  count all posts with each sub-tag individually
  count all posts with the concatenated tag
  count all posts with two or more of the sub-tags
  count all posts with two or more of the sub-tags and the concatenated tag

display table of results 
*/

-- Note: the following does not yet do the above.
-- I have no idea where to start, I'm just reading some sql tutorials
select t1.*, t2.*
  from tags t1
  join tags t2
    on t1.tagname = replace(t2.tagname,'-','')
  left outer join tagsynonyms ts
    on t1.tagname = targettagname
   and t2.tagname = sourcetagname
 where ts.id is null
   and t1.tagname <> t2.tagname
 order by t1.count + t2.count desc
        , t2.count desc
        , t1.count desc

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results