latin

package
v0.0.2-beta2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package latin provides types and a client for the Perseus Latin morphology API.

Index

Constants

View Source
const APIBase = "http://www.perseus.tufts.edu/hopper/xmlmorph?lang=la&lookup="

Variables

This section is empty.

Functions

This section is empty.

Types

type Analysis

type Analysis struct {
	Form         string `xml:"form"`
	Lemma        string `xml:"lemma"`
	ExpandedForm string `xml:"expandedForm"`
	Pos          string `xml:"pos"`
	Number       string `xml:"number"`
	Gender       string `xml:"gender"`
	Case         string `xml:"case"`
	Dialect      string `xml:"dialect"`
	Feature      string `xml:"feature"`
	Person       string `xml:"person"`
	Tense        string `xml:"tense"`
	Mood         string `xml:"mood"`
	Voice        string `xml:"voice"`
}

Analysis stores one morphological interpretation of a Latin word.

func (Analysis) String

func (a Analysis) String() string

String returns a human-readable representation of the analysis.

type Definition

type Definition struct {
	PartOfSpeech string
	Glosses      []string
}

Definition holds a part-of-speech heading and its English glosses.

func LookupDefinitions

func LookupDefinitions(word string) (string, []Definition, error)

LookupDefinitions queries the Wiktionary REST API. If the word only contains inflected "form-of" definitions, it automatically resolves and looks up the base lemma instead. It returns the actual word looked up (which may be the lemma) and its definitions.

type Response

type Response struct {
	Analyses []Analysis `xml:"analysis"`
}

Response stores analyses on a Latin word.

func Lookup

func Lookup(word string) (Response, error)

Lookup queries the Perseus API for morphological analyses of word.

func LookupFile

func LookupFile(filePath string) (Response, error)

LookupFile parses morphological analyses from a local XML file.

Jump to

Keyboard shortcuts

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