extractor

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package extractor provides routines to extract token features for the solidify toolchain from a standard metadata JSON files or token feature maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeFeatures

func EncodeFeatures(fMaps []FeaturesMap, fTypes []types.FeatureGroup) ([][]uint8, error)

EncodeFeatures converts FeatureMaps into uint slices where each element corresponds to the index at which the respective feature (type and value) appears in the feature groups list.

func ExtractFeatureGroups

func ExtractFeatureGroups(fMaps []FeaturesMap) []types.FeatureGroup

ExtractFeatureGroups retrieves groups of features (types with their different values) from a given set of FeaturesMaps.

Types

type FeaturesMap

type FeaturesMap = map[string]string

A FeaturesMap maps feature types to values, defining a token. e.g. Background -> Black, Body -> Robot, etc.

func LoadAndParseFeatureJSON

func LoadAndParseFeatureJSON(path string) ([]FeaturesMap, error)

LoadAndParseFeatureJSON loads the features from a JSON file at a given path and parses the content into a list of FeaturesMap.

func ParseFeaturesJSON

func ParseFeaturesJSON(r io.Reader) ([]FeaturesMap, error)

ParseFeaturesJSON parses features from a JSON schema into a list of FeatureMaps. e.g. JSON = `[{"Body": "Robot"},{"Body": "Alien"}]`

Jump to

Keyboard shortcuts

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