SourceText
Class SourceText

java.lang.Object
  |
  +--SourceText.SourceText

public class SourceText
extends java.lang.Object

Builds a semantic network from an English description.

See the dissertation document for more details.

SCENE       := 'The scene contains' CONCEPTS '.' DESCRIPTOR*
CONCEPTS    := ['a'|'an'] CONCEPT ['named' INSTANCE] [',' ['and'] CONCEPTS]
DESCRIPTOR  := IDENTIFIER 'is' DESCRIPTION '.'
DESCRIPTION := ((ADJECTIVE | (PREPOSITION IDENTIFIER)) [',' ['and'] DESCRIPTION]
IDENTIFIER  := 'the ' CONCEPT) | INSTANCE
INSTANCE    := single-word alphanumeric string
CONCEPT     := concept name
ADJECTIVE   := attribute name
PREPOSITION := relation name
 

Version:
Created 8 December 2003
Author:
Dan Tappan

Field Summary
private  java.util.LinkedList m_attribute_names
           
private  java.util.LinkedList m_concept_names
           
private  KnowledgeBase m_knowledge_base
           
private  java.util.LinkedList m_relation_names
           
private  SemanticNetwork m_semantic_network
           
private  java.lang.String m_source_text_postprocessed
           
private  java.lang.String m_source_text_preprocessed
           
 
Constructor Summary
SourceText(java.lang.String source_text, KnowledgeBase knowledge_base, java.lang.String semantic_network_name, java.lang.String semantic_network_description)
          Creates a SourceText object with the given description.
 
Method Summary
private  void buildCrossreferenceList(java.util.Collection source_list, java.util.LinkedList target_list)
          Sorts the contents of the source list descending by length and adds them to the target list.
private  void buildSemanticNetwork()
          Builds the semantic network.
 SemanticNetwork getSemanticNetwork()
          Returns the semantic network built from the source text.
 java.lang.String getSourceTextPostprocessed()
          Returns the postprocessed source text.
 java.lang.String getSourceTextPreprocessed()
          Returns the preprocessed source text.
private  void preprocessText()
          Formats the source text and combines registered multiword units (e.g., 'in front of') into single units for parsing (i.e., 'in-front-of').
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_source_text_preprocessed

private java.lang.String m_source_text_preprocessed

m_source_text_postprocessed

private java.lang.String m_source_text_postprocessed

m_knowledge_base

private KnowledgeBase m_knowledge_base

m_semantic_network

private SemanticNetwork m_semantic_network

m_concept_names

private java.util.LinkedList m_concept_names

m_relation_names

private java.util.LinkedList m_relation_names

m_attribute_names

private java.util.LinkedList m_attribute_names
Constructor Detail

SourceText

public SourceText(java.lang.String source_text,
                  KnowledgeBase knowledge_base,
                  java.lang.String semantic_network_name,
                  java.lang.String semantic_network_description)
           throws java.lang.Exception
Creates a SourceText object with the given description.

Parameters:
source_text - - the source-text description
knowledge_base - - the knowledge base
semantic_network_name - - the name to assign to the semantic network to build
semantic_network_description - - the optional description to assign to the semantic network
Throws:
java.lang.Exception - - if parsing fails
Method Detail

buildCrossreferenceList

private void buildCrossreferenceList(java.util.Collection source_list,
                                     java.util.LinkedList target_list)
Sorts the contents of the source list descending by length and adds them to the target list. This is used to pattern match the longest string when crossreferencing source-text and concept lexemes.

Parameters:
source_list - - the source list
target_list - - the target list

buildSemanticNetwork

private void buildSemanticNetwork()
                           throws java.lang.Exception
Builds the semantic network.

java.lang.Exception

getSemanticNetwork

public SemanticNetwork getSemanticNetwork()
Returns the semantic network built from the source text.

Returns:
the semantic network

getSourceTextPostprocessed

public java.lang.String getSourceTextPostprocessed()
Returns the postprocessed source text.

Returns:
the text

getSourceTextPreprocessed

public java.lang.String getSourceTextPreprocessed()
Returns the preprocessed source text.

Returns:
the text

preprocessText

private void preprocessText()
Formats the source text and combines registered multiword units (e.g., 'in front of') into single units for parsing (i.e., 'in-front-of').


toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
the String representation
See Also:
Support.toPrettyString(java.lang.String)