# Extracting Data

## Generating Metadata

### Metagen::generateKeywords(*$body*, *$count*, *$minLength*, *$forceKeys*)

Extract a list of keywords from the text *$body*.

The maximum number of key words is *$count*, which defaults to 20. Only words at least *$minlen*, which defaults to 4, will be considered.

If specified, the array of words in *$forceKeys* will be used as keywords. Those words will count toward the *$count*.

Return array of keywords.

## Metagen::generateDescription(*$body*, *$wordCount*)

Extract a short description from the text *$body*.

No more than *$wordCount* words, default is 100, will be included in the description.

Returns a string.

## Metagen::generateSeoTitle(*$title*, *$extension*)

Create an SEO slug from the *$title*, adding the string *$extension*, if specified.

## Metagen::getSearchSummary(*$haystack*, *$needles*, *$length*)

Splits a string, *$haystack*, into a string no longer than the length specified as *$length*, default 120. The string is centered around the first occurrence of any string in the array *$needles*, or starting at the beginning of the string if no *$needles* are specified or found.

## Metagen::checkStopWords(*$key*)

&#x20;**This method is deprecated. Use of** [**StopWords::check()**](/xmf-cookbook/reference/stopwords.md) **is prefered.**

Look up the word *$key* in the list of [stop words](https://en.wikipedia.org/wiki/Stop_words) and classify it as a significant word or a stop word.

Returns *true* if the word is significant, or *false* if it is a stop word.


---

# Agent Instructions: 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://xoops.gitbook.io/xmf-cookbook/reference/metagen/extracting-data.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.
