title: eliminating sub strings from super string
body: <p>I have a dictionary that has key as a string tuple and value as its frequency
  for eg</p>
  
  <pre><code> {('this','is'):2,('some','word'):3....}
  </code></pre>
  
  <p>I need to eliminate some key's that contains those subkey for eg:</p>
  
  <pre><code>d={('large','blue'):4,('cute','blue'):3,('large','blue','dog'):2,
    ('cute','blue','dog'):2,('cute','blue','elephant'):1}
  </code></pre>
  
  <p>I need to eliminate <code>('large','blue')</code> as it appears only in <code>'large blue dog'</code> however I cant remove 'cute blue' because it appears in <code>'cute blue dog'</code> and <code>'cute blue elephant'</code></p>
  
  <pre><code>d={('large','blue'):4,('cute','blue'):3,('large','blue','dog'):2,
  ('cute','blue','dog'):2,('cute','blue','elephant'):1}
  final_list=[]
  for k,v in d.items():
      final_list.append(' '.join(f for f in k))
  
  final_list=sorted(final_list, key=len,reverse=True)
  completed=set()
  for f in final_list:
      if not completed:
          completed.add(f)
      else:
          if sum(f in s for s in completed)==1:
              continue
  
  print(final_list)
  print(completed)
  </code></pre>
  
  <p>But this gives me only ['cute blue elephant'] I need </p>
  
  <pre><code>[large blue dog] :2
  [cute blue dog]:2
  [cute blue elephant]:1
  [cute blue]:3
  </code></pre>