code: def tag(ctx, model, cs, corpus, output):
      
      click.echo('chemdataextractor.dict.tag')
      tagger = CsDictCemTagger(model=model) if cs else CiDictCemTagger(model=model)
      for line in corpus:
          sentence = []
          goldsentence = []
          for t in line.split():
              token, tag = t.rsplit(u'/', 1)
              goldsentence.append((token, tag))
              sentence.append(token)
          if sentence:
              tokentags = tagger.tag(sentence)
              for i, tokentag in enumerate(tokentags):
                  goldtokentag = goldsentence[i]
                  if goldtokentag[1] not in {u'B-CM', u'I-CM'} and tokentag[1] in {u'B-CM', u'I-CM'}:
                      print(line)
                      print(tokentag[0])
  
              output.write(u' '.join(u'/'.join(tokentag) for tokentag in tagger.tag(sentence)))
              output.write(u'\n')
          else:
              output.write(u'\n')
docs: Tag chemical entities and write CHEMDNER annotations predictions file.