textanalytics

package
v0.0.0-...-7278ba6 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: CC0-1.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TopicDetectionStateMonitor

func TopicDetectionStateMonitor(updateInterval time.Duration) chan<- State

TopicDetectionStateMonitor updates the state of a topic detection operation based on a given update interval

Types

type MatchResult

type MatchResult struct {
	Matches  int
	Expected int
	Score    int
}

MatchResult holds the results of a actual vs expected key phrase matches

type Resource

type Resource struct {
	OperationID               string
	OperationProcessingResult models.OperationProcessingResult
	ErrCount                  int
}

Resource contains information about an API operation

func (*Resource) Sleep

func (r *Resource) Sleep(done chan<- *Resource)

Sleep induces a waiting period (with added error buffer) before moving the resource to a different state

type State

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

State holds the state of a topic detection operation

type TextAnalyzer

type TextAnalyzer struct {
	*textAnalyticsClient.TextAnalytics
	TextAnalyticsAPIKey string
	OperationResource   *Resource
	ControlKeyMapping   []map[string]string
}

TextAnalyzer is used to make all API calls and embeds the generated API client type

func New

func New(textAnalyticsAPIKey string) *TextAnalyzer

New generates a new TextAnalyzer with the Default text analytics client type

func (*TextAnalyzer) DetectComponentKeyPhrases

func (ta *TextAnalyzer) DetectComponentKeyPhrases(components []types.Component) ([]*models.KeyPhraseBatchResultItemV2, error)

DetectComponentKeyPhrases submits all component narratives to the key phrases analysis API

func (*TextAnalyzer) DetectComponentTopics

func (ta *TextAnalyzer) DetectComponentTopics(components []types.Component) (string, error)

DetectComponentTopics submits all component narratives to the topic detection API

func (*TextAnalyzer) DetectStandardKeyPhrases

func (ta *TextAnalyzer) DetectStandardKeyPhrases(standard types.NIST80053Standard) ([]*models.KeyPhraseBatchResultItemV2, error)

DetectStandardKeyPhrases submits the NIST 800-53 standard to the key phrases analysis API

func (*TextAnalyzer) PollTopicDetectionStatus

func (ta *TextAnalyzer) PollTopicDetectionStatus() string

PollTopicDetectionStatus polls the API for the status of a topic detection operation

func (*TextAnalyzer) TopicDetectionPoller

func (ta *TextAnalyzer) TopicDetectionPoller(in <-chan *Resource, out chan<- *Resource, status chan<- State)

TopicDetectionPoller initiates operation polling jobs

type Validation

type Validation struct {
	ComponentName string
	MatchResult   map[string]MatchResult
}

Validation is used to hold the result of a key phrase validation for a specific component

func ValidateKeyPhrases

func ValidateKeyPhrases(components []types.Component, standard types.NIST80053Standard, componentKeyPhraseResults []*models.KeyPhraseBatchResultItemV2, standardKeyPhraseResults []*models.KeyPhraseBatchResultItemV2) []Validation

ValidateKeyPhrases iterates through the analyzed component key phrases and NIST 800-53 key phrases, checks for matching strings and returns a map of the match results

** This function needs to be cleaned up since the structure of the loop is confusing

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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