1 - People | Computer Science



Introduction

This document will present the class and sequence diagrams for the MSE project. An explanation will be given for every diagram that describes the key classes. Finally, a formal specification will be given that will formally specify the flow of information through the system.

1 References

[1] Damian Aaron Tamayo, Vision Plan 1.0 Project webpage:

[2] Naga Sowjanya Karumuri, Architectual Plan 2.1 Retrieved 10/29/2009, from Sowjanya’s Project Page Web Site:

MSE Project

1 Package View

The following is a package view of the system in work. Essentially, the flow of information starts out at the NLP program. This is where the user enters in the data to be processed. The data is then split into separate sentences. Then those sentences are individually selected and processed by the interaction with each one of the 3 servers. The POS tree is returned to the program and the data is processed.

2 Network

Since this project is an application program the following are the network specs that are being used in the program. The program uses a TCP connection.

• Socket – the following sockets are being utilized by the program

o 6666 – PPOS server port that it listens to and connects on

o 8888 – OpenNLP server port that it listens to and connects on

o 4444 – StanfordNLP server port that it listens to and connects on

1 Interactive Methods

• getSplitSentences

o Contacts the openNLP server to split the sentences

• Retrieve

o PPOS method to retrieve the list of parses on the PPOS server

• Reload

o PPOS method to send a user modified set of sentences to save on the server side that will replace the existing set

• getParse

o Contacts the openNLP, StanfordNLP, and PPOS servers to get parses if any exist

3 System Overview

[pic]

Figure 1

We can see from Figure 1 the layout of the NLP system that is being developed. The NLP program is the main system in the diagram. The PPOS is a subsystem that has been integrated into the NLP program for ease of use. The PPOS system uses the PPOS_Server to save user input. The main system (NLP Program) uses all three servers; PPOS_Server, OpenNLP_Server, and StanfordNLP_Server.

4 Flow Diagrams

The following flow diagrams give a depiction of what kind of information is passed at each stage of the program.

1 NLP Flow Diagram

2 PPOS Flow Diagram

5 Class Diagram

2.1 introduced the system design of the project. The following will show the class diagram level of the system. Due to the complexity of the program, the class diagram will be presented in chunks. After every chunk there will be a description of classes followed by an expanded view.

Unless otherwise stated, the following classes inherit from Generic. See Figure 2.

[pic][pic]

Figure 2

Every class that inherits from Generic must have the following methods (pages 5 - 25):

[pic]

Figure 3

Noun: Top Level class that noun objects inherit from.

Noun Object Classes: Each noun object represents a different noun type combination and is used when nouns are within the sentence

• NounObject

• NounObject2

• NounPrep

• NounList

• NounPossessivePronoun_NounInherits

[pic]

Figure 4

[pic]

Figure 5

PPreposition: Top Level Class that all Preposition objects inherit from

Preposition Object Classes: Represent Preposition combinations and used when prepositions are within the sentence

• PPreposition1

• PPreposition2

• PPreposition3

The following Figure 6 displays the methods and variables of each class.

[pic]

Figure 6

The following is the top level Predicate class in which all predicates inherit from.

[pic][pic]

Figure 7

The following predicates inherit from the above class

• Predicate1

• Predicate2

• Predicate3

• Predicate4

• Predicate5

• Predicate_HelpingVerb

• Predicate_Complex

• Predicate_HelpVerbNoun

[pic][pic]

[pic][pic][pic][pic]

[pic][pic][pic][pic]

[pic][pic][pic][pic]

[pic][pic]

Figure 8

[pic][pic][pic]

[pic][pic][pic]

Figure 9

Figure 9 represents the three kinds of Statements that can exist in the system right now. One of these statements will always exist at the top level of the tree structure. Statements can exist within each other. Statement is used when no conditions or conjugators are present with other statements. If a conjugator, such as “and”, “or”, etc, are present as a joiner with two or more statements, then Statement2 is used. Otherwise ConditionStatement1 is used when words like “until”, “if”, etc are used to join two or more statements.

