def filter_corporation_tag(y, only_company=True):
  """Filter unnecessary labels. 
  
  Args:
      y (List of list of tag): 
      company_tag (False, optional): If false, return 3 kinds of types.
                                     If true, only return company type. 
                                     Defaults to False.

  Returns:
      [list of list of tag]: filted y
  """
  if isinstance(y, tuple):
      y = list(y)
  if only_company:
    company_tag_list = ['B-company', 'I-company']
  else:
    company_tag_list = ['B-corporation_other', 'I-corporation_other',
                    'B-company_group', 'I-company_group',
                    'B-company', 'I-company'] 

  for i, sample in enumerate(y):
      y[i] = ['O' if tag not in company_tag_list else tag for tag in sample]
  return y