";
// Creation and population of the "sentence" area - the right side of the page where sentences are displayed
// One div with class "sentences" for each of the 5 top words. These divs will be populated with sentences
// in which the corresponding word appears
echo "
";
// Word 1's sentences
echo "
";
// If the word appears in more than 10 sentences, use the previously generated random sample of 10
if( count($appearance_indices[0]) > 10 )
{
// Using the 10 random indices from $random_indices
for($i = 0; $i < 10; $i++)
{
// Find the randomly chosen index of the appearances_indices table
$appearance_lookup_index = $random_indices[0][$i];
// Find the lines table index stored in the appearances_indices table
$index = $appearance_indices[0][$appearance_lookup_index];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
// If the word appears in less than 10 sentences, display all appearances
else
{
for($i = 0; $i < count($appearance_indices[0]); $i++)
{
$index = $appearance_indices[0][$i];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
echo "
";
// Word 2's sentences
echo "
";
if( count($appearance_indices[1]) > 10 )
{
// Using the 10 random indices from $random_indices
for($i = 0; $i < 10; $i++)
{
// Find the randomly chosen index of the appearances_indices table
$appearance_lookup_index = $random_indices[1][$i];
// Find the lines table index stored in the appearances_indices table
$index = $appearance_indices[1][$appearance_lookup_index];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
else
{
for($i = 0; $i < count($appearance_indices[1]); $i++)
{
$index = $appearance_indices[1][$i];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
echo "
";
// Word 3's sentences
echo "
";
if( count($appearance_indices[2]) > 10 )
{
// Using the 10 random indices from $random_indices
for($i = 0; $i < 10; $i++)
{
// Find the randomly chosen index of the appearances_indices table
$appearance_lookup_index = $random_indices[2][$i];
// Find the lines table index stored in the appearances_indices table
$index = $appearance_indices[2][$appearance_lookup_index];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
else
{
for($i = 0; $i < count($appearance_indices[2]); $i++)
{
$index = $appearance_indices[2][$i];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
echo "
";
// Word 4's sentences
echo "
";
if( count($appearance_indices[3]) > 10 )
{
// Using the 10 random indices from $random_indices
for($i = 0; $i < 10; $i++)
{
// Find the randomly chosen index of the appearances_indices table
$appearance_lookup_index = $random_indices[3][$i];
// Find the lines table index stored in the appearances_indices table
$index = $appearance_indices[3][$appearance_lookup_index];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
else
{
for($i = 0; $i < count($appearance_indices[3]); $i++)
{
$index = $appearance_indices[3][$i];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
echo "
";
// Word 5's sentences
echo "
";
if( count($appearance_indices[4]) > 10 )
{
// Using the 10 random indices from $random_indices
for($i = 0; $i < 10; $i++)
{
// Find the randomly chosen index of the appearances_indices table
$appearance_lookup_index = $random_indices[4][$i];
// Find the lines table index stored in the appearances_indices table
$index = $appearance_indices[4][$appearance_lookup_index];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
else
{
for($i = 0; $i < count($appearance_indices[4]); $i++)
{
$index = $appearance_indices[4][$i];
echo "
".($i + 1).". ".$lines[$index + 10]."
";
}
}
echo "
";
echo "