UCSINFER for Renaming Sounds

After goofing around a bit with the ucsinfer gather and evaluate I’ve built out the recommend feature a bit.

Note 9/6/2025: This article was written around the time ucsinfer was at commit 1a42d7d9. There have been signififcant changes to the codebase since that time, including enhancements to the recommend feature, but it should still mostly work the way depicted here. Check the online documentation for all the latest updates.

Here’s the current help message:

ucsinfer recommend --help  
Usage: python -m ucsinfer recommend [OPTIONS] <paths>

  Infer a UCS category for a text description

  "Description" text metadata is extracted from audio files given as PATHS, or
  text can be provided directly using the "--text" option. The selected  model
  is then used to attempt to classify the given text according to  the
  synonyms and explanations definied for each UCS subcategory. A list  of
  ranked subcategories is printed to the terminal for each PATH.

Options:
  --text TEXT           Recommend a category for given text instead of reading
                        from a file
  --model <model-name>  Select the sentence_transformer model to use
                        [default: paraphrase-multilingual-mpnet-base-v2]
  -i, --interactive     After processing each path in <paths>, prompt for a
                        recommendation to accept, and then prepend the
                        selection to the file name.
  --help                Show this message and exit.

If you pass ucsinfer recommend some paths it will attempt to read the embedded description (or simply take the filename as a fallback), and then return the top 5 UCS categories given this.

ucsinfer recommend 's6010 Miscellaneous A, B, C/Alarm Bell SI6010_21.flac'  
----------
Path: s6010 Miscellaneous A, B, C/Alarm Bell SI6010_21.flac
Text: BELL, ALARM          ALARM BELL RINGING
- 0: BELLDoor (BELLS-DOORBELL)
- 1: ALRMBell (ALARMS-BELL)
- 2: ALRMMisc (ALARMS-MISC)
- 3: BELLAnml (BELLS-ANIMAL)
- 4: CLOCKChim (CLOCKS-CHIME)

recommend also has a file renaming option, which will allow you to pick a category off the list and prepend it to the file name.

ucsinfer recommend -i 's6010 Miscellaneous A, B, C/'*.flac  
----------
Path: s6010 Miscellaneous A, B, C/16mm Camera Running SI6010_52.flac
Text: CAMERA, MOVIE          16 MM: FILMING
- 0: COMCam (COMMUNICATIONS-CAMERA)
- 1: COMAv (COMMUNICATIONS-AUDIO VISUAL)
- 2: PFX (ARCHIVED-PFX)
- 3: SCNE (ARCHIVED-SCENE)
- 4: FOLYProp (FOLEY-PROP)
#, t [text], ?, q > 0
Renaming s6010 Miscellaneous A, B, C/16mm Camera Running SI6010_52.flac to s6010 Miscellaneous A, B, C/COMCam_16mm Camera Running SI6010_52.flac
----------
Path: s6010 Miscellaneous A, B, C/35mm Compact, Shot SI6010_47.flac
Text: CAMERA          COMPACT AUTOMATIC 35 MM: SINGLE SHOT AND AUTO WIND
- 0: COMCam (COMMUNICATIONS-CAMERA)
- 1: GUNAuto (GUNS-AUTOMATIC)
- 2: COMAv (COMMUNICATIONS-AUDIO VISUAL)
- 3: GUNRif (GUNS-RIFLE)
- 4: GUNTech (GUNS-HITECH)
#, t [text], ?, q > 0
Renaming s6010 Miscellaneous A, B, C/35mm Compact, Shot SI6010_47.flac to s6010 Miscellaneous A, B, C/COMCam_35mm Compact, Shot SI6010_47.flac
...

If the recommendations don’t contain the best category for the file, you can type t [words] to suggest alternatives based on [words]

ucsinfer recommend -i  's6010 Miscellaneous A, B, C/Halloween Music SI6010_91.flac'  
----------
Path: s6010 Miscellaneous A, B, C/Halloween Music SI6010_91.flac
Text: COMEDY, ACCENT          HALLOWEEN MUSIC, PERCUSSION
- 0: CRWDLaff (CROWDS-LAUGHTER)
- 1: MUSCPrfm (MUSICAL-PERFORMANCE)
- 2: MUSCMisc (MUSICAL-MISC)
- 3: TOONClang (CARTOON-CLANG)
- 4: CRWDSing (CROWDS-SINGING)
#, t [text], ?, q > t cartoon music
searching for new matches
----------
Path: s6010 Miscellaneous A, B, C/Halloween Music SI6010_91.flac
Text: cartoon music
- 0: TOONMx (CARTOON-MUSICAL)
- 1: TOONMisc (CARTOON-MISC)
- 2: TOONSqk (CARTOON-SQUEAK)
- 3: TOONVox (CARTOON-VOCAL)
- 4: TOONBoing (CARTOON-BOING)
#, t [text], ?, q > 0
Renaming s6010 Miscellaneous A, B, C/Halloween Music SI6010_91.flac to s6010 Miscellaneous A, B, C/TOONMx_Halloween Music SI6010_91.flac

You can read the previous article on this topic here: Category inference experiments with UCSINFER.