/*
 * Copyright 2008 Novamente LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * @author miross
 * Created on Mar 29, 2005
 */
package relex;

import java.io.Serializable;
import java.util.ArrayList;
import relex.output.SimpleView;

/**
 * This class encapsulates information about an input sentence
 * which is generated by Relex.  
 */
public class RelexInfo implements Serializable
{
	private static final long serialVersionUID = -3047552550351161106L;
	
	public String originalSentence;
	public ArrayList<ParsedSentence> parsedSentences;
	
	public RelexInfo(String _originalSentence, 
	                 ArrayList<ParsedSentence> _parsedSentences)
	{
		originalSentence = _originalSentence;
		parsedSentences = _parsedSentences;

		int n = 0;
		for (ParsedSentence parse: parsedSentences)
		{
			String id = "parse_" + n;
			parse.setIDString(id);
			n++;
		}
	}
	
	public String toString()
	{
		StringBuilder sb = new StringBuilder();
		int numParses = 0;
		for (ParsedSentence parse: parsedSentences)
		{
			sb.append("Parse " + ((numParses++)+1) + 
			          " of " + parsedSentences.size()).append("\n");
			sb.append(SimpleView.printRelations(parse)).append("\n");
		}
		return sb.toString();
	}
}


/*
 * Copyright 2008 Novamente LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * @author miross
 * Created on Mar 29, 2005
 */
package relex;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.UUID;

import relex.output.SimpleView;

/**
 * This class encapsulates information about an input sentence
 * which is generated by Relex.  
 */
public class RelexInfo implements Serializable
{
	private static final long serialVersionUID = -3047552550351161106L;
	
	public String originalSentence;
	public ArrayList<ParsedSentence> parsedSentences;

	private String sentenceID;
	
	public RelexInfo(String _originalSentence, 
	                 ArrayList<ParsedSentence> _parsedSentences)
	{
		originalSentence = _originalSentence;
		parsedSentences = _parsedSentences;

		// Assign a unique sentence ID to each sentence; this is required
		// for OpenCog output, where each sentence and parse needs to be 
		// tagged.
		UUID guid = UUID.randomUUID();
		sentenceID = "sentence_" + guid;

		int n = 0;
		for (ParsedSentence parse: parsedSentences)
		{
			String id = sentenceID + "_parse_" + n;
			parse.setIDString(id);
			n++;
		}
	}

	public String getID()
	{
		return sentenceID;
	}
	
	public String toString()
	{
		StringBuilder sb = new StringBuilder();
		int numParses = 0;
		for (ParsedSentence parse: parsedSentences)
		{
			sb.append("Parse " + ((numParses++)+1) + 
			          " of " + parsedSentences.size()).append("\n");
			sb.append(SimpleView.printRelations(parse)).append("\n");
		}
		return sb.toString();
	}
}


add a sentence-ID tag.