Public Member Functions
|ExtractorPostprocessor (const ExtractorPostprocessor &)=delete|
|ExtractorPostprocessor (ExtractorPostprocessor &&) noexcept|
|void||process (const QVector< QVariant > &data)|
|QVector< QVariant >||result () const|
|void||setContextDate (const QDateTime &dt)|
|void||setValidationEnabled (bool validate)|
Post-process extracted data to filter out garbage and augment data from other sources.
In detail, this performs the tasks listed below for all data elements fed into it.
Basic normalization for e.g. renamed properties of older schema.org versions is already covered by JsonLdImportFilter, post-processing covers the more elaborate normalization steps, such as:
- translate human readable and possibly localized country names into ISO 3166-1 codes.
- expand IATA BCBP ticket tokens (see IataParser).
That is, add additional information derived from a built-in knowledge base (see KnowledgeDb). This includes:
- Add timezone information to arrival and departure times.
- Add geo coordinates and country information to known airports or train stations.
Duplicate elements that might have been the result of two overlapping extractors (e.g. when extracting two different MIME parts of an email referring to the same reservation) are merged.
At this point, all invalid elements are discarded. The definition of invalid is fairly loose though, and typically only covers elements that are explicitly considered unusable. Examples:
- A Flight missing a departure day or destination.
- A LodigingReservation without an attached LodgingBusiness.
Validation can be disabled and done separately using KItinerary::ExtractorValidator, in case you want more control over which elements are considered valid. See setValidationEnabled().
Finally the remaining elements are sorted based on their relevant date (see SortUtil). This makes the data usable for basic display right away, but it for example doesn't do multi-traveler aggregation, that's still left for the display layer.
Definition at line 61 of file extractorpostprocessor.h.
Member Function Documentation
This will normalize and augment the given data elements and merge them with already added data elements if applicable.
Definition at line 87 of file extractorpostprocessor.cpp.
This returns the final result of all previously executed processing steps followed by sorting and filtering out all invalid data elements.
Definition at line 135 of file extractorpostprocessor.cpp.
|void ExtractorPostprocessor::setContextDate||(||const QDateTime &||dt||)|
The date the reservation(s) processed here have been made, if known.
This is used for determining the year of incomplete dates provided by various sources. Therefore this has to be somewhen before the reservation becomes due.
Definition at line 201 of file extractorpostprocessor.cpp.
Enable or disable validation.
By default this is enabled, and will discard all unknown types and incomplete items. If you need more control over this, disable this here and pass the items through ExtractorValidator yourself (or even use an entirely different validation mechanism entirely).
- See also
Definition at line 206 of file extractorpostprocessor.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 04:02:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.