Datamuse · Capability

Rhyme And Phonetics

Run with Naftiko

Capability Spec

rhyme-and-phonetics.yaml Raw ↑
apiVersion: capability.naftiko.dev/v1alpha1
kind: Capability
metadata:
  name: rhyme-and-phonetics
  provider: datamuse
  description: |
    Find rhymes, near-rhymes, homophones, consonant matches, and sounds-like
    candidates for a given word — the backbone of RhymeZone, songwriting and
    poetry tools, brand naming, and accessibility apps that need pronunciation
    or syllable data.
spec:
  uses:
    - sharedCapability: datamuse-shared
      operations: [getWords]
  preconditions:
    - description: Caller stays within the 100,000 requests/day free non-commercial quota or holds a commercial agreement.
  workflow:
    - step: queryPerfectRhymes
      operation: getWords
      parameters:
        rel_rhy: "{{ input.word }}"
        max: "{{ input.max | default(50) }}"
        md: "sr"
        ipa: "{{ input.ipa | default(0) }}"
    - step: queryNearRhymes
      when: "input.includeNear == true"
      operation: getWords
      parameters:
        rel_nry: "{{ input.word }}"
        max: "{{ input.max | default(50) }}"
        md: "sr"
    - step: queryHomophones
      when: "input.includeHomophones == true"
      operation: getWords
      parameters:
        rel_hom: "{{ input.word }}"
        max: 25
        md: "sr"
    - step: querySoundsLike
      when: "input.includeSoundsLike == true"
      operation: getWords
      parameters:
        sl: "{{ input.word }}"
        max: 25
        md: "sr"
  outputs:
    perfectRhymes: "{{ queryPerfectRhymes.body }}"
    nearRhymes: "{{ queryNearRhymes.body | optional }}"
    homophones: "{{ queryHomophones.body | optional }}"
    soundsLike: "{{ querySoundsLike.body | optional }}"
  governance:
    minPlan: free-non-commercial
    httpsRequired: false