Documentation
¶
Overview ¶
package accessionnumbers provides methods for identifying and extracting accession numbers from arbitrary bodies of text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Definition ¶
type Definition struct {
// The name of the organization associated with this definition.
OrganizationName string `json:"organization_name"`
// The URI of the organization associated with this definition.
OrganizationURL string `json:"organization_url"`
// A valid URI template (RFC 6570) used to generate the URI for an object given its accession number.
ObjectURITemplate string `json:"object_url,omitempty"`
// A valid URI template (RFC 6570) used to generate the IIIF manifest URI for an object given its accession number.
IIIFManifestTemplate string `json:"iiif_manifest,omitempty"`
// A valid URI template (RFC 6570) used to generate an OEmbed profile URI for an object given its accession number.
OEmbedProfileTemplate string `json:"oembed_profile,omitempty"`
// A valid Who's On First ID representing the organization.
WhosOnFirstId int64 `json:"whosonfirst_id,omitempty"`
// The set of patterns used to identify and extract accession numbers associated with an organization.
Patterns []*Pattern `json:"patterns"`
}
type Definition provides a struct containing accession number patterns and URIs for an organization.
func (*Definition) IIIFManifestURI ¶ added in v0.0.6
func (def *Definition) IIIFManifestURI(accession_number string) (string, error)
IIIFManifestURI returns a IIIF manifest URI for accession_number, assuming a corresponding URI template exists in def.
func (*Definition) OEmbedProfileURI ¶ added in v0.0.6
func (def *Definition) OEmbedProfileURI(accession_number string) (string, error)
IIIFManifestURI returns an OEmbed profile URI for accession_number, assuming a corresponding URI template exists in def.
type Match ¶
type Match struct {
// The accession number found in a body of text.
AccessionNumber string `json:"accession_number"`
// The URL of the organization that the accession number is associated with. Wherever possible this should match the `OrganizationURL` property in a `Defintion` struct.
OrganizationURL string `json:"organization,omitempty"`
}
type Match provides a struct containing accession number details found in a body of text.
func ExtractFromText ¶
func ExtractFromText(text string, defs ...*Definition) ([]*Match, error)
Extract a list of accession numbers (as `Match` instances) from text, using regular expressions defined in defs.
func ExtractFromTextWithDefinition ¶
func ExtractFromTextWithDefinition(text string, def *Definition) ([]*Match, error)
Extract a list of accession numbers (as `Match` instances) from text, using regular expressions defined in def.
type Pattern ¶
type Pattern struct {
// The name or label for a given pattern.
Label string `json:"label"`
// A valid regular expression string.
Pattern string `json:"pattern"`
// A dictionary containing zero or more tests for validating `Pattern`. Keys contain text to extract accession numbers from and values are the list of accession numbers expected to be found in the text, in the order that they are found.
Tests map[string][]string `json:"tests"`
}
type Pattern provides a struct containing patterns and tests for one or more accession numbers.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
flatten-definition
command
flatten-definition is a tool to "flatten" a valid sfomuseum/accession-numbers definition file in to a string that can be copy-pasted in to an (AWS) Lambda environment variable field.
|
flatten-definition is a tool to "flatten" a valid sfomuseum/accession-numbers definition file in to a string that can be copy-pasted in to an (AWS) Lambda environment variable field. |
|
twilio-handler
command
twilio-handler provides an HTTP server to listen for and respond to Twilio-style webhook URLs.
|
twilio-handler provides an HTTP server to listen for and respond to Twilio-style webhook URLs. |
