Skip to navigation

Text Intelligence commands

Analyze text for sentiment, topics, summaries, and intents using the dg CLI.

Basic analysis

With no feature flag, dg read runs all four analyses: summary, sentiment, topics, and intents.

dg read "Customer called about a billing issue."

Analyze a file

dg read --file document.txt

Piped input

cat transcript.txt | dg read
echo "Your text here" | dg read

Language

-l (--language) sets the text’s language; it defaults to en.

dg read --file document.txt --language en

Available features

Sentiment analysis

dg read --file document.txt --sentiment

Returns overall document sentiment and its score.

Topic detection

dg read --file document.txt --topics

Returns detected topics with confidence scores.

Summarization

dg read --file document.txt --summarize

Generates a brief summary of the content.

Intent recognition

dg read --file document.txt --intents

Detects user intents within the text.

Full analysis

dg read --file document.txt --sentiment --topics --summarize --intents

Output format

# JSON
dg -o json read --file document.txt
# YAML
dg -o yaml read --file document.txt
# Formatted terminal table
dg -o table read --file document.txt
# CSV
dg -o csv read --file document.txt

Without -o, dg read prints human-readable output. -o works before the subcommand (dg -o json read ...) or after it on most commands (dg read ... -o json). On dg speak, -o/--output after the subcommand still sets the output file path but is deprecated; use --out-file instead. On dg plugin and dg skills subcommands, put -o before the subcommand.

Use cases

Summarize transcripts

Pipe the transcript text, extracted from the JSON payload, into dg read:

dg -o json listen meeting.mp3 2>/dev/null | jq -r '.results.channels[0].alternatives[0].transcript' | dg read --summarize

Analyze customer feedback

dg read --file feedback.txt --sentiment --topics