Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertEAJSON ¶
ConvertEAJSON converts the original ea-thesaurus.json file to a more convenient format.
The original uses a map[string][]map[string]string structure, where every map in the slice only has one key-value pair.
Types ¶
type Association ¶
type Association struct { *Entry // Reference to the associated entry. Count int // Number of times the association was found. Relation Tags // Relation type of the association (e.g. "antonym", "synonym") }
Association is a single word association in the thesaurus.
type Entry ¶
type Entry struct { Word string // The word. Associations []*Association // Associated words. Tags Tags // Tags (e.g. "noun", "verb", "color", "animal") }
Entry is a single entry in the thesaurus.
func (*Entry) AddAssociation ¶
AddAssociation adds an association to the entry (if it doesn't exist). If it does exist, the count is increased.
'word' is the associated word to add. 'count' is the number of times the association was found / the strength of the association. 'relTags' are tags that describe the relationship between the word and the association.
func (*Entry) SortAssociations ¶
func (e *Entry) SortAssociations()
SortAssociations sorts the associations by count.
type Tags ¶
type Tags []string
Tags is a list of tags.
type Thesaurus ¶
type Thesaurus struct { Entries []*Entry // All entries. ByWord map[string]*Entry // Entries by word. }
Thesaurus is a thesaurus.
func NewFromJSON ¶
NewFromJSON returns a new thesaurus from a json file.
func (*Thesaurus) Add ¶
Add adds a word to the thesaurus. If the word exists, the supplied tags are appended.
func (*Thesaurus) AddAssociation ¶
AddAssociation adds an association to the thesaurus.
'word' is the word to add the association to. 'association' is the associated word to add. 'count' is the number of times the association was found / the strength of the association. 'relTags' are tags that describe the relationship between the word and the association.