Text Processor Skill
This skill performs various text manipulation and analysis operations.
When to Use
Use this skill when:
- The user needs to change text case (uppercase, lowercase, capitalize)
- Text needs to be reversed
- Word count or text analysis is required
- The user mentions terms like "convert to uppercase", "make lowercase", "capitalize", "reverse text", "count words", "text transformation"
Instructions
Operation: Uppercase
- Take the input text
- Convert all characters to uppercase
- Return the transformed text
Operation: Lowercase
- Take the input text
- Convert all characters to lowercase
- Return the transformed text
Operation: Capitalize
- Take the input text
- Split the text into words (separated by spaces)
- For each word:
- Convert the first character to uppercase
- Convert remaining characters to lowercase
- Join the words back together with spaces
- Return the transformed text
Operation: Reverse
- Take the input text
- Split the text into individual characters
- Reverse the order of characters
- Join the characters back together
- Return the reversed text
Operation: Word Count
- Take the input text
- Trim leading and trailing whitespace
- Split the text by whitespace (spaces, tabs, newlines)
- Filter out empty strings
- Count the number of remaining words
- Return the count
Examples
Example 1: Uppercase Conversion
Input: "Convert 'hello world' to uppercase"
Steps:
- Operation: Uppercase
- Input text: "hello world"
- Transform: HELLO WORLD
Output: "HELLO WORLD"
Example 2: Capitalize
Input: "Capitalize 'the quick brown fox'"
Steps:
- Operation: Capitalize
- Input text: "the quick brown fox"
- Split into words: ["the", "quick", "brown", "fox"]
- Capitalize each: ["The", "Quick", "Brown", "Fox"]
- Join: "The Quick Brown Fox"
Output: "The Quick Brown Fox"
Example 3: Reverse Text
Input: "Reverse the text 'hello'"
Steps:
- Operation: Reverse
- Input text: "hello"
- Split: ['h', 'e', 'l', 'l', 'o']
- Reverse: ['o', 'l', 'l', 'e', 'h']
- Join: "olleh"
Output: "olleh"
Example 4: Word Count
Input: "How many words are in 'The quick brown fox jumps over the lazy dog'?"
Steps:
- Operation: Word count
- Input text: "The quick brown fox jumps over the lazy dog"
- Split by spaces: ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]
- Count: 9 words
Output: "The text contains 9 words"
Example 5: Word Count with Extra Spaces
Input: "Count words in ' hello world '"
Steps:
- Operation: Word count
- Input text: " hello world "
- Trim and split: ["hello", "world"]
- Count: 2 words
Output: "The text contains 2 words"
Common Edge Cases
- Empty strings: Return appropriate message (e.g., "0 words" for word count)
- Multiple spaces: Treat consecutive spaces as a single separator for word counting
- Special characters: Preserve special characters in all operations except word counting
- Unicode characters: Handle international characters appropriately
- Newlines and tabs: Treat as whitespace for word counting
- Mixed case input: Process according to the operation requested
Tips
- Always preserve the original text structure (spaces, punctuation) unless the operation specifically modifies it
- For capitalize operation, consider whether acronyms or proper nouns need special handling
- When counting words, clarify what constitutes a "word" if the text contains numbers or special characters
- Show both the original and transformed text in your response for clarity