Documentation ¶
Index ¶
- Variables
- func ResolveFilePath(filePath string) (dirname, filename, ext string, err error)
- type ID
- type IDList
- type IdMap
- type Idx
- func (tagsIndex *Idx) BinaryReadFrom(reader *binutils.BinaryReader) (err error)
- func (tagsIndex Idx) BinaryWriteTo(writer *binutils.BinaryWriter) (err error)
- func (tagsIndex Idx) Find(name TagName) (id TagID, found bool)
- func (tagsIndex Idx) Get(requiredIdx TagID) (foundItem Tag, found bool)
- func (tagsIndex *Idx) Index(name TagName, parent TagName) (id TagID)
- func (tagsIndex Idx) Len() int
- type Index
- type Node
- type NodeMap
- type Tag
- type TagID
- type TagName
- func (g *TagName) BinaryReadFrom(reader *binutils.BinaryReader) (err error)
- func (g TagName) BinaryWriteTo(writer *binutils.BinaryWriter) (err error)
- func (g TagName) MarshalBinary() (data []byte, err error)
- func (g TagName) String() string
- func (g *TagName) UnmarshalBinary(tagNameBytes []byte) error
- type TagSet
Constants ¶
This section is empty.
Variables ¶
var ErrIndex = errors.New("index")
ErrIndex identifies index-related errors.
var ( // Error indicates grammar-related errors. Error = errors.New("grammar") )
Functions ¶
func ResolveFilePath ¶
Types ¶
type Idx ¶
type Idx []Tag
Idx implements Tag index routines.
func (*Idx) BinaryReadFrom ¶
func (tagsIndex *Idx) BinaryReadFrom(reader *binutils.BinaryReader) (err error)
BinaryReadFrom reads Idx data using specified binutils.BinaryReader instance. Returns error if happens or nil. Implements binutils.BinaryReaderFrom.
func (Idx) BinaryWriteTo ¶
func (tagsIndex Idx) BinaryWriteTo(writer *binutils.BinaryWriter) (err error)
BinaryWriteTo writes Idx data using specified binutils.BinaryWriter instance. Returns error if happens or nil. Implements binutils.BinaryWriterTo.
func (Idx) Find ¶
Find returns indexed ID by known name and parent. Returns false found indicator if no such indexed found.
func (Idx) Get ¶
Get returns indexed from index using its indexed ID. Returns found indexed or found indicator will false.
type Index ¶
type Index interface { // AddRunes adds runes sequence into index. // Returns final node filled with node data or error if add caused error. AddRunes([]rune) (Node, error) // AddString adds string word into index. // Returns final node or error if add caused error. AddString(word string) (node Node, err error) // FetchRunes lookups runes sequence in container. // If found returns final node or error if not found. FetchRunes([]rune) (Node, error) // FetchString lookups string in container. // If found returns final node or error if not found. FetchString(word string) (Node, error) // TagID returns index of grammeme specified by name and parent name. TagID(name TagName, parent TagName) TagID }
Index defines main dictionary interface.
type Node ¶
type Node interface { fmt.Stringer // TagSets returns node TagSet. TagSets() []TagSet // AddTagSet adds a new TagSet to node data. AddTagSet(newTagSet ...TagName) error // Word returns sequence of characters from root upto current node wrapped into string. Word() string }
Node implements container methods as well as node specific rune fetcher and parent resolver.
type NodeMap ¶
NodeMap provides mapping of runes to Node's.
func (NodeMap) BinaryWriteTo ¶
func (n NodeMap) BinaryWriteTo(writer *binutils.BinaryWriter) error
type Tag ¶
Tag implements storage for structured TagName's.
func (*Tag) BinaryReadFrom ¶
func (g *Tag) BinaryReadFrom(reader *binutils.BinaryReader) (err error)
BinaryReadFrom reads Tag data using specified binutils.BinaryReader instance. Returns error if happens or nil. Implements binutils.BinaryReaderFrom.
func (Tag) BinaryWriteTo ¶
func (g Tag) BinaryWriteTo(writer *binutils.BinaryWriter) (err error)
BinaryWriteTo writes Tag data using specified binutils.BinaryWriter instance. Returns error if happens or nil. Implements binutils.BinaryWriterTo.
type TagName ¶
type TagName string
TagName represents name of grammatical category. It uses exactly 4 ASCII characters to name categories. If TagName is shorter than 4 character is filled upto 4 with spaces.
const ( // EmptyTagName defines constant tag name to replace empty strings and distinct unfilled and empty cases. EmptyTagName TagName = "----" )
func (*TagName) BinaryReadFrom ¶
func (g *TagName) BinaryReadFrom(reader *binutils.BinaryReader) (err error)
func (TagName) BinaryWriteTo ¶
func (g TagName) BinaryWriteTo(writer *binutils.BinaryWriter) (err error)
BinaryWriteTo writes TagName data using specified binutils.BinaryWriter instance. Returns error if happens or nil. Implements binutils.BinaryWriterTo.
func (TagName) MarshalBinary ¶
MarshalBinary makes name bytes string representation. Always produces 4 bytes. EmptyTagName TagName name represents as 4 spaces.