XMF Cookbook
  • Introduction
  • XMF Cookbook
  • Basic Ingredients
    • Namespaces
    • Autoloading
    • Debugging
    • Forward Compatibility
  • Recipes
    • Introducing Module Helpers
    • Using the Permission Helper
      • Checking Permissions
      • Managing Item Permissions
    • Using the Session Helper
    • Using JSON Web Tokens
    • Altering Database Tables
    • Migrating a Module's Database
    • Loading Initial Data
    • Module Admin Pages
      • Hide and Seek with Icons
      • Standard Admin Pages
    • Manage Metadata
    • Highlighting Content
  • Reference
    • Assert
      • Assertions
    • Database
      • Migrate
      • TableLoad
      • Tables
        • Getting Started
        • Table Operations
        • Working with Columns
        • Working with Indexes
        • Changing Table Data
        • Interacting with the Work Queue
        • Error Info and Debugging
    • Debug
    • FilterInput
    • Highlighter
    • IPAddress
    • Jwt
      • JsonWebToken
      • KeyFactory
      • TokenFactory
      • TokenReader
    • Key
      • ArrayStorage
      • Basic
      • FileStorage
      • KeyAbstract
      • StorageInterface
    • Language
    • Metagen
      • Extracting Data
      • Applying Data
    • Module
      • Admin
      • Helper
      • Helper
        • AbstractHelper
        • Cache
        • GenericHelper
        • Permission
        • Session
    • ProxyCheck
    • Random
    • Request
    • StopWords
    • Uuid
    • Yaml
  • Credits
  • License:
  • Table of Content
Powered by GitBook
On this page
  • Generating Metadata
  • Metagen::generateKeywords($body, $count, $minLength, $forceKeys)
  • Metagen::generateDescription($body, $wordCount)
  • Metagen::generateSeoTitle($title, $extension)
  • Metagen::getSearchSummary($haystack, $needles, $length)
  • Metagen::checkStopWords($key)
  1. Reference
  2. Metagen

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)

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

PreviousMetagenNextApplying Data

Last updated 6 years ago

This method is deprecated. Use of is prefered.

Look up the word $key in the list of and classify it as a significant word or a stop word.

StopWords::check()
stop words