Skip to content

balazscsaba2006/Craft-TextRank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TextRank plugin for CraftCMS

This plugin incorporates the TextRank library to extract relevant keywords from a given text.

The plugin exposes the functionality of TextRank, and can be used in your Twig:

{# Extract keywords array #}
{{ craft.hdtextrank.keywords('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.') }}

{# Extract summary of string #}
{# As TextRank library states: summary is at most 5% of the sentences of the text. #}
{{ craft.hdtextrank.summary('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 30) }}

...or as a PHP service:

$keywords = craft()->hdtextrank->keywords('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.');

Installation

  1. Unzip
  2. Drop the /hdtextrank folder inside your /craft/plugins directory
  3. Install in the Craft CP

Usages

It could be used for SEO purposes, to extract relevant keywords and summary from your content. It might be used for any other summarizing, wherever needed.

Using it together with SproutSeo Plugin

In your template you can easily to this, to extract relevant keywords and decription from your entries:

{% do craft.sproutSeo.meta({
	title: entry.title,
	keywords: craft.hdtextrank.keywords(entry.article)|join(', ')|lower,
	description: craft.hdtextrank.summary(entry.article, 157)
}) %}

About

A CraftCMS plugin to incorporate the TextRank library to extract relevant keywords from a given text.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages