analysis

package
v0.0.0-...-b7c488f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 21 Imported by: 2

Documentation

Overview

Package analysis provides measurements and analysis tools for queries.

Index

Constants

This section is empty.

Variables

View Source
var (
	BooleanFields           booleanFields
	BooleanKeywords         booleanKeywords
	BooleanClauses          booleanClauses
	BooleanNonAtomicClauses booleanNonAtomicClauses
	BooleanTruncated        booleanTruncated
	BooleanFieldsTitle      booleanFieldsTitle
	BooleanFieldsAbstract   booleanFieldsAbstract
	BooleanFieldsMeSH       booleanFieldsMeSH
	BooleanFieldsOther      booleanFieldsOther
	BooleanAndCount         booleanAndCount
	BooleanOrCount          booleanOrCount
	BooleanNotCount         booleanNotCount
)
View Source
var (
	MeshKeywordCount     = meshKeywordCount{}
	MeshExplodedCount    = meshExplodedCount{}
	MeshNonExplodedCount = meshNonExplodedCount{}
	MeshAvgDepth         = meshAvgDepth{}
	MeshMaxDepth         = meshMaxDepth{}
)
View Source
var MeSHTree, _ = meshexp.Default()
View Source
var (
	// TermCount is a measurement that counts the number of terms in the query.
	TermCount = termCount{}
)

Functions

func ConceptMatchReachability

func ConceptMatchReachability(queries []pipeline.Query, protocols guru.Protocols, conceptsBinFile string, client metawrap.HTTPClient) (conceptReachabilityMapping map[string][]ConceptReachability, conceptsNotInTitle map[string]map[string]int, err error)

func ContainsMeshField

func ContainsMeshField(kw cqr.Keyword) bool

ContainsMeshField returns if a keyword query contains a mesh heading field.

func ExplodedKeywords

func ExplodedKeywords(r cqr.CommonQueryRepresentation) (exploded []cqr.Keyword)

ExplodedKeywords gets the keywords in the query that are exploded.

func KeywordsWithField

func KeywordsWithField(r cqr.CommonQueryRepresentation, f string) (k []cqr.Keyword)

MeshKeywords extracts all keywords which have a particular field.

func MeshExplodedKeywords

func MeshExplodedKeywords(r cqr.CommonQueryRepresentation) (exploded []cqr.Keyword)

MeshExplodedKeywords extracts all mesh heading keywords that are exploded.

func MeshNonExplodedKeywords

func MeshNonExplodedKeywords(r cqr.CommonQueryRepresentation) (exploded []cqr.Keyword)

MeshExplodedKeywords extracts all mesh heading keywords that are not exploded.

func MetaMapScoreDistributions

func MetaMapScoreDistributions(queries []pipeline.Query, protocols guru.Protocols, client metawrap.HTTPClient) (inQuery map[string][]float64, notInQuery map[string][]float64, err error)

func QueryBooleanClauseCount

func QueryBooleanClauseCount(r cqr.CommonQueryRepresentation, operator string) (n int)

QueryBooleanClauses extracts all of the clauses from a Boolean query, recursively.

func QueryBooleanClauses

func QueryBooleanClauses(r cqr.CommonQueryRepresentation) (children []cqr.BooleanQuery)

QueryBooleanClauses extracts all of the clauses from a Boolean query, recursively.

func QueryBooleanQueries

func QueryBooleanQueries(r cqr.CommonQueryRepresentation) (children []cqr.BooleanQuery)

QueryBooleanQueries extracts all of the sub-queries from a Boolean query, recursively.

func QueryFields

func QueryFields(r cqr.CommonQueryRepresentation) (fields []string)

QueryFields extracts the fields from a query.

func QueryFieldsOfField

func QueryFieldsOfField(r cqr.CommonQueryRepresentation, field string) (fields int)

QueryFields extracts the fields from a query.

func QueryKeywords

func QueryKeywords(r cqr.CommonQueryRepresentation) (keywords []cqr.Keyword)

QueryKeywords extracts the keywords from a query.

func QueryTerms

func QueryTerms(r cqr.CommonQueryRepresentation) (terms []string)