[pic]

[pic]

Figure 10

Figure 10 represents the type of Qualifier class, with Qualifier being the top level class and the following classes inheriting from the top level class: These classes are used when there is a quantity or other qualifier present

• Qualifier1

• Qualifier2

[pic][pic]

Figure 11

Question class is used when a question word is present in the sentence, such as “what”, “which”, etc.

[pic]

Figure 12

Junction Class: Junction is the top level class which all Junction classes inherit from

Junction Classes: These classes are used when sentences contain conjunctions that indicate “and”, “or”, “but” and “nor”

• AndConjunction

• OrConjunction

• ButConjunction

• NorConjunction

[pic]

Figure 13

Figure 14 will show the condition classes starting with the top level class and then it’s inherited classes.

[pic][pic]

[pic][pic][pic][pic]

[pic][pic][pic][pic]

[pic][pic][pic][pic]

[pic][pic]

Figure 14

Condition Class: Top level class which all other conditions inherit from

Condition Classes: Classes are used when a condition exists within the sentence, such as, “The game is over when there are no empty squares left.” The condition determines when the game is over.

• Condition1

• Condition2

• Condition3

• Condition4

• Condition5

• Condition6

• Condition7

Figure 15 will show the questionWord classes.

[pic]

[pic]

Figure 15

questionWord class: Top level class that all questionWord class variations inherit from

questionWord classes: questionWord classes are used when question words such as “how”, “who”, “when” , etc are used in a sentence. Every inherited class is representative of the combinations that such words can appear in. (i.e. whether they appear as adj, pronouns, nouns, etc).

• qWord_WRB

• qWord_WDT

• qWord_WP

• qWord_WRD_JJ

The following classes do no inherit from generic

Figure 16 will show the Ontology classes

[pic]

[pic]

[pic]

[pic]

Figure 16

OntologyElement: Top level class that is inherited by the Ontology classes that represent the logical structure of a given sentence

• OntologyNot

• OntologyBinary

• OntologyPredicate

• OntologyQualifier

• OntologyTerm

• OntologyError

• OntlologyFunctionPointer

OntologyBinary is further inherited by:

• OntologyOr

• OntologyBut

• OntologyAnd

• OntologyConcat

• OntologyNor

• OntologyCondition

[pic]

[pic]

Figure 17

Figure 18 displays the different types of nouns that can exist

[pic][pic]

Figure 18

Noun_Name Class: Top level class

Noun Classes: Inherited classes which represents the different types of nouns that can exist in a sentence when a noun is present

• Noun_Pronoun

• Noun_Proper_Plural

• Noun_Proper_Singular

• Noun_Plural

• Noun_ExistentialWord

• Noun_Possessive

• Noun_Singular

[pic][pic]

Figure 19

Verb: Top level class which is inherited by the possible verbs that can exist in a sentence

Verb classes:

• VBG_gerund_or_present_participle

• VBD_verb_past_tense

• VB_verb_base

• VBN_non_3rd_person_singular_present

• VBZ_3rd_person_singular_present

[pic]

[pic]

Figure 20

Adjective: Top level class in which all adjective classes inherit from

Adjective classes:

• AdjectiveSuperlative

• AdjectiveComparative

[pic][pic]

Figure 21

_Preposition: Top level class which all types of prepositions inherit from

Preposition classes:

• RelativePrep

[pic][pic]

Figure 22

Adverb: Top level class which all adverb classes inherit from

Adverb classes:

• AdverbComparative

• AdverbSuperlative

[pic]

[pic]

Figure 23

iParse: Top Level class which all parse definitions must inherit from

iParse classes: Represent the three types of parse inputs from the POS servers

• OpenNLP_Parse

• PPOS_Parse

• StanfordNLP

[pic]

[pic]

Figure 24

