text: import os
  
  from summariser.utils.writer import write_to_file
  from summariser.utils.corpus_reader import CorpusReader
  from resources import PROCESSED_PATH, LANGUAGE, CORENLP_PATH
  from summariser.utils.data_helpers import sent2stokens, sent2stokens_wostop
  from nltk.stem.snowball import SnowballStemmer
  from stanfordcorenlp import StanfordCoreNLP
  
  def writeNER(dataset):
      summary_len = 100
      reader = CorpusReader(PROCESSED_PATH)
      data = reader.get_data(dataset,summary_len)
      nlp = StanfordCoreNLP(CORENLP_PATH)
      base_path = os.path.join(PROCESSED_PATH,dataset)
  
      topic_cnt = 0
  
      for topic, docs, models in data:
          topic_cnt += 1
          topic_path = os.path.join(base_path,topic,'docs.ner')
          if not os.path.exists(topic_path):
              os.mkdir(topic_path)
          for dd in docs:
              dname = dd[0].split('/')[-1].strip()
              print('{} topic {}, doc {}'.format(topic_cnt,topic,dname))
              output = ''
              for sen in dd[1]:
                  ner = nlp.ner(sen)
                  output += repr(ner)+'\n'
              write_to_file(output,os.path.join(topic_path,dname))
  
      nlp.close()
  
  
  if __name__ == '__main__':
      ds = ['DUC2002']
      for dd in ds:
          print('\n==={}==='.format(dd))
          writeNER(dd)