foley.index.taxonomy.resolver#

Resolve free tags/caption/labels to a UCS CatID (the EnvSound-UCS pipeline).

Staged precedence, highest wins (report 04 §5.3, [11 §3.1] — normalize heterogeneous labels onto UCS via mapping/synonym tables):

filename-parse > keyword/synonym > audioset-map > none

Matching is word-boundary aware (so "rain" matches “heavy rain” but not “brainstorm”), a subcategory hit outranks a category-name hit, and multi-word phrases outrank single tokens — with a deterministic table-order final tiebreak. The always-available default is this stdlib KeywordResolver; a richer CLAP zero-shot resolver (embed once, argmax over UCS label prompts, report 03 Part 2) can be dropped in behind the same TaxonomyResolver protocol.

Functions

resolve_catid(*[, tags, caption, ...])

Resolve inputs to a best UCS CatID by the staged precedence.

Classes

KeywordResolver(*[, table, audioset_map])

The default stdlib resolver — staged keyword/synonym/AudioSet resolution.

TaxonomyResolver(*args, **kwargs)

Resolve a SoundRecord to a UCS CatID.

class foley.index.taxonomy.resolver.KeywordResolver(*, table=None, audioset_map=None)[source]#

Bases: object

The default stdlib resolver — staged keyword/synonym/AudioSet resolution.

Zero heavy dependencies. Bind a different TaxonomyResolver (e.g. a future CLAP zero-shot resolver) by keyword injection to upgrade quality.

resolve(record)[source]#

Resolve a SoundRecord’s tags/caption/labels/uri.

Return type:

CatIdResolution

class foley.index.taxonomy.resolver.TaxonomyResolver(*args, **kwargs)[source]#

Bases: Protocol

Resolve a SoundRecord to a UCS CatID.

resolve(record)[source]#

Return the CatID resolution for record.

Return type:

CatIdResolution

foley.index.taxonomy.resolver.resolve_catid(*, tags=(), caption=None, audioset_labels=(), filename=None, table=None, audioset_map=None)[source]#

Resolve inputs to a best UCS CatID by the staged precedence.

Parameters:
Return type:

CatIdResolution

Returns:

A CatIdResolution (falsy when nothing resolved).