Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions examples/node-read/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { createClient } = require("../../dist/main/index");

const text = `The history of the phrase 'The quick brown fox jumps over the
lazy dog'. The earliest known appearance of the phrase was in The Boston
Journal. In an article titled "Current Notes" in the February 9, 1885, edition,
the phrase is mentioned as a good practice sentence for writing students: "A
favorite copy set by writing teachers for their pupils is the following,
because it contains every letter of the alphabet: 'A quick brown fox jumps over
the lazy dog.'" Dozens of other newspapers published the phrase over the
next few months, all using the version of the sentence starting with "A" rather
than "The". The earliest known use of the phrase starting with "The" is from
the 1888 book Illustrative Shorthand by Linda Bronson.[3] The modern form
(starting with "The") became more common even though it is slightly longer than
the original (starting with "A").`;

const analyzeUrl = async () => {
const deepgram = createClient(process.env.DEEPGRAM_API_KEY);

const { result, error } = await deepgram.read.analyzeText(
{
text,
},
{
language: "en",
topics: true,
sentiment: true,
}
);

if (error) throw error;
if (!error) console.dir(result, { depth: null });
};

analyzeUrl();
5 changes: 5 additions & 0 deletions src/DeepgramClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AbstractClient } from "./packages/AbstractClient";
import { ListenClient } from "./packages/ListenClient";
import { ManageClient } from "./packages/ManageClient";
import { OnPremClient } from "./packages/OnPremClient";
import { ReadClient } from "./packages/ReadClient";

/**
* Deepgram Client.
Expand All @@ -23,6 +24,10 @@ export default class DeepgramClient extends AbstractClient {
return new OnPremClient(this.key, this.options);
}

get read(): ReadClient {
return new ReadClient(this.key, this.options);
}

/**
* Major version fallback errors are below
*/
Expand Down