GenericSemantic: Top level class which semantic classes inherit from

Semantic classes:

• Semantic_Point

• Semantic_GenderAssignment

6 Sequence Diagrams

The following sequence diagram represents the flow of information in the system. Due to the size and complexity of the system, the view has been abstracted to show the steps that the system will take to process a sentence. Because the system is being abstracted to show the flow of the information, no methods are shown, but instead a description is given at each step as to how and what is processed.

Prerequisites:

• PPOS Server is up

• OpenNLP Server is up

• StandfordNLP Server is up

Sequence of Events:

1. User starts the program

2. User enters in sentences into the program to be processed

3. User Selects the process button

4. The program sends the group of sentences to the OpenNLP server to be split

5. The split sentences are returned to the program and displayed to the user

6. The user selects the sentence that they want to process

7. The program first checks with the PPOS server.

a. If the a parse for the sentence exists on the PPOS server then no other POS servers are checked

8. The program then gets the parse trees from the OpenNLP parses

9. The OpenNLP server processes the sentence and returns the parse trees to the program

10. The program gets the parse trees from the StanfordNLP server

11. The StanfordNLP server processes the sentence and returns the parse trees to the program

12. The program concatenates the parses together and displays the top parse to the user on the appropriate tab

13. The program then processes the displayed parse to be displayed on the POviz tab

14. The program then processes the displayed parse to be displayed on the viz tab for the FOL like logic.

Post-Conditions: User sees output on the split sentences tab after the process button is clicked. The user sees output on the parse tree, POViz, and Visualization tabs after the sentence is selected on the split sentences tab.

[pic]Figurse 24

3.0 Formal Specification

model NLPProg

enum POS

{

ADJP,

ADV,

ADVP,

BNF,

CC,

CD,

CLF,

CLR,

CONJP,

DIR,

DT,

DTV,

EX,

EXT,

FRAG,

FW,

HLN,

IN,

INTJ,

JJ,

JJR,

JJS,

LGS,

LOC,

LS,

LST,

MD,

MNR,

NAC,

NN,

NNS,

NNP,

NNPS,

NOM,

NP,

NX,

PDT,

POS,

PP,

PRD,

PRN,

PRP,

PRPP,

PRPS,

PRPSS,

PRT,

PUT,

QP,

RB,

RBR,

RBS,

RP,

RRC,

S,

SBAR,

SBARQ,

SBJ,

SINV,

SQ,

SYM,

TMP,

TO,

TPC,

TTL,

UCP,

UH,

VB,

VBD,

VBG,

VBN,

VBP,

VBZ,

VOC,

VP,

WDT,

WHADJP,

WHADVP,

WHNP,

WHPP,

WP,

WPS,

WPSS,

WRB,

X

}

class OpenNLP

-- The OpenNLP server is a 3rd party application and therefore black box to the user. As -- such, the methods will not show up here in the formal specification. You may retrieve -- the source at the following url:

attributes

return : Boolean

end

class StanfordNLP

-- The StanfordNLP server is a 3rd party application and therefore black box to the user. --- As such the methods will not show up here in the formal specification. You may -- ---- -- retrieve the source at the following url:

attributes

return : Boolean

end

class NLP_Program

-- The NLP program has been abstracted and will be referred to as the NLP Program in

-- this formal specification.

-- The class diagram will provide the references to functions and attributes.

--The NLP program will be treated as a single entity

attributes

Sentences : Bag(String)

splitSentences : Bag(String)

parses : Set(String)

Visualization : ontologyDisplay

Parse : parse

POViz : PODisplay

OpenNLPconnect : Boolean

StanfordNLPconnect : Boolean

PPOSConnect : Boolean

return : Boolean

operations

splitSentences()

output(sent : String)

getOpenNLPParse(sent : String)

getStanfordNLPParse(sent : String)

getPPOSParse(sent : String)

end

class PPOSParse

attributes

sent : Set(String)