QueryTerms extracts the terms from a query.

func TruncatedKeywords

func TruncatedKeywords(r cqr.CommonQueryRepresentation) (truncated []cqr.Keyword)

TruncatedKeywords gets the keywords in the query that are exploded.

Types

type ConceptReachability

type ConceptReachability struct {
	QueryCount, FieldCount int
	Overlap, OverlapRatio  float64
	Topic                  string
}

type DocumentOverlap

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

DocumentOverlap computes term overlap betweent the document and query.

func NewDocumentOverlapMeasurement

func NewDocumentOverlapMeasurement(document []string) DocumentOverlap

NewDocumentOverlapMeasurement creates an overlap measurement.

func (DocumentOverlap) Execute

Execute computes document overlap between query and document.

func (DocumentOverlap) Name

func (DocumentOverlap) Name() string

Name is the name for the document overlap measurement.

type KeywordReachability

type KeywordReachability struct {
	Title, Objectives, TypeOfStudy, Participants, IndexTests,
	TargetConditions, ReferenceStandards, Concepts int
	Topic string
}

func StringMatchReachability

func StringMatchReachability(queries []pipeline.Query, protocols guru.Protocols) []KeywordReachability

type Measurement

type Measurement interface {
	// Name is the name of the measurement in the output. It should not contain any spaces.
	Name() string
	// Execute computes the implemented measurement for a query and optionally using the specified statistics.
	Execute(q pipeline.Query, s stats.StatisticsSource) (float64, error)
}

Measurement is a representation for how a measurement fits into the pipeline.

type MeasurementCacher

type MeasurementCacher interface {
	Read(key string) ([]byte, error)
	Write(key string, val []byte) error
}

MeasurementCacher is a cache that can store the measurements for queries.

type MeasurementExecutor

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

MeasurementExecutor executes measurements while caching the results to improve performance.

func NewDiskMeasurementExecutor

func NewDiskMeasurementExecutor(d *diskv.Diskv) MeasurementExecutor

NewDiskMeasurementExecutor creates a measurement executor that caches to disk.

func NewMemoryMeasurementExecutor

func NewMemoryMeasurementExecutor() MeasurementExecutor

NewMemoryMeasurementExecutor creates a measurement executor that caches to memory.

func (MeasurementExecutor) Execute

func (m MeasurementExecutor) Execute(query pipeline.Query, ss stats.StatisticsSource, measurements ...Measurement) ([]float64, error)

Execute executes the specified measurements on the query using the statistics source.

type MemoryMeasurementCache

type MemoryMeasurementCache map[string][]byte

MemoryMeasurementCache caches measurement results in memory.

func (MemoryMeasurementCache) Read

func (m MemoryMeasurementCache) Read(key string) ([]byte, error)

Read reads a measurement result from memory.

func (MemoryMeasurementCache) Write

func (m MemoryMeasurementCache) Write(key string, val []byte) error

Write writes a measurement result to memory.

type QueryComplexity

type QueryComplexity struct{}

QueryComplexity is a measure of how "complex" a Boolean query is. It takes into account the number of keywords and Boolean queries in each of the top-level sub-contexts, with relation to the number of sub-contexts, and the size of the context (or query as a whole).

func (QueryComplexity) Execute

Execute computes query complexity.

func (QueryComplexity) Name

func (qc QueryComplexity) Name() string

Name is QueryComplexity

Directories

Path Synopsis
Package postqpp implements post-retrieval query performance predictors, reproducing the Java API from https://github.com/lucene4ir/lucene4ir (where applicable)
Package postqpp implements post-retrieval query performance predictors, reproducing the Java API from https://github.com/lucene4ir/lucene4ir (where applicable)
Package preqpp implements pre-retrieval query performance predictors, reproducing the Java API from https://github.com/lucene4ir/lucene4ir (where applicable)
Package preqpp implements pre-retrieval query performance predictors, reproducing the Java API from https://github.com/lucene4ir/lucene4ir (where applicable)
Package probability provides abstractions for how to compute how precision and recall is affected by measurements.
Package probability provides abstractions for how to compute how precision and recall is affected by measurements.

Jump to

Keyboard shortcuts

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