pimlico.datatypes.documents module¶
Document types used to represent datatypes of individual documents in an IterableCorpus or subtype.
-
class
DataPointType
(options, metadata)[source]¶ Bases:
object
Base data-point type for iterable corpora. All iterable corpora should have data-point types that are subclasses of this.
-
input_module_options
= {}¶
-
formatters
= []¶ List of (name, cls_path) pairs specifying a standard set of formatters that the user might want to choose from to view a dataset of this type. The user is not restricted to this set, but can easily choose these by name, instead of specifying a class path themselves. The first in the list is the default used if no formatter is specified. Falls back to DefaultFormatter if empty
-
-
class
RawDocumentType
(options, metadata)[source]¶ Bases:
pimlico.datatypes.documents.DataPointType
Base document type. All document types for tarred corpora should be subclasses of this.
It may be used itself as well, where documents are just treated as raw data, though most of the time it will be appropriate to use subclasses to provide more information and processing operations specific to the datatype.
The
process_document()
method produces a data structure in the internal format appropriate for the data point type.# A problem
If a subclassed type produces an internal data structure that does not work as a sub-type (using duck-typing-style inheritance principles) of its parent type, we can run into problems. See [this comment](https://github.com/markgw/pimlico/issues/1#issuecomment-383620759) for discussion of a solution to be introduced.
I therefore am not going to solve this now: you just need to work around it.
-
class
RawTextDocumentType
(options, metadata)[source]¶ Bases:
pimlico.datatypes.documents.TextDocumentType
Subclass of TextDocumentType used to indicate that the text hasn’t been processed (tokenized, etc). Note that text that has been tokenized, parsed, etc does not used subclasses of this type, so they will not be considered compatible if this type is used as a requirement.