importer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportOPF

func ExportOPF(dict KindleDict) error

func ImportCollocations

func ImportCollocations(db *sql.DB, tableName string) error

func ImportThesaurus

func ImportThesaurus(db *sql.DB, tableName string) error

func LoadCollocationsChan

func LoadCollocationsChan() <-chan CollocationEntryWithErr

func LoadFrequencyChan

func LoadFrequencyChan() <-chan WordFrequencyOrError

func SlolexLoaderChan

func SlolexLoaderChan() <-chan SlolexLexicalEntryWithError

Types

type CandidateXML

type CandidateXML struct {
	Text  string `xml:",chardata"`
	Score string `xml:"score,attr"`
	S     struct {
		Text string `xml:",chardata"`
		ID   string `xml:"id,attr"`
	} `xml:"s"`
	Labels struct {
		Text string   `xml:",chardata"`
		La   []string `xml:"la"`
	} `xml:"labels"`
}

type CollocationEntryWithErr

type CollocationEntryWithErr struct {
	Entry CollocationXMLEntry
	Err   error
}

type CollocationXML

type CollocationXML struct {
	Text      string  `xml:",chardata"`
	Form      string  `xml:"form,attr"`
	Cluster   string  `xml:"cluster,attr"`
	Frequency float64 `xml:"frequency,attr"`
	LogDice   string  `xml:"logDice,attr"`
	Comp      []struct {
		Text     string `xml:",chardata"`
		Position string `xml:"position,attr"`
		Type     string `xml:"type,attr"`
		Sloleks  string `xml:"sloleks,attr"`
	} `xml:"comp"`
}

type CollocationXMLEntry

type CollocationXMLEntry struct {
	XMLName xml.Name `xml:"entry"`
	Text    string   `xml:",chardata"`
	Header  struct {
		Text        string `xml:",chardata"`
		LexicalUnit struct {
			Text string `xml:",chardata"`
			ID   string `xml:"id,attr"`
		} `xml:"lexical_unit"`
		Category string `xml:"category"`
		Measure  struct {
			Text   string `xml:",chardata"`
			Type   string `xml:"type,attr"`
			Source string `xml:"source,attr"`
		} `xml:"measure"`
	} `xml:"header"`
	Body struct {
		Text  string `xml:",chardata"`
		Sense struct {
			Text     string `xml:",chardata"`
			Gramrels struct {
				Text    string `xml:",chardata"`
				Gramrel []struct {
					Text         string `xml:",chardata"`
					Name         string `xml:"name,attr"`
					Collocations struct {
						Text        string          `xml:",chardata"`
						Collocation CollocationsXML `xml:"collocation"`
					} `xml:"collocations"`
				} `xml:"gramrel"`
			} `xml:"gramrels"`
		} `xml:"sense"`
	} `xml:"body"`
}

func LoadCollocations

func LoadCollocations() ([]CollocationXMLEntry, error)

func (CollocationXMLEntry) GetFrequentCollocations

func (ce CollocationXMLEntry) GetFrequentCollocations() [][]string

func (CollocationXMLEntry) Word

func (ce CollocationXMLEntry) Word() string

type CollocationsXML

type CollocationsXML []CollocationXML

func (CollocationsXML) Len

func (c CollocationsXML) Len() int

func (CollocationsXML) Less

func (c CollocationsXML) Less(i, j int) bool

func (CollocationsXML) Swap

func (c CollocationsXML) Swap(i, j int)

type GroupXML

type GroupXML struct {
	Text      string         `xml:",chardata"`
	Candidate []CandidateXML `xml:"candidate"`
}

type KindleDict

type KindleDict struct {
	Entries []KindleDictEntry `json:"entries"`
}

type KindleDictEntry

type KindleDictEntry struct {
	ID           int                   `json:"id"`
	Word         string                `json:"word"`
	Inflections  []string              `json:"inflections"`
	Synonyms     [][]KindleDictSynonym `json:"synonyms"`
	Scores       [][]float64           `json:"synScores"`
	Collocations [][]string            `json:"collocations"`
	Frequency    string                `json:"frequency"`
}

type KindleDictSynonym

type KindleDictSynonym struct {
	Word  string  `json:"word"`
	Score float64 `json:"score"`
}

func (KindleDictSynonym) FormatScore

func (kds KindleDictSynonym) FormatScore() string

func (KindleDictSynonym) ScoreNormalized

func (kds KindleDictSynonym) ScoreNormalized() float64

type SlolexFeat

type SlolexFeat struct {
	// <feat att="lema" val="Pierrov"/>
	Att   string `xml:"att,attr"`
	Value string `xml:"val,attr"`
}

type SlolexFormRepresentation

type SlolexFormRepresentation struct {
	Feats []SlolexFeat `xml:"feat"`
}

func (SlolexFormRepresentation) FindRepresentation

func (srf SlolexFormRepresentation) FindRepresentation() string

type SlolexLemma

type SlolexLemma struct {
	//   <Lemma>
	//     <feat att="zapis_oblike" val="Pierre"/>
	//     <feat att="naglašena_beseda_1" val="Pierrè"/>
	//   </Lemma>
	Feats []SlolexFeat `xml:"feat"`
}

func (SlolexLemma) FindLema

func (sl SlolexLemma) FindLema() string

type SlolexLexicalEntry

type SlolexLexicalEntry struct {
	Feats []SlolexFeat     `xml:"feat"`
	Lema  SlolexLemma      `xml:"Lemma"`
	Forms []SlolexWordForm `xml:"WordForm"`
}

func SlolexLoader

func SlolexLoader() ([]SlolexLexicalEntry, error)

func (SlolexLexicalEntry) FindFormRepresentations

func (sle SlolexLexicalEntry) FindFormRepresentations() [][]string

type SlolexLexicalEntryWithError

type SlolexLexicalEntryWithError struct {
	Entry SlolexLexicalEntry
	Err   error
}

type SlolexWordForm

type SlolexWordForm struct {
	Feats           []SlolexFeat               `xml:"feat"`
	Representations []SlolexFormRepresentation `xml:"FormRepresentation"`
}

func (SlolexWordForm) FindFormRepresentations

func (swf SlolexWordForm) FindFormRepresentations() []string

type ThesaurusEntry

type ThesaurusEntry struct {
	Text     string `xml:",chardata"`
	Headword struct {
		Text string `xml:",chardata"`
		ID   string `xml:"id,attr"`
	} `xml:"headword"`
	GroupsCore struct {
		Text  string     `xml:",chardata"`
		Group []GroupXML `xml:"group"`
	} `xml:"groups_core"`
	GroupsNear struct {
		Text  string     `xml:",chardata"`
		Group []GroupXML `xml:"group"`
	} `xml:"groups_near"`
}

func LoadThesaurus

func LoadThesaurus() ([]ThesaurusEntry, error)

type ThesaurusXML

type ThesaurusXML struct {
	XMLName        xml.Name         `xml:"base"`
	Text           string           `xml:",chardata"`
	Xsi            string           `xml:"xsi,attr"`
	SchemaLocation string           `xml:"schemaLocation,attr"`
	Entries        []ThesaurusEntry `xml:"entry"`
}

type Word

type Word [2]interface{}

type WordFrequency

type WordFrequency struct {
	Lemma        string
	PartOfSpeech string
	Frequency    float64
	Count        int
}

type WordFrequencyOrError

type WordFrequencyOrError struct {
	Entry WordFrequency
	Err   error
}

Jump to

Keyboard shortcuts

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