Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfixes

  • Loading branch information...
commit be6167c5766487f1c43e6d290ec09db6e964e570 1 parent fe1828a
@JarekSed JarekSed authored
View
2  application/controllers/api.php
@@ -32,8 +32,8 @@ function index () {
$bibliography = $this->Bibliography->get_citations($articles);
$sentences = $this->Sentence->tokenize($beefy_essay);
$sentences = $this->Essay_Model->add_intext_citations($articles,$bibliography,$sentences);
- $sentences = $this->Quotes->run($entities, $parsely_articles, $sentences);
$sentences = $this->Essay_Model->add_filler_sentences($parsely_articles, $sentences,5);
+ $sentences = $this->Quotes->run($entities, $parsely_articles, $sentences);
$beefy_essay = implode(" ",$sentences);
$return = array();
View
8 application/controllers/test.php
@@ -19,6 +19,7 @@ function entities () {
$this->load->model('Bibliography');
$this->load->model('NYTimes');
$this->load->model('Sentence');
+ $this->load->model('Quotes');
print '<pre>';
$essay = " Polls opened across Louisiana at 7 a.m. EDT and will remain open until 9 p.m. EDT. Just 20 of the state's delegates are at stake and will be allocated proportionally among candidates earning more than 25 percent of the vote. If no candidate earns above 25 percent, the delegates will remain uncommitted. An additional 23 delegates will be selected at the state Republican convention in June.
@@ -99,9 +100,10 @@ function entities () {
print "<br/>We got the output:<br/>\n";
// split input into sentences
- $sentences = $this->Sentence->tokenize($beefy_essay);
- $beefy_essay = $this->Essay_Model->add_intext_citations($articles,$bibliography,$sentences);
- $beefy_essay = $this->Essay_Model->add_filler_sentences($articles,$sentences,5);
+ $beefy_essay= $this->Sentence->tokenize($beefy_essay);
+ $beefy_essay = $this->Essay_Model->add_filler_sentences($articles,$beefy_essay,5);
+ $beefy_essay = $this->Essay_Model->add_intext_citations($articles,$bibliography,$beefy_essay);
+ //$beefy_essay= $this->Quotes->run($entities, $articles, $beefy_essay);
$beefy_essay = implode(" ",$beefy_essay);
print $beefy_essay;
View
6 application/models/essay_model.php
@@ -29,14 +29,14 @@ public function get_filler_sentence($keyword){
);
//get random template
$template = $filler_templates[array_rand($filler_templates)];
- return sprintf($template,$keyword);
+ return sprintf($template,$keyword,$keyword);
}
public function add_filler_sentences($articles,$sentences,$num_to_add){
for($i =0; $i < $num_to_add; $i++){
$keyword = array_rand($articles);
- $random_sentence = self::get_filler_sentence($keyword);
+ $random_sentence = "<span class='new filler'> " . self::get_filler_sentence($keyword). "</span>";
$random_index = rand(3,count($sentences)-4);
array_splice($sentences ,$random_index,0,$random_sentence);
}
@@ -52,7 +52,7 @@ public function add_intext_citations($articles,$bibliography,$sentences){
$citation_obj = $bibliography[$keyword];
//if this sentence has this keywork, add a citation at the end (and only one)
if( preg_match("/$keyword.*?<\/TOPIC>/", $sentence)){
- $sentence .= " " . $citation_obj['in-text'];
+ $sentence .= " <span class='new in-text'>" . $citation_obj['in-text'] . "</span>";
break;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.