$server_output = curl_exec($ch);
     curl_close($ch);
     return json_decode($server_output);
 }
 $filename = "test.txt";
 $handle = fopen($filename, "r");
 $rawText = fread($handle, filesize($filename));
 fclose($handle);
 $sentences = getSentenceList($rawText);
 $parseText = [];
 $parseText['recap'] = array();
 $parseText['planning'] = array();
 $parseText['definitions'] = array();
 $prevIntent = "";
 for ($i = 0; $i < count($sentences); $i++) {
     $result = witAI($sentences[$i]);
     if (!isset($result->outcomes[0]->intent)) {
         break;
     }
     switch ($result->outcomes[0]->intent) {
         case "recap":
             if ($result->outcomes[0]->intent == $prevIntent) {
                 $parseText['recap'][count($parseText['recap']) - 1] .= ". " . $sentences[$i];
             } else {
                 array_push($parseText['recap'], $sentences[$i]);
             }
             break;
         case "planning":
             if ($result->outcomes[0]->intent == $prevIntent) {
                 $parseText['planning'][count($parseText['planning']) - 1] .= ". " . $sentences[$i];
             } else {
}
/*
	$rawText = "Good morning. It's Inauguration Day--Happy Inauguration Day to everyone--and I thought that actually the inauguration of Barack Obama today and the particular lecture in this class are very well suited to one another. Because although you see that the title of today's lecture is \"Technology and Revolution in Roman Art,\" I could also call it something like \"The Change the Romans Believed In.\" Because the change the Romans believed in, the change the Romans believed in was a shift from what we call traditional Roman architecture to innovative Roman architecture. And that's what we're going to be talking about today, what we call innovative, and what we'll call in the course of this semester, innovative Roman architecture.

We've already talked about what we've called traditional Roman architecture, and I just want to look again with you, to begin today with the Temple of Portunus, that we looked at last time, the Temple of Portunus in Rome, near the Tiber River, a temple that was put up in the late second, early first century B.C. And we talked about the fact that this was a traditional Roman building of this day. A traditional Roman building though that was quite derivative, that looked back at Greek architecture, Greek religious architecture, and Etruscan religious architecture, and drew from both of those, drew elements from both of those, and combined them together into what we termed a new Roman creation, at least in the traditional vein. We talked about the fact that the Etruscan elements of this particular monument were its tall podium, were its deep porch, were the freestanding columns in that porch, were the single staircase and the emphasis on the façade, that having that single staircase achieved.

We also talked about the fact that while there were columns all around the structure, which is actually a Greek way of doing things, that those columns were attached or engaged into the wall, which still gave it a certain sense of flatness, including on the back, that was also characteristic of Etruscan architecture. We also talked about the Greek elements that were incorporated here, and those included the fact that the building was made out of stone, and also the fact that one of the traditional Greek orders, in this case the Ionic order, was used for the structure. So this bringing together of Greek and Etruscan elements in this thoroughly Roman building, but a building that again we would call a traditional Roman building. And what do I mean by traditional? All the traditional Roman buildings share in common the following features. They have columns and they have walls, and those columns and walls serve a structural purpose and that is to hold up the flat or the sloping ceiling, the sloping roof, and that is in fact exactly what you see here.

But at this very same time, in the second century B.C. and into the first century B.C., we begin to see a new kind of experimentation that is going on concurrently with this, an experimentation that grows up in some of the same towns that we see traditional buildings like this. And what made this experimentation different than anything that had come before is the fact that the Romans use, for these buildings, a completely new material, and that material is concrete. We talked about the fact that already in the Temple of Portunus concrete was used, but concrete was used only in the podium. You can't see it. It is inside the podium and serves to strengthen--concrete has a great deal of strength and can sustain great weights--and so it was placed in the podium for utilitarian purposes so that it could help to support the temple that was located on top. But again, none of its expressive possibilities were explored by the designer of the Temple of Portunus or any of the other temples we looked at last time.

But what begins to happen also, in the course of the second and first centuries B.C., is architects beginning to realize that this new concrete technology has an opportunity to transform Roman architecture, and they begin to experiment with that transformation. In order to understand the concrete buildings that we're going to be looking at this morning, which are absolutely fascinating--and I hope you'll be as enthralled by them as I am, and they again stand at the very beginning of this development of innovative architecture in Rome--it's important to know a bit about concrete, Roman concrete that is, and I want to make a few points about it. Roman concrete -- the Latin term for it is opus caementicum, as I've indicated here. Roman concrete is different from what we think of today as concrete. It's a composite of various natural elements that becomes a liquid mass when mixed with water and eventually hardens into a very, very strong substance, much stronger than any of its ingredients are on their own. Roman concrete was a mixture of stone rubble and liquid mortar, and composed of lime, sand and something called pozzolana -- pozzolana being a volcanic substance, which was very plentiful in Italy, especially around the area of Pompeii, Herculaneum, the area of Campania.

Concrete was used in Rome from the early second century B.C. on, but it was not until the end of the second century, and the beginning of the first century, that the expressive possibilities of concrete began to be fully realized. Concrete--I think this is also important to mention, when you think about concrete construction in relationship to stone construction, that we've already discussed -- concrete is not cut or quarried the way stone is. Concrete is caste in molds. Concrete can be caste in any shape, at least any shape that a carpenter can build with wood. And like modern builders, the Romans erected wooden frames for their walls and ceilings and they poured concrete into those wooden frames. What's most important for us, in the context of this lecture and in this course in general, is that the introduction of Roman concrete into Roman architecture freed the Roman architect from the confines of a rectilinear architecture that they had inherited from the Greeks, the kind of rectilinear architecture that made up a temple like the Temple of Portunus. This is a very momentous change and one that will have a lasting impact on the buildings of the Romans.

Let me try to give you a sense of what I mean by this. One could argue that the greatest concrete structure built by the Romans was the Pantheon. And I remind you of the Pantheon on the right, in fact the dome of the Pantheon, which would not have been possible without concrete construction. But it's interesting to compare the Pantheon to an attempt that Etruscan architects made to create something similar but out of stone. I show you on the left-hand side of the screen an Etruscan tomb that dates to 600 B.C. So, very early in time, 600 B.C., an Etruscan tomb at a place called--it's not on your Monument List--but at a place called Quinto Fiorentino, Q-u-i-n-t-o, new word, F-i-o-r-e-n-t-i-n-o. Quinto Fiorentino, an Etruscan territory. And what the architects have done here is to try to create a round tomb, and they've used stone, as you can see, and they have laid those stones. They've cut and quarried the stones as usual. They've tried to cut them in the shapes that they need in order to make this work. And they've piled them, one on top of the other, row after row after row, until they've gotten -- it started out okay at the bottom, but as they get further and further on to the top and it gets rounder and rounder, and converges at the apex, they start to have trouble, as you can see. And although it's a heroic, a valiant attempt on their part, it isn't terribly successful, at least to my mind, aesthetically. And, in fact, they were worried about it falling down, so they even had to place a stone pier here, to support the dome, to make sure that it didn't drop. And actually that was pretty successful, because here it is, still today, looking pretty good in that regard.

But with the introduction of concrete into architecture, under the Romans, building a dome like the Pantheon was simplicity itself. All you needed to be able to do was to build one of these wooden models, wooden structures, that you then poured concrete into, and voilà, you have the dome of the Pantheon. So simplicity itself, transformational, vis-à-vis Roman architecture. The only problem with concrete -- there were two problems with concrete that the architects of this period had to contend with. One of them was that concrete has to be protected from moisture--that's number one--and number two, that concrete is less attractive than stone. The Roman architects of the second and first centuries B.C. solved these two problems in the same way. What they decided to do was when the concrete was still wet, they attached stone to it. This could either be large ashlar blocks, stone blocks, or it could be small pieces of stone, that uncertain work or opus incertum that we talked about last time, pressed into the concrete when it was wet, and when it all dried, that stone both made the building look more attractive and also protected the building from moisture. We looked last time at that opus incertum facing. I remind you of the Temple of Vesta at Tivoli, which you see here, and you will recall that the Temple of Vesta at Tivoli had concrete, both in its podium, for utilitarian purposes and to support the great weight of the temple, but also that the architects explored making the cella wall, the curved cella wall, also out of concrete. And then when that concrete was wet they put in these small cut, irregularly shaped stones, called uncertain work or opus incertum, to protect that.

So we saw that already in the Temple of Vesta, even though it was a traditional temple, based on Greek and Etruscan models. And we'll see it again today, in several buildings, and I'll show you just one example, the last structure that we'll talk about today, the Sanctuary of Fortuna Primigenia at Palestrina, an extraordinary structure built on a hillside, that also used opus incertum as the facing. And you can see it used here for the wall and also for the coffered ceiling above. And so a stone facing, opus incertum, that was particularly favored in the second century B.C. and into the first century B.C. Over time the choice of facing changed. Although ashlar blocks, tufa, travertine, and opus incertum were popular in the second and first centuries, as time goes on things change.

We'll see, under the Roman emperor Nerva [correction: Nero] there was a revolution, another kind of revolution of sorts, in Roman architecture, and we'll talk about the reasons for that and so on later in the semester. But with that revolution came an interest in a new facing material, namely brick -- brick that was originally stuccoed over. And, in fact, the opus incertum work and the tufa stone that we've talked about already today tended to be stuccoed over as well. But by the second century we begin to see an appreciation for brick in its own right, the attractiveness of brick, and the Romans begin to use exposed brick as the facing for their buildings. And I show you one example. It's a detail of a warehouse in the Roman port city of Ostia, that we'll look at later in the term, with this exposed brick facing; very attractive, different colorations and so on and so forth. Just to alert you to the fact that again the kind of facing that we're talking about today will not be the only facing that is used by the Romans over time.";
*/
$rawText = "But for men, it's going to look more potentially like Figure 7-5. There's a small substitution effect but a \npotentially big income effect or bigger than women. Now, how big it is, that's not clear. Because, once \nagain, men have nothing to do if they don't work. So it could be this ends up being bigger and smaller. \nIt's not clear how big this ends up being. But it's at least possible that you could have men having a \nbackward-bending or downward sloping labor supply curve. Because the income effect could even more \nthan offset the substitution effect. ";
echo "Original Text: <br/>{$rawText} <br/>";
echo "Parsed Text: <br/>";
$sentences = getSentenceList($rawText);
foreach ($sentences as $key => $sentence) {
    echo "{$sentence}<br/>";
    echo witAI($sentence) . "<br/>";
}
die;