@wowool/portal
Version:
A library for natural language processing tasks including tokenization, entity recognition, anonymization, semantic chunking, and much more.
127 lines (93 loc) • 2.96 kB
Markdown
# Wowool Portal
TypeScript client for the [Wowool Portal](https://www.wowool.com), an NLP toolkit built for modern AI.
## Introduction
Wowool is a powerful and flexible Natural Language Processing (NLP) technology built for modern AI featuring advanced NLP capabilities which can easily be integrated. It provides flexible pipelines for processing text data that perform syntactic and semantic analysis including tokenization, named entity recognition (NER), anonymization, semantic chunking, topic identification and many other types of analysis.
This library, Wowool Portal, is the client for the SaaS version of the Wowool NLP engine and it is designed to be user-friendly and efficient, making it an ideal choice for developers and data scientists looking to enhance their applications with state-of-the-art NLP features.
## Usage
### Installation
```bash
npm install @wowool/portal
```
### Configuration
First, [create an API key](https://www.wowool.com/settings/api-keys). Next, in browser-based environments, pass the `apiKey` to a `Portal` instance. In Node environments, you can also set the `WOWOOL_PORTAL_KEY` environment variable:
```bash
export WOWOOL_PORTAL_KEY="***"
```
### NLP using pipelines
Natural language processing using Wowool revolves around the use of a pipeline. Each instance of a pipeline represents a sequence of steps that sequentially processes the document.
#### Named entity recognition
```typescript
const pipeline = new Pipeline("english,entity");
const document = await pipeline.process("Elon Musk is the CEO of SpaceX.");
document.analysis.forEachEntity((entity) => {
console.log(`${entity.uri}: ${entity.text}`);
if (entity.attributes) {
entity.attributes.forEach((attribute) => {
console.log(` ${attribute.key}: ${attribute.values.join(", ")}`);
});
}
});
```
This will produce the following output:
```
Sentence: Elon Musk is the CEO of SpaceX .
header: true
Person: Elon Musk
canonical: Elon Musk
company: SpaceX
descriptor: billionaire
family: Musk
gender: male
given: Elon
position: CEO
theme: technology:it
Person: the CEO
canonical: Elon Musk
company: SpaceX
descriptor: billionaire
family: Musk
gender: male
given: Elon
position: CEO
theme: technology:it
PersonMention: CEO
Position: CEO
canonical: CEO
company: SpaceX
sector: aerospace
theme: business
type: executive
Company: SpaceX
canonical: SpaceX
country: USA
sector: aerospace
```
For more information, see the [Wowool documentation](https://www.wowool.com/docs).
## Development
### Building
To build the package:
```
npm run build
```
### Testing
To test the library:
```
npm run test
```
### Publishing
Adjust the version:
```
npm version patch
```
Prepare the package
```
npm run prepare
```
Inspect, the package:
```
npm run inspect
```
And finally, release the package to [npm](https://www.npmjs.com/package/@wowool/portal):
```
npm run release
```