cliff

package
v1.0.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2021 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package cliff provides an HTTP Client for Media Cloud CLIFF-CLAVIN geocoder.

It exposes only the minimum amount of functionalities, types, and fields useful for the default implementation of WhatsNew workers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for making requests to a Media Cloud CLIFF-CLAVIN geolocation server.

func NewClient

func NewClient(url string) *Client

NewClient creates a new Media Cloud CLIFF-CLAVIN Client.

func (*Client) ParseText

func (c *Client) ParseText(
	ctx context.Context,
	text string,
	demonyms bool,
	language Language,
) (_ *ParsedText, err error)

ParseText extracts entities from a given text.

type Focus

type Focus struct {
	Cities    []Location `json:"cities"`
	Countries []Location `json:"countries"`
	States    []Location `json:"states"`
}

The Focus extracted entities.

func (*Focus) AllLocations

func (f *Focus) AllLocations() []Location

AllLocations returns the union of Cities, Countries and States.

type Language

type Language string

A Language supported by CLIFF.

const (
	// German language.
	German Language = "DE"
	// Spanish language.
	Spanish Language = "ES"
	// English language.
	English Language = "EN"
)

func (Language) String

func (l Language) String() string

String returns the CLIFF string representation of the language.

type Location

type Location struct {
	CountryCode string  `json:"countryCode"`
	Score       float64 `json:"score"`
}

A Location extracted from text.

type ParsedText

type ParsedText struct {
	Results ParsedTextResults `json:"results"`
}

ParsedText is the result of parsing a text.

type ParsedTextResults

type ParsedTextResults struct {
	Places Places `json:"places"`
}

ParsedTextResults contains the data extracted from a text.

type Places

type Places struct {
	Focus Focus `json:"focus"`
}

The Places extracted from a text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL