iamnearlythere

Automatically Insert Acronyms With Hz_Filter_Acronym

I hope this demo speaks for itself:

This class is only good for parsing. If you’d like to use it in your application, here are some tips using the variable names from the gist’s example:

  • initialize the class once, so you won’t have to pass on $words on every initiation
  • cache the output, it’s an expensive round trip you do not want to do
  • invalidate (delete) cache only when $words get bigger or when $sentence changes

Requirements:

  • Zend Framework, or at least the Zend_Filter_Interface-class on your include path. Even this single requirement is optional, just comment out implements Zend_Filter_Interface if you want to use it as a standalone component.

You find Hz_Filter_Acronym at github