NacoWiki PHP API

AutoTag
in package

NacoWiki AutoTag

Automatically generate tags on articles based on a tag cloud.

It will update the frontmatter header with tags based on the contents of the document. For this, the media handler must support the Core::logProps functionality.

To set-up you first need to create a tagcloud.md file. Either in the current directory or a directory above.

The tagcloud.md must contain:

# this is comment
tag # Just a tag
tag2, synonym1, synonym2 # tag2 is recognized, but also, synonym1 and synonym2 are considred for triggering tag2
~tag3 # tag3 is removed from the tag cloud
~tag3, synonym4 # tag3 and synonym4 are removed from the tag cloud

If there are multiple tagcloud.md files along the path all of them are merged. But the deeper tagcloud.md files can use ~ notation to remove words from the tagcloud.

Headers containg tag: are used. Should be made of comma separated tag lists.

In addition, a autotag-ignore header is recognized. Tags here are also comma separated. If a word is found in this list, the tag will not be added to the tag line.

Tags
phpcod

AutoTag

Table of Contents

Constants

IGNORES  = 'autotag-ignore'
RE_SPLIT  = '/\\s*,\\s*/'
TAGCLOUD  = '/tagcloud.md'
VERSION  = '0.0.0'
var string

Methods

autoTagger()  : bool|null
Auto tagging function
load()  : void
Loading entry point for this class
loadTagCloud()  : array<string|int, mixed>
Load tagcloud
tokenize()  : string
tokenize word

Constants

IGNORES

public mixed IGNORES = 'autotag-ignore'

RE_SPLIT

public mixed RE_SPLIT = '/\\s*,\\s*/'

TAGCLOUD

public mixed TAGCLOUD = '/tagcloud.md'

VERSION

var string

public mixed VERSION = '0.0.0'

Methods

autoTagger()

Auto tagging function

public static autoTagger(NanoWikiApp $wiki, array<string|int, mixed> &$ev) : bool|null

log-props event handler

Parameters
$wiki : NanoWikiApp

running wiki instance

$ev : array<string|int, mixed>
Tags
event

log-props

Return values
bool|null

load()

Loading entry point for this class

public static load(array<string|int, mixed> $cfg) : void

Adds event hooks implemented by this class

Parameters
$cfg : array<string|int, mixed>

loadTagCloud()

Load tagcloud

public static loadTagCloud(NanoWikiApp $wiki, string $url) : array<string|int, mixed>
Parameters
$wiki : NanoWikiApp

running wiki instance

$url : string

path of option files to read

Return values
array<string|int, mixed>

containing tag cloud, NULL on error

tokenize()

tokenize word

public static tokenize(string $word) : string

Make a word more easily recognizable by the auto-tagger

Parameters
$word : string

input word

Return values
string

tokenized word


        
On this page

Search results