The only way I know is to:
- Create a text frame. (Make sure that it has basic appearance without insets.)
- Paste the word you want to measure into the text frame.
- Press Ctrl / Cmd + Alt + C to Fit Frame to Content.
- Read the width in the Transform panel.
This width includes a tiny space before and after the word which comes from the way the font was designed. If you want the exact width of the geometric shapes, use Type > Create Outlines instead of Fit Frame to Content.
Although a little hacky, this method can also be used in a script in the exact same way.