> For the complete documentation index, see [llms.txt](https://methara.gitbook.io/methara-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://methara.gitbook.io/methara-docs/methara-developer-documentation/entities.md).

# Entities

The Entities module extracts structured data from natural language text using regex and pattern matching.

Everything runs locally.

### Entities.extract(text)

Runs all extractors in a single pass and returns a typed `EntityMap` object.

```ts
Entities.extract('Remind @alice about the meeting tomorrow at 9am');
// {
//   date: Date,
//   // tomorrow's date at midnight
//   time: '09:00',
//   mentions: ['@alice'],
//   trackingId: null,
//   quantity: null
// }
```

### Individual extractors

| Method                      | Extracts                                                    | Returns          |
| --------------------------- | ----------------------------------------------------------- | ---------------- |
| `Entities.date(text)`       | today, tomorrow, next Friday, 2025-05-24, May 24, in 3 days | `Date \| null`   |
| `Entities.time(text)`       | 3pm, 14:00, at 9am, noon, midnight                          | `string \| null` |
| `Entities.mentions(text)`   | `@username` patterns                                        | `string[]`       |
| `Entities.trackingId(text)` | `TRK-8821A`, `ORD-001`, `INV-2024`                          | `string \| null` |
| `Entities.quantity(text)`   | digit numbers and word numbers                              | `number \| null` |

```ts
Entities.date('Remind me tomorrow at noon'); // Date object
Entities.date('Schedule for next Monday'); // Date object
Entities.date('Due on 2025-06-15'); // Date object
Entities.time('Schedule it for 3:30pm'); // '15:30'
Entities.time('Meet at noon'); // '12:00'
Entities.mentions('Assign this to @alice and @bob'); // ['@alice', '@bob']
Entities.trackingId('Order TRK-8821A is ready'); // 'TRK-8821A'
Entities.quantity('Add five tasks to my list'); // 5
```

### EntityMap type

```ts
interface EntityMap {
  date: Date | null;
  time: string | null; // "HH:MM" format
  mentions: string[];
  trackingId: string | null;
  quantity: number | null;
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://methara.gitbook.io/methara-docs/methara-developer-documentation/entities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
