コード例 #1
0
<?php

include_once '../common/common.php';
include_once 'EventParser.php';
//============================================================
$eventParser = new EventParser('http://thescenestar.typepad.com/shows/');
$json_events = $eventParser->getEventsJson();
$php_events_array = $eventParser->getEvents();
$eventParser->saveJsonToFile('events', "../../data/events.json");
$eventParser->saveVenuesCsv("../../data/venues.csv");
$eventParser->saveEventsCsv("../../data/events.csv");
/*
TODO:  add youtube autosearch link for each artist!
	EG:  www.youtube.com/results?search_query=bubu+gang
*/
// ============================ OUTPUT SECTION ===========================
$prev_month = "";
$prev_wkday = "";
echo '<span class="small">';
foreach ($php_events_array as $show) {
    //$nice_date = date("D M d", strtotime($show["date"]));
    $weekday = date("l", strtotime($show["fmt_date"]));
    $month = date("F", strtotime($show["fmt_date"]));
    // Monthly header
    if ($prev_month != $month) {
        echo "<hr><h2>" . $month . " " . $show["year"] . "</h2>";
    }
    // Day of week header
    if ($prev_wkday != $weekday) {
        echo "<h3>" . $show["nice_date"] . "</h3>";
    }
コード例 #2
0
ファイル: test.php プロジェクト: xdrm-brackets/intothewhile
<?php

/**
 * Created by PhpStorm.
 * User: seekdasky
 * Date: 03/12/15
 * Time: 22:17
 */
require_once 'autoloader.php';
$tweets = ["Gros tremblement de terre à Paris, quelle catastrophe", "Ce nouveau film est un veritable tremblement de terre dans le millieu du cinéma", "#Paris #TremblementDeTerre", "J'aime le fromage", "attentat a Paris, 20 mort", "#Attentat au bataclan!"];
$keywords = [["catastrophe", 2], ["tremblement de terre", 5], ["attentat", 10], ["mort", 2]];
$parser = new EventParser($tweets, $keywords);
$parser->detectEvents();
foreach ($parser->getEvents() as $event) {
    if ($event->getEntries() == null) {
        continue;
    }
    var_dump($event->getWeigth());
    foreach ($event->getEntries() as $entry) {
        var_dump($entry->getData());
    }
    var_dump($event->getHighImportanceKeyword());
    var_dump($event->getLowImportanceKeyword());
}