pbtest

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package pbtest provides functions for testing ProtoBuf models.

Index

Constants

View Source
const NumRosesAreRedSentence = 4

NumRosesAreRedSentence is the expected number of sentences for RosesAreRed.

View Source
const RosesAreRed = `
Roses are red.
  Violets are blue.
Sugar is sweet.
  And so are you.
`

RosesAreRed is the text used as annotation input in model testing.

View Source
const RosesAreRedRespV360 = `` /* 5246-byte string literal not displayed */

RosesAreRedRespV360 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 3.6.0.

View Source
const RosesAreRedRespV400 = `` /* 10227-byte string literal not displayed */

RosesAreRedRespV400 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.0.0.

View Source
const RosesAreRedRespV410 = `` /* 7509-byte string literal not displayed */

RosesAreRedRespV410 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.1.0.

View Source
const RosesAreRedRespV420 = RosesAreRedRespV410

RosesAreRedRespV420 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.2.0.

It is the same as RosesAreRedRespV410.

View Source
const RosesAreRedRespV421 = RosesAreRedRespV410

RosesAreRedRespV421 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.2.1.

It is the same as RosesAreRedRespV410.

View Source
const RosesAreRedRespV430 = RosesAreRedRespV410

RosesAreRedRespV430 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.3.0.

It is the same as RosesAreRedRespV410.

View Source
const RosesAreRedRespV440 = `` /* 7509-byte string literal not displayed */

RosesAreRedRespV440 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.4.0.

View Source
const RosesAreRedRespV450 = RosesAreRedRespV440

RosesAreRedRespV450 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.5.0.

It is the same as RosesAreRedRespV440.

View Source
const RosesAreRedRespV452 = RosesAreRedRespV440

RosesAreRedRespV452 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.5.2.

It is the same as RosesAreRedRespV440.

View Source
const RosesAreRedRespV453 = RosesAreRedRespV440

RosesAreRedRespV453 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.5.3.

It is the same as RosesAreRedRespV440.

View Source
const RosesAreRedRespV455 = RosesAreRedRespV440

RosesAreRedRespV455 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.5.5.

It is the same as RosesAreRedRespV440.

View Source
const RosesAreRedRespV456 = `` /* 7590-byte string literal not displayed */

RosesAreRedRespV456 is the standard base64 (as defined in RFC 4648) encoded response of annotating RosesAreRed with the server default annotators by Stanford CoreNLP 4.5.6.

Variables

View Source
var (
	NumRosesAreRedSentenceTokenList   = [NumRosesAreRedSentence]int{4, 4, 4, 5}
	RosesAreRedSentenceTokenWordLists = [NumRosesAreRedSentence][]string{
		{"Roses", "are", "red", "."},
		{"Violets", "are", "blue", "."},
		{"Sugar", "is", "sweet", "."},
		{"And", "so", "are", "you", "."},
	}
	RosesAreRedSentenceTokenGapLists = [NumRosesAreRedSentence][]string{
		{"\n", " ", " ", "", "\n  "},
		{"\n  ", " ", " ", "", "\n"},
		{"\n", " ", " ", "", "\n  "},
		{"\n  ", " ", " ", " ", "", "\n"},
	}
	RosesAreRedSentenceTokenPosLists = [NumRosesAreRedSentence][]string{
		{"NNPS", "VBP", "JJ", "."},
		{"NNS", "VBP", "JJ", "."},
		{"NNP", "VBZ", "JJ", "."},
		{"CC", "RB", "VBP", "PRP", "."},
	}
)

Expected annotation results for RosesAreRed.

Functions

func CheckRosesAreRedDocument added in v0.5.2

func CheckRosesAreRedDocument(doc Document) (err error)

CheckRosesAreRedDocument examines whether the annotation in doc is that of RosesAreRed.

func CheckRosesAreRedDocumentFromBase64 added in v0.5.2

func CheckRosesAreRedDocumentFromBase64(base64String string, doc Document) (
	err error)

CheckRosesAreRedDocumentFromBase64 decodes base64String to doc and then examines whether the annotation in doc is that of RosesAreRed.

func CheckRosesAreRedText added in v0.5.2

func CheckRosesAreRedText(getter TextGetter) error

CheckRosesAreRedText examines whether the text returned by getter.GetText is the same as RosesAreRed.

It reports an error if getter is nil or the text returned by getter.GetText is different from RosesAreRed.

func DecodeBase64ToPb

func DecodeBase64ToPb(base64String string, msg proto.Message) error

DecodeBase64ToPb decodes the standard base64 (as defined in RFC 4648) encoded CoreNLP server response body into a ProtoBuf message.

Types

type Document

type Document interface {
	proto.Message
	TextGetter
	GetDocID() string
}

Document combines interfaces proto.Message and TextGetter, and a method GetDocID.

The client should only pass the document structure to this type of parameter. Functions in this package may call the document's GetSentence method through reflection.

type TextGetter

type TextGetter interface {
	GetText() string
}

TextGetter wraps the method GetText.

Jump to

Keyboard shortcuts

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