gocite

package module
v0.0.0-...-785f5b9 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go Report Card GoDoc DOI

gocite

Go Package to provide some basic functions when working with CTS/CITE urns

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFirstIndex

func FindFirstIndex(work Work) (int, bool)

FindFirstIndex was returning the First.Index saved in a passage. This task is now fulfilled by GetFirstIndex Now, FindFirstIndex returns the lowest Passage.Index of the Passages in a Work, along with a bool whether it has found one. This is necessary for the first analysis of a work. For example in SortPassages.

func FindLastIndex

func FindLastIndex(work Work) (int, bool)

FindLastIndex was returning the Last.Index saved in a passage. This task is now fulfilled by GetLastIndex Now, FindLastIndex returns the highest Passage.Index of the Passages in a Work along with a bool whether it has found one. This is necessary for the first analysis of a work. For example in SortPassages.

func FindTextTokens

func FindTextTokens(p Passage) (index int, found bool)

FindTextTokens finds the analysis that contains txt tokens

func GetFirstIndex

func GetFirstIndex(work Work) (int, bool)

GetFirstIndex returns the Work.First.Index of given Work along with a bool whether it has found that index.

func GetIndexByID

func GetIndexByID(passageID string, work Work) (int, bool)

GetIndexByID searches for an ID in a given work and if found, returns its slice index in the Work.Passages slice (not the passage.Index) along with a bool indicating whether it has found the Passage

func GetLastIndex

func GetLastIndex(work Work) (int, bool)

GetLastIndex returns the Work.Last.Index of given Work along with a bool whether it has found that index.

func IsCITEURN

func IsCITEURN(URNString string) bool

IsCITEURN tests whether a string is a valid CITE URN

func IsCTSURN

func IsCTSURN(URNString string) bool

IsCTSURN tests whether a string is a valid CTSURN

func IsExemplarID

func IsExemplarID(URNString string) bool

IsExemplarID tests whether a CTSURN (string) points to the exemplar level

func IsRange

func IsRange(URNString string) bool

IsRange returns a boolean whether a CTS URN string is a range

func IsTextgroupID

func IsTextgroupID(URNString string) bool

IsTextgroupID tests whether a CTSURN (string) points to the textgroup level

func IsVersionID

func IsVersionID(URNString string) bool

IsVersionID tests whether a CTSURN (string) points to the version level

func IsWorkID

func IsWorkID(URNString string) bool

IsWorkID tests whether a CTSURN (string) points to the work level

func RReturnSubStr

func RReturnSubStr(cmd, s string) (string, error)

RReturnSubStr returns the substring identified by the reverse of @substr[n]. [n] is optional.

func ReturnSubStr

func ReturnSubStr(cmd, s string) (string, error)

ReturnSubStr returns the substring identified by @substr[n]. [n] is optional.

func WantSubstr

func WantSubstr(URNString string) bool

WantSubstr tests whether the passage part of a URN string refers to a substring

Types

type ArrayToken

type ArrayToken struct {
	Type        string
	CharRepres  []string
	IntRepres   []int
	BoolRepres  []bool
	FloatRepres []float64
}

ArrayToken is a container for tokens represented in an array.

type CTSURN

type CTSURN struct {
	ID, Base, Protocol, Namespace, Work, Passage string
	InValid                                      bool
}

CTSURN references text as explained in http://cite-architecture.org/ctsurn/ For a note on CTS citations see http://cite-architecture.github.io/cts_spec/

func SplitCTS

func SplitCTS(URNString string) CTSURN

SplitCTS splits a CTS URN string in its stem and the passage reference and returns it as a CTSURN

type Cite2Urn

type Cite2Urn struct {
	ID, Base, Protocol, Namespace, Collection, Object string
	InValid                                           bool
}

Cite2Urn implemented as outlined here http://cite-architecture.org/cite2urn/

func SplitCITE

func SplitCITE(URNString string) Cite2Urn

SplitCITE splits a Cite URN string in its stem and the passage reference and returns it as a Cite2Urn

type CiteVerb

type CiteVerb struct {
	ID, Summary, Subject, Object, InverseID string
}

CiteVerb implemented similar to https://github.com/cite-architecture/cite-verbs/blob/master/cite-collection/cite-verbs-data-draft.csv

type PassLoc

type PassLoc struct {
	Exists    bool
	PassageID string
	Index     int
}

PassLoc is a container for the ID and the Index of a Passage for First, Last, Prev, Next

type Passage

type Passage struct {
	PassageID  string
	Range      bool
	Analysis   []Tokenisation
	Index      int
	Prev, Next PassLoc
	ImageLinks []Triple
}

Passage is the smallest CTSNode

func GetFirst

func GetFirst(work Work) Passage

GetFirst returns the Passage that is the first in the passage slice in a given a Work (not the one saved as Work.First)

func GetLast

func GetLast(work Work) Passage

GetLast returns the Passage with the last index in the passage slice in a given a Work (not the one saved as Work.Last)

func GetNext

func GetNext(passageID string, work Work) Passage

GetNext returns the Passage after the Passage given the PassageID in given Work (not the next in the work.Passages slice)

func GetPassageByID

func GetPassageByID(passageID string, work Work) (Passage, error)

GetPassageByID returns a Passage given the PassageID in a given Work

func GetPassageByInd

func GetPassageByInd(sliceIndex int, work Work) (Passage, error)

GetPassageByInd returns the Passage at given Index in the Work.Passages slice (Not by Passage.Index)

func GetPrev

func GetPrev(passageID string, work Work) Passage

GetPrev returns the Passage previous to the given the PassageID in given a Work (not the next in the work.Passages slice)

type TextAndID

type TextAndID struct {
	ID, Text string
}

TextAndID is a container for a text-extract and its ID

func ExtractTextByID

func ExtractTextByID(ctsID string, work Work) ([]TextAndID, error)

ExtractTextByID extracts the textual information from a Passage or multiple Passages in a Work

type Textgroup

type Textgroup struct {
	TextgroupID string
	Works       []Work
}

Textgroup is a collection of works

type Tokenisation

type Tokenisation struct {
	ID            string
	Description   string
	DataStructure string
	Array         ArrayToken
}

Tokenisation is a container for different tokenisations of the same textual information

type Triple

type Triple struct {
	Subject, Verb, Object string
}

Triple is a Simple LinkedData-Triple implementation

type Work

type Work struct {
	WorkID      string
	Passages    []Passage
	Ordered     bool
	First, Last PassLoc
}

Work is a container for CTS passages that belong to the same work

func DelFirstPassage

func DelFirstPassage(work Work) (Work, error)

DelFirstPassage deletes the first Passage from a Work by changing the references

func DelLastPassage

func DelLastPassage(work Work) (Work, error)

DelLastPassage deletes the last Passage from a Work by changing the references

func DelPassage

func DelPassage(passageID string, work Work) (Work, error)

DelPassage deletes a Passage from a Work by changing the references

func InsertPassage

func InsertPassage(passage Passage, work Work) (Work, error)

InsertPassage inserts a Passage into a Work

func SortPassages

func SortPassages(work Work) (Work, error)

SortPassages sorts the Passages in the Work.Passages slice from First to Last according to their Passage.Index values empty Passages are not taken over

Jump to

Keyboard shortcuts

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