code: def del_doc(self, doc):
          
          if not self.index_writer:
              self.index_writer = self.index.writer()
          if not self.label_guesser_updater:
              self.label_guesser_updater = self.label_guesser.get_updater()
          logger.info("Removing doc from the index: %s" % doc)
          if doc.docid in self._docs_by_id:
              self._docs_by_id.pop(doc.docid)
          if isinstance(doc, str):
              # annoying case : we can't know which labels were on it
              # so we can't roll back the label guesser training ...
              self._delete_doc_from_index(self.index_writer, doc)
              return
          self._delete_doc_from_index(self.index_writer, doc.docid)
          self.label_guesser_updater.del_doc(doc)
docs: Delete a document