/**
 * Called when displaying the tags.php page. if a tag is given,
 * it displays that tag, else the local Tag Cosmos
 *
 * @return string
 */
function snippet_tagpage()
{
    global $Paths;
    // Check if we called "tags.php/tagname" or
    // "tags.php?somevar=somevalue[...]/tagname"
    if (preg_match('#tags.php(\\?[^/]*|)/(.+)$#', $_SERVER['REQUEST_URI'], $matches) > 0) {
        $_GET['tag'] = $matches[2];
    }
    if (!isset($_GET['tag']) || $_GET['tag'] == "") {
        $output = printTagCosmos();
    } else {
        $output = printTag($_GET['tag']);
    }
    return $output;
}
Example #2
0
File: test.php Project: nbir/etola
<?php 
// little helper function to print the results
require_once "pos_tagger.php";
$tagger = new PosTagger('lexicon.txt');
//$t="jump over the fence";
$t = "china exports cooton to russia";
function printTag($tags)
{
    foreach ($tags as $t) {
        echo $t['token'] . "-" . $t['tag'] . "\n";
    }
    echo "\n";
}
$tagger = new PosTagger('lexicon.txt');
$tags = $tagger->tag($t);
printTag($tags);
/*
require_once("../clustering/loadCorpus.php");
$obj_lc=new LoadCorpus();
$corpus=$obj_lc->getAllHeadlines("final");

$fp=fopen("output.".date("ymdHis"), "w");

foreach($corpus as $headline)
{
	$tags = $tagger->tag($headline);
	$string="";
	foreach($tags as $t)
	{
		$string.=strtolower($t['token']) . "/" . trim($t['tag']) .  " ";
	}
Example #3
0
 /**
  * Render a Tag page, using the template as was set in the config.
  *
  * @see $Parser::render
  */
 function renderTag()
 {
     global $PIVOTX;
     // Execute a hook, if present.
     $PIVOTX['extensions']->executeHook('before_parse', $this->modifier);
     // The type of page we're rendering
     $this->modifier['pagetype'] = 'tag';
     $PIVOTX['template']->assign('pagetype', 'tag');
     // Get the things we were searching for..
     $content = printTag($this->modifier['uri']);
     $template = $PIVOTX['weblogs']->get('', 'extra_template');
     // Perhaps override the template, if we're allowed to do so.
     if (!empty($this->modifier['template']) && $PIVOTX['config']->get('allow_template_override') == 1) {
         $template = $this->modifier['template'];
     }
     // If the template isn't set, or doesn't exist..
     if ($template == "" || !file_exists($PIVOTX['paths']['templates_path'] . $template)) {
         // .. we guesstimate a template, and show that..
         $template = templateGuess('search');
     }
     // We know what theme we're in, because of the used template.
     $PIVOTX['template']->assign('themename', dirname($template));
     // Set the 'content' in smarty..
     $PIVOTX['template']->assign('content', $content);
     // Render and show the template.
     $this->parseTemplate($template);
 }