# Deep Semantic Parsing with Upper Ontologies
## 2 Multi-Stage Semantic Parsing  
Traditionally, the natural language processing model pipeline has been used for semantic parsing tasks that have attempted to draw some inference from a text. Semantic analysis of the entire text of a book requires the addition of even more models to such semantic analysis pipelines. All these models of the upper ontology semantic parsing are grouped into several stages. Figure 3 shows four groups of interconnected activities. The first group consists of two tokenization steps. There are many word and sentence tokenizer solutions that can be used out of the box, and this project used the NLTK tokenizer [14]. The novelty of this paper lies in the tokenizer of chapters, dialogues and paragraphs. For a human reader, identifying chapters, paragraphs or dialogues can be straightforward. However, for a computer, books are just a stream of strings, and sometimes even something as simple as identifying chapters can be a challenge. During this project, we developed a simple yet practical algorithm for these text tokenization steps (see Section 3). The second stage of NLP flow consists of several well-established and open source NLP frameworks that can be used for syntactic and shallow semantic parsing. Our system combines the Stanford CoreNLP [15] named entity annotator, constituency parser and universal dependencies parser with AllenNLP semantic role labeling [16] and coreference resolution [17] components. All these components are included in the package \"Off-the-Shelf NLP Tools\" (see Figure 3). These five off-the-shelf components can run in parallel on different computers, as shown in Figure 3. Each of these components is discussed in more detail below. 1. The Stanford CoreNLP named entity annotator recognizes (_PERSON, LOCATION, ORGANIZATION, MISC_) entities. To return to the example presented in the introduction to this paper, the phrase \"_Sherlock Holmes_\" will be tagged as _PERSON_. In this  
Figure 3: There are 4 main stages of the semantic parsing of fiction. Each NLP stage consists of several processes, separated by synchronization bars. The processes in bold indicate the algorithms that needed to be developed during this research project. study, we found that 96.3% accuracy can be achieved in recognizing named entities in the fiction corpus. The Stanford named entity recognizer has additional numeric entities (_MONEY, NUMBER, DATE, TIME, DURATION, SET_), but the SUMO SRL framework does not use them at this stage of the project. All PERSON named entity labels that the system uses are mapped to the upper ontology class \"_Human_\", which means that the Drools inference engine instantiates objects of type \"_Human_\" with the parent class \"_Ptrysical_\" and performs inferences on these objects. In our 3D physics engine world, this means the system has a collision box with the label \"_Human_\". 2. The Stanford dependencies parser outputs grammatical relations between words (see Figure 4). It is used to find headwords in noun phrases. Let us take, as an example, the sentence \"_He had risen and paced the room as he spoke_\", and select the phrase \"_the room_\"; then, the dependencies parser will determine that the headword for this phrase is \"_room_\". Other examples of headword selection are shown in Figure 1. The headword selection is an important part in our framework when the system maps NLP processing results to the upper ontology. To see this, let us look at another example: \"_A lad of fourteen, with a bright, keen face, had obeyed the summons of the manager_\". This sentence contains the complex noun phrase \"_A lad of fourteen, with a bright, keen face_,\" which has been labeled _ARG0_ by the PropBank semantic role annotator. The only meaningful word for our 3D physics engine world is \"_lad_\". The Stanford dependencies parser allows us to identify this word, which is later mapped to the type \"_Human_\". 3. Syntactic constituency parsing is used to analyze the syntactic structure of a sentence. Figure 5 shows a typical output from the constituency parser.