Reader classes

Readers for the pke module.

class pke.readers.PreprocessedReader

Reader for preprocessed text.

class pke.readers.RawTextReader(language=None)

Reader for raw text.

read(text, spacy_model=None)

Read the input file and use spacy to pre-process.

Spacy model selection: By default this function will load the spacy model that is closest to the language parameter (‘fr’ language will load the spacy model linked to ‘fr’ or any ‘fr_core_web_*’ available model). In order to select the model that will be used please provide a preloaded model via the spacy_model parameter, or link the model you wish to use to the corresponding language code python3 -m spacy link spacy_model lang_code.

Parameters
  • text (str) – raw text to pre-process.

  • spacy_model (model) – an already loaded spacy model.

class pke.readers.Reader

Reader default class.

class pke.readers.SpacyDocReader

Minimal Spacy Doc Reader.