utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunks

func Chunks[T any](slice []T, chunkSize int) [][]T

Chunks splits a slice into chunks of the specified size

func ExtractDOI

func ExtractDOI(doi string) string

ExtractDOI extracts the DOI from a given DOI string, removing any prefixes.

func GetAnalysisPath

func GetAnalysisPath(ctx context.Context) (string, bool)

func GetRootDir

func GetRootDir(ctx context.Context) (string, bool)

func InvertAbstract

func InvertAbstract(abstractInvertedIndex *map[string][]int) string

InvertAbstract returns the string representation of an inverted abstract.

func InvertName

func InvertName(name string) string

InvertName inverts the name from "First Last" to "Last, First".

func Keep

func Keep[T any](options ...*T) *T

Keep returns the first non-nil option from the given list of options.

func KeepLongestSlice

func KeepLongestSlice[T any](a, b []T) []T

KeepLongestSlice returns the longest of two slices

func KeepLongestString

func KeepLongestString(a, b string) string

KeepLongestString returns the longest of two strings.

func Limit

func Limit[T any](slice []T, n int, compare func(a, b T) int) []T

func SetDefaultLogger

func SetDefaultLogger(verbose bool)

func WithRootDir

func WithRootDir(ctx context.Context, rootDir string) context.Context

func WrapText

func WrapText(text string, limit int) string

WrapText wraps the given text to a maximum line length of limit.

func Zip

func Zip[K any, V any](keys []K, values []V) iter.Seq2[K, V]

Types

type ContextKey

type ContextKey string

type FoldedString

type FoldedString string

func NewFoldedString

func NewFoldedString(s *string) *FoldedString

func (FoldedString) MarshalYAML

func (f FoldedString) MarshalYAML() (any, error)

Jump to

Keyboard shortcuts

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