vocabulary

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gnostic_vocabulary provides operation for Vocabulary structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference(vocabularies []*metrics.Vocabulary) *metrics.Vocabulary

Difference implements the difference operation between multiple Vocabularies. The function accepts a slice of Vocabularies and returns a single Vocabulary struct which that contains words that were unique to the first Vocabulary in the slice.

func FilterCommon

func FilterCommon(v []*metrics.Vocabulary) *metrics.VocabularyList

FilterCommon implements the difference operation amongst a slice of Vocabularies. The function returns a slice of Vocabularies that contains the unique terms for each pb file.

func GatherFilesFromDirectory added in v0.5.2

func GatherFilesFromDirectory(directory string) ([]string, error)

GatherFilesFromDirectory takes a directory path as input and returns all of the file paths within the directory that contain the "vocabulary.pb" file.

func Intersection

func Intersection(vocabSlices []*metrics.Vocabulary) *metrics.Vocabulary

Intersection implements the intersection operation between multiple Vocabularies. The function accepts a slice of Vocabularies and returns a single Vocabulary struct which that contains words that were found in all of the Vocabularies.

func NewVocabularyFromDiscovery added in v0.5.2

func NewVocabularyFromDiscovery(document *discovery_v1.Document) *metrics.Vocabulary

NewVocabularyFromDiscovery collects the vocabulary of a Discovery document.

func NewVocabularyFromOpenAPIv2

func NewVocabularyFromOpenAPIv2(document *openapi_v2.Document) *metrics.Vocabulary

func NewVocabularyFromOpenAPIv3

func NewVocabularyFromOpenAPIv3(document *openapi_v3.Document) *metrics.Vocabulary

func Union

func Union(vocabularies []*metrics.Vocabulary) *metrics.Vocabulary

Union implements the union operation between multiple Vocabularies. The function accepts a slice of Vocabularies and returns a single Vocabulary struct which contains all of the data from the Vocabularies.

func Version added in v0.5.2

func Version(v []*metrics.Vocabulary, versionNames []string, directory string) *metrics.VersionHistory

Version implements the difference and union operation amongst a list of vocabularies that represent different versions of the same API. This function utilizes the VersionHistory proto struct, and creates a new version struct for each comparison between vocabularies.

func WriteCSV

func WriteCSV(v *metrics.Vocabulary, filename string) error

WriteCSV converts a Vocabulary pb file to a user-friendly readable CSV file. The format of the CSV file is as follows: "group","word","frequency"

func WritePb

func WritePb(v *metrics.Vocabulary) error

WritePb create a protocol buffer file that contains the wire-format encoding of a Vocabulary struct.

func WriteVersionHistory added in v0.5.2

func WriteVersionHistory(v *metrics.VersionHistory, directory string) error

WriteVersionHistory create a protocol buffer file that contains the wire-format encoding of a VersionHistory struct.

func WriteVocabularyList added in v0.5.2

func WriteVocabularyList(v *metrics.VocabularyList) error

WriteVocabularyList create a protocol buffer file that contains the wire-format encoding of a VocabularyList struct.

Types

type Vocabulary added in v0.5.2

type Vocabulary struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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