operations

Recreate(sentences : Set(String))

Retrieve() : Set(String)

Store( senStr : String)

Find (senStr : String)

Contains(senStr : String) : Boolean

end

class LithiumControl

end

class ontologyDisplay < LithiumControl

attributes

diagram : String

end

class PODisplay < LithiumControl

attributes

diagram : String

end

class parse < LithiumControl

attributes

diagram : Set(String)

sentence : String

end

class PPOS_Server

attributes

sentence : Set(String)

msg : String

parse : PPOSParse

return : Boolean

operations

Load()

Save()

end

class PPOS

attributes

tagBox : String

display : parse

operations

createRoot() : POS

navigate(currentShape : POS) : POS

unselect(currentShape : POS)

getSentence(currentShape : POS, str : String)

store(currentShape : POS, str : String) : Bag(POS)

recreate(sent : String)

getList() : Set(String)

end

--

-- ASSOCIATIONS

--

association OpenNLPRelation between

NLP_Program[*] role connectstoONLP

OpenNLP [1] role usedBy

end

association StanfordNLPRelation between

NLP_Program[*] role connecttoSNLP

StanfordNLP[1] role used

end

association PPOSRelation between

NLP_Program[*] role connectstoPPOS

PPOS_Server[1] role UB

end

association PPOSClient between

PPOS[*] role connectstoPPOS_Server

PPOS_Server[1] role UBY

end

constraints

context NLP_Program

inv connected:

NLP_Program.allInstances->forAll(n : NLP_Program | n.OpenNLPconnect = true or

n.StanfordNLPconnect = true or

n.PPOSConnect = true)

context NLP_Program::splitSentences()

pre sentencesMustExist: Sentences->notEmpty()

post everySentenceIsSplit: (Sentences->intersection(splitSentences)) = Sentences

context NLP_Program::output(sent : String)

pre sentChosenFromSplitSentences : (splitSentences->includes(sent)) = true

pre AtLeastOneServerChecked : (UB.return = true and used.return = false and usedBy.return = false) or (UB.return = false and used.return = true and usedBy.return = true)

post atLeastOneParse : parses->notEmpty()

post PODisplayed : POViz.diagram ''

post parseDisplayed : parses = Parse.diagram

post ontologyDisplayed : Visualization.diagram ''

context NLP_Program::getOpenNLPParse(sent : String)

pre PPOSParseDoesNotExist : UB.return = false

pre sentChosenFromSplitSentences : (splitSentences->includes(sent)) = true

context NLP_Program::getStanfordNLPParse(sent : String)

pre PPOSParseDoesNotExist : UB.return = false

pre sentChosenFromSplitSentences : (splitSentences->includes(sent)) = true

context NLP_Program::getPPOSParse(sent : String)

pre FirstServerChecked : used.return = false and usedBy.return = false

pre sentChosenFromSplitSentences : (splitSentences->includes(sent)) = true

context PPOSParse::Recreate(sentences : Set(String))

pre sentencesNotEmpty: sentences->notEmpty()

post sentEqualSentences: (sent->intersection(sentences)) = sentences

context PPOSParse::Retrieve(): Set(String)

post returnEverything: result = sent

context PPOSParse::Store(senStr : String)

post addSentence : (sent->includes(senStr)) = true

context PPOSParse::Find(senStr : String)

pre stringExists : sent->includes(senStr) = true

context PPOS_Server::Load()

post loadup: parse.sent->notEmpty()

context PPOS::createRoot():POS

post root: display.diagram->size() = 1

post rootisS: result = #S

context PPOS::getSentence(currentShape : POS, str : String)

pre root: currentShape = #S

post sentence: str = display.sentence

context PPOS::recreate(sent : String)

post saved: UBY.sentence->includes(sent)

context PPOS::getList() : Set(String)

post sameAsServer: result = UBY.sentence

-----------------------

[pic]

[pic]

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches