Softanza
StartFrançais
Softanza
Research · narration

Smart Adverb Generation in Softanza

Converting words to adverbs isn't straightforward. Consider these examples:

by Mansour Ayouni · in the repository since 2025-06-13 · feature essay · area Agents & conversation

The Softanza library introduces an intelligent Adverb() function that transforms adjectives and nouns into contextually appropriate adverbs using a priority-based rule system. Unlike simple suffix concatenation, this feature handles linguistic irregularities, domain-specific terminology, and morphological patterns systematically.

The Challenge

Haro
"good" + "ly" = "goodly" ❌    # Should be "well"
"happy" + "ly" = "happyly" ❌  # Should be "happily"  
"finance" + "ly" = "financely" ❌ # Should be "financially"

illustration

English morphology requires context-aware transformations, not mechanical suffix addition.

How It Works

The system uses prioritized pattern matching:

1. Irregular Forms (Priority 1)

Handles words with unique adverb forms:

Haro
? Adverb("good")   #--> "well"
? Adverb("fast")   #--> "fast" 
? Adverb("hard")   #--> "hard"

run on 2026-10-08 20:41 at commit 4a184e6f0: kept its promise

2. Preserve Existing Adverbs (Priority 2)

Prevents double transformation:

Haro
? Adverb("quickly")    #--> "quickly" (not "quicklyly")
? Adverb("backward")   #--> "backward"
? Adverb("likewise")   #--> "likewise"

illustration

3. Domain-Specific Patterns (Priority 3)

Provides professional context:

Haro
? Adverb("finance")      #--> "financially"
? Adverb("technology")   #--> "technologically"
? Adverb("sales")        #--> "sales-wise"
? Adverb("marketing")    #--> "from a marketing perspective"
? Adverb("education")    #--> "educationally"

run on 2026-10-08 20:41 at commit 4a184e6f0: kept its promise

4. Language/Geographic Context (Priority 4)

Handles cultural references:

Haro
? Adverb("english")   #--> "in English"
? Adverb("french")    #--> "in French"
? Adverb("american")  #--> "in an American way"

illustration

5. Morphological Patterns (Priority 5)

Applies standard English transformations:

Haro
? Adverb("happy")       #--> "happily"     (y → ily)
? Adverb("gentle")      #--> "gently"      (le → ly)
? Adverb("basic")       #--> "basically"   (ic → ically)
? Adverb("comfortable") #--> "comfortably" (able → ably)
? Adverb("creative")    #--> "creatively"  (ive → ively)

illustration

Pattern Flexibility

Domain patterns use regex matching for word families:

Haro
# Pattern: "(technolog).*" matches:
? Adverb("technology")     #--> "technologically"
? Adverb("technological")  #--> "technologically"
? Adverb("technologist")   #--> "technologically"

run on 2026-10-08 20:41 at commit 4a184e6f0: kept its promise

This covers variations without explicit enumeration.

Implementation Benefits

Systematic Coverage: 25 rules handle thousands of cases through pattern matching rather than exhaustive word lists.

Maintainable: Adding new domains requires single regex patterns:

Haro
AddAdverbRule("(legal|law).*", "legally", "regex", 3, "domain")

illustration

Predictable: Priority system ensures consistent behavior. Higher priority rules override lower ones.

Extensible: Categories enable targeted rule management:

Haro
? GetRulesByCategory("domain")     # Returns all business/technical rules
? GetRulesByCategory("morphology") # Returns suffix transformation rules

illustration

Real-World Applications

Text Processing: Convert adjective-heavy content to adverb-rich prose for stylistic variation.

Natural Language Generation: Ensure grammatically correct adverb forms in automated writing.

Educational Tools: Demonstrate English morphological patterns programmatically.

Business Communication: Generate contextually appropriate professional terminology.

Edge Case Handling

The system gracefully handles various inputs:

Haro
? Adverb("QUICK")      #--> "quickly"    (case normalization)
? Adverb("  slow  ")   #--> "slowly"     (whitespace trimming)
? Adverb("xyzabc")     #--> "xyzabcly"   (unknown words get default)

illustration

Adding Custom Rules

Extend functionality for specific domains:

Haro
# Add legal terminology
AddAdverbRule("^legal$", "legally", "exact", 2, "domain")
AddAdverbRule("(contract).*", "contractually", "regex", 3, "domain")

# Add morphological pattern
AddAdverbRule("(.+)ment$", "\\1mentally", "regex", 5, "morphology")

illustration

The Softanza Adverb() function demonstrates how linguistic complexity can be managed through systematic pattern recognition, delivering both accuracy and maintainability in natural language processing tasks.

Cite

Mansour Ayouni. "Smart Adverb Generation in Softanza". Softanza narrations, 2025. https://mayouni.github.io/stzsite/en/narrations/stz-max-adverb-generation-in-softan.html

Run in Haro's name on 2026-10-08 20:41 inside the library at commit 4a184e6f0, block after block in one process: 3 of 11 blocks kept their promise; the others are illustrations. The code of the articles is Haro code. Where an article was written before the language took its present name, the name was changed and nothing else. Genre, area and series read from the file's name, the year from its first commit: derived, until the article carries its own header. The file on GitHub(opens in a new tab)