|  | # Cheshire3 Objects: Extractor

## Description

An Extractor is a processing object called by an Index with the value of an evaluated XPath expression or with a string. Example normalizers might extract keywords from an element or the entire contents thereof as a single string. Extractors must also be used on the query terms to apply the same keyword processing rules, for example.

## Implementations

The following implementations are pre-configured and ready to use by getting the object from a Server. They may be used out-of-the-box in configurations for Indexes, Workflows etc.

- SimpleExtractor
  Extracts the exact text from the data given to it.
  HINT: if you want to extract keywords rather than the exact text, you should use this first then the next step is to use a Tokenizer.
- ProxExtractor
  Extracts the exact text from the data given to it, and maintains the location of each piece of text within the source record.
- TeiExtractor
  Extracts text encoded in TEI from the data given to it.

## API

Module: cheshire3.extractor
Classes:

- SimpleExtractor
  Base Extractor class. Extracts the exact text from the data given to it.
- TeiExtractor
  Extracts text encoded in TEI from the data given to it.
- SpanXPathExtractor
  Extracts the exact text between a pair of XPaths, e.g. milestone tags. This can only be used on the result of a SpanXPathSelector.

Methods:

Function | Parameters | Returns | Description
--- | --- | --- | ---
__init__ | config, parent |  |
process_string | session, string | hash | Process a raw string, e.g. from an attribute value
process_node | session, domNode | hash | Process a DOM node
process_eventList | session, list of SAX events | hash | Process a list of SAX events
process_xpathResult | session, xpathResult | hash | Process the result returned by a configured XPath Selector object (historically Cheshire3 only dealt with XPath selectors, hence the name.) Convenience function to wrap the other process_* functions and do type checking.

### Sub-Packages

Sub-Package: graph
Module: cheshire3.graph.extractor
Classes:

- RdfExtractor
  Extracts text from a node of an RDF graph (i.e. the result of a SparqlSelector on a GraphRecord.)