Documentation ¶
Overview ¶
Package pbtest provides functions for testing ProtoBuf models.
Index ¶
- Constants
- Variables
- func CheckRosesAreRedDocument(doc Document) (err error)
- func CheckRosesAreRedDocumentFromBase64(base64String string, doc Document) (err error)
- func CheckRosesAreRedText(getter TextGetter) error
- func DecodeBase64ToPb(base64String string, msg proto.Message) error
- type Document
- type TextGetter
Constants ¶
const NumRosesAreRedSentence = 4
NumRosesAreRedSentence is the expected number of sentences for RosesAreRed.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 ¶
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
CheckRosesAreRedDocument examines whether the annotation in doc is that of RosesAreRed.
func CheckRosesAreRedDocumentFromBase64 ¶ added in v0.5.2
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.
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.