scholar

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 24 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DEFAULTADDRESS string = "localhost:50060"
)
View Source
const (
	ROOTWORD = "rootWord"
)

Variables

This section is empty.

Functions

func AggregatorInterceptor added in v0.0.4

func AggregatorInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

Types

type AggregatorService

type AggregatorService interface {
	WaitForHealthyState() bool
	CreateNewEntry(ctx context.Context) (pb.Aristarchos_CreateNewEntryClient, error)
	RetrieveEntry(ctx context.Context, request *pb.AggregatorRequest) (*pb.RootWordResponse, error)
	RetrieveRootFromGrammarForm(ctx context.Context, in *pb.AggregatorRequest) (*pb.FormsResponse, error)
	RetrieveSearchWords(ctx context.Context, in *pb.AggregatorRequest) (*pb.SearchWordResponse, error)
}

type AggregatorServiceClient

type AggregatorServiceClient struct {
	Impl AggregatorService
}

type AggregatorServiceImpl

type AggregatorServiceImpl struct {
	Elastic aristoteles.Client
	Index   string
	pb.UnimplementedAristarchosServer
}

func CreateNewConfig

func CreateNewConfig(ctx context.Context) (*AggregatorServiceImpl, error)

func (*AggregatorServiceImpl) CreateNewEntry

func (*AggregatorServiceImpl) Health

func (*AggregatorServiceImpl) RetrieveEntry

func (a *AggregatorServiceImpl) RetrieveEntry(ctx context.Context, request *pb.AggregatorRequest) (*pb.RootWordResponse, error)

func (*AggregatorServiceImpl) RetrieveRootFromGrammarForm added in v0.0.11

func (a *AggregatorServiceImpl) RetrieveRootFromGrammarForm(ctx context.Context, request *pb.AggregatorRequest) (*pb.FormsResponse, error)

func (*AggregatorServiceImpl) RetrieveSearchWords

func (a *AggregatorServiceImpl) RetrieveSearchWords(ctx context.Context, request *pb.AggregatorRequest) (*pb.SearchWordResponse, error)

type ClientAggregator

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

func NewClientAggregator

func NewClientAggregator(address string) (*ClientAggregator, error)

func (*ClientAggregator) CreateNewEntry

func (*ClientAggregator) Health

func (c *ClientAggregator) Health(ctx context.Context, request *pb.HealthRequest) (*pb.HealthResponse, error)

func (*ClientAggregator) RetrieveEntry

func (c *ClientAggregator) RetrieveEntry(ctx context.Context, request *pb.AggregatorRequest) (*pb.RootWordResponse, error)

func (*ClientAggregator) RetrieveRootFromGrammarForm added in v0.0.11

func (c *ClientAggregator) RetrieveRootFromGrammarForm(ctx context.Context, request *pb.AggregatorRequest) (*pb.FormsResponse, error)

func (*ClientAggregator) RetrieveSearchWords

func (c *ClientAggregator) RetrieveSearchWords(ctx context.Context, request *pb.AggregatorRequest) (*pb.SearchWordResponse, error)

func (*ClientAggregator) WaitForHealthyState

func (c *ClientAggregator) WaitForHealthyState() bool

type GrammaticalCategory added in v0.0.3

type GrammaticalCategory struct {
	Forms []GrammaticalForm `json:"forms"`
}

type GrammaticalForm added in v0.0.3

type GrammaticalForm struct {
	Word string `json:"word"`
	Rule string `json:"rule"`
}

type MockAggregatorService added in v0.0.11

type MockAggregatorService struct {
	mock.Mock
}

MockAggregatorService is a mock implementation of the AggregatorService interface

func (*MockAggregatorService) CreateNewEntry added in v0.0.11

CreateNewEntry is a mock implementation of the CreateNewEntry method

func (*MockAggregatorService) Health added in v0.0.11

Health is a mock implementation of the Health method

func (*MockAggregatorService) RetrieveEntry added in v0.0.11

func (m *MockAggregatorService) RetrieveEntry(ctx context.Context, request *pb.AggregatorRequest) (*pb.RootWordResponse, error)

RetrieveEntry is a mock implementation of the RetrieveEntry method

func (*MockAggregatorService) RetrieveRootFromGrammarForm added in v0.0.11

func (m *MockAggregatorService) RetrieveRootFromGrammarForm(ctx context.Context, in *pb.AggregatorRequest) (*pb.FormsResponse, error)

RetrieveRootFromGrammarForm is a mock implementation of the RetrieveRootFromGrammarForm method

func (*MockAggregatorService) RetrieveSearchWords added in v0.0.11

func (m *MockAggregatorService) RetrieveSearchWords(ctx context.Context, in *pb.AggregatorRequest) (*pb.SearchWordResponse, error)

RetrieveSearchWords is a mock implementation of the RetrieveSearchWords method

func (*MockAggregatorService) WaitForHealthyState added in v0.0.11

func (m *MockAggregatorService) WaitForHealthyState() bool

WaitForHealthyState checks the health of the service within a timeout period

type RootWordEntry

type RootWordEntry struct {
	RootWord       string                `json:"rootWord"`
	PartOfSpeech   string                `json:"partOfSpeech"` //  E.g., "verb", "noun", "participle"
	Translations   []string              `json:"translations"`
	UnaccentedWord string                `json:"unaccented"`
	Variants       []Variant             `json:"variants"`
	Categories     []GrammaticalCategory `json:"categories"`
}

func UnmarshalRootWordEntry

func UnmarshalRootWordEntry(data []byte) (RootWordEntry, error)

type Variant added in v0.0.12

type Variant struct {
	SearchTerm string `json:"searchTerm"`
	Score      int    `json:"score"`
}

Jump to

Keyboard shortcuts

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