Expand Acronyms

Expand acronyms.

Usage

var expandAcronyms = require( '@stdlib/nlp/expand-acronyms' );

expandAcronyms( str )

Expands acronyms in a string.

var str = 'TLDR, the article is too long...';
var out = expandAcronyms( str );
// returns 'too long did not read, the article is too long...'

Notes

  • This expansion is done via a simple table look-up. Hence, it is not able to replace acronyms for which there are multiple possible expansions.

Examples

var expandAcronyms = require( '@stdlib/nlp/expand-acronyms' );

var str = 'LOL, this is fun. I am ROFL.';
var out = expandAcronyms( str );
// returns 'laughing out loud, this is fun. I am rolling on the floor laughing.'

str = 'brb, I need to check my mail. thx!';
out = expandAcronyms( str );
// returns 'be right back, I need to check my mail. thanks!'

str = 'OTOH, there are some drawbacks to this approach imho.';
out = expandAcronyms( str );
// returns 'on the other hand, there are some drawbacks to this approach in my humble opinion.'
Did you find this page helpful?