Skip to content

Commit 31d2aba

Browse files
committed
Rename Answer to ExtractAnswer
1 parent be5ba0b commit 31d2aba

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

examples/questionanswering/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func main() {
3737

3838
fn := func(text string) error {
3939
start := time.Now()
40-
result, err := m.Answer(context.Background(), text, content, opts)
40+
result, err := m.ExtractAnswer(context.Background(), text, content, opts)
4141
if err != nil {
4242
return err
4343
}

pkg/client/client_questionanswering.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func NewClientForQuestionAnswering(target string, opts Options) questionanswerin
3232
}
3333
}
3434

35-
// Answer answers the given question.
36-
func (c *clientForQuestionAnswering) Answer(ctx context.Context, question, passage string, opts *questionanswering.Options) (questionanswering.Response, error) {
35+
// ExtractAnswer answers the given question.
36+
func (c *clientForQuestionAnswering) ExtractAnswer(ctx context.Context, question, passage string, opts *questionanswering.Options) (questionanswering.Response, error) {
3737
if opts == nil {
3838
opts = &questionanswering.Options{}
3939
}

pkg/server/apis/questionanswering/v1/questionanswering.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "google/api/annotations.proto";
77
option go_package = "github.com/nlpodyssey/cybertron/pkg/server/apis/questionanswering/v1;questionansweringv1";
88

99
service QuestionAnsweringService {
10-
rpc Answer(AnswerRequest) returns (AnswerResponse) {
10+
rpc ExtractAnswer(AnswerRequest) returns (AnswerResponse) {
1111
option (google.api.http) = {
1212
post: "/v1/answer"
1313
body: "*"

pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.gw.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/server/gen/proto/go/questionanswering/v1/questionanswering_grpc.pb.go

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/server/server_questionanswering.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func (s *serverForQuestionAnswering) RegisterHandlerServer(ctx context.Context,
3232
return questionansweringv1.RegisterQuestionAnsweringServiceHandlerServer(ctx, mux, s)
3333
}
3434

35-
// Answer handles the Answer request.
36-
func (s *serverForQuestionAnswering) Answer(ctx context.Context, req *questionansweringv1.AnswerRequest) (*questionansweringv1.AnswerResponse, error) {
35+
// ExtractAnswer handles the Answer request.
36+
func (s *serverForQuestionAnswering) ExtractAnswer(ctx context.Context, req *questionansweringv1.AnswerRequest) (*questionansweringv1.AnswerResponse, error) {
3737
params := req.GetOptions()
3838
opts := &questionanswering.Options{
3939
MaxAnswers: int(params.GetMaxAnswers()),
@@ -42,7 +42,7 @@ func (s *serverForQuestionAnswering) Answer(ctx context.Context, req *questionan
4242
MaxCandidates: int(params.GetMaxCandidates()),
4343
}
4444

45-
result, err := s.engine.Answer(ctx, req.GetQuestion(), req.GetPassage(), opts)
45+
result, err := s.engine.ExtractAnswer(ctx, req.GetQuestion(), req.GetPassage(), opts)
4646
if err != nil {
4747
return nil, err
4848
}

pkg/tasks/questionanswering/bert/questionanswering.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ func LoadQuestionAnswering(modelPath string) (*QuestionAnswering, error) {
5757
}, nil
5858
}
5959

60-
// Answer returns the answers for the given question and passage.
60+
// ExtractAnswer returns the answers for the given question and passage.
6161
// The options may assume default values if those are not set.
62-
func (qa *QuestionAnswering) Answer(_ context.Context, question string, passage string, opts *questionanswering.Options) (questionanswering.Response, error) {
62+
func (qa *QuestionAnswering) ExtractAnswer(_ context.Context, question string, passage string, opts *questionanswering.Options) (questionanswering.Response, error) {
6363
checkOptions(opts)
6464

6565
qt, pt := qa.tokenize(question, passage)

pkg/tasks/questionanswering/questionanswering.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var ErrInputSequenceTooLong = errors.New("input sequence too long")
2525

2626
// Interface defines the main functions for question-answering task.
2727
type Interface interface {
28-
Answer(ctx context.Context, question string, passage string, opts *Options) (Response, error)
28+
ExtractAnswer(ctx context.Context, question string, passage string, opts *Options) (Response, error)
2929
}
3030

3131
// Options defines the options for question-answering task.

0 commit comments

Comments
 (0)