TEISentence.java 6.59 KB
package ipipan.clarin.tei.api.entities;

import java.util.List;

/**
 * A sentence.
 * 
 * @author mlenart
 */
public interface TEISentence extends TEIEntity {

	String getId(AnnotationLayer layer);

	void setId(AnnotationLayer layer, String id);

	String getOrth();

	/**
	 * 
	 * @return list of chosen (good) segments in this sentence
	 */
	List<TEISegment> getChosenSegments();

	/**
	 * 
	 * @return list of all segments in this sentence - including rejected ones
	 */
	List<TEISegment> getAllSegments();

	/**
	 * 
	 * @return list of morphs in this sentence
	 */
	List<TEIMorph> getMorphs();

	/**
	 * Returs a list of <b>top-level</b> (not contained in other NEs) named
	 * entities in this sentence.
	 * 
	 * In following example <code>getTopLevelNamedEntities()</code> will return
	 * only one named entity - named_5.6-s_n1
	 * 
	 * <pre>
	 * 	   &lt;s xml:id="named_5.6-s" corresp="ann_morphosyntax.xml#morph_5.6-s"&gt;
	 *             &lt;seg xml:id="named_5.6-s_n1"&gt;
	 *               &lt;fs type="named"&gt;
	 *                 &lt;f name="ne_type"&gt;
	 *                   &lt;symbol value="persName"/&gt;
	 *                 &lt;/f&gt;
	 *                 &lt;!-- ... --&gt;
	 *               &lt;/fs&gt;
	 *               &lt;ptr target="named_5.6-s_n2"/&gt;
	 *               &lt;ptr target="named_5.6-s_n3"/&gt;
	 *             &lt;/seg&gt;
	 *             &lt;seg xml:id="named_5.6-s_n2"&gt;
	 *               &lt;fs type="named"&gt;
	 *                 &lt;f name="ne_type"&gt;
	 *                   &lt;symbol value="persName"/&gt;
	 *                 &lt;/f&gt;
	 *                 &lt;!-- ... --&gt;
	 *               &lt;/fs&gt;
	 *               &lt;ptr target="ann_morphosyntax.xml#morph_5.4-seg"/&gt;
	 *             &lt;/seg&gt;
	 *             &lt;seg xml:id="named_5.6-s_n3"&gt;
	 *               &lt;fs type="named"&gt;
	 *                 &lt;f name="ne_type"&gt;
	 *                   &lt;symbol value="persName"/&gt;
	 *                 &lt;/f&gt;
	 *                 &lt;!-- ... --&gt;
	 *               &lt;/fs&gt;
	 *               &lt;ptr target="ann_morphosyntax.xml#morph_5.5-seg"/&gt;
	 *             &lt;/seg&gt;
	 *           &lt;/s&gt;
	 * </pre>
	 * 
	 * @return list of top-level named entities in this sentence
	 */
	List<TEINamedEntity> getTopLevelNamedEntities();

	/**
	 * Returs a list of <b>all</b> named entities in this sentence.
	 * 
	 * In following example <code>getAllNamedEntities()</code> will return 3
	 * named entities: - named_5.6-s_n1, named_5.6-s_n2, named_5.6-s_n3
	 * 
	 * <pre>
	 * 	   &lt;s xml:id="named_5.6-s" corresp="ann_morphosyntax.xml#morph_5.6-s"&gt;
	 *             &lt;seg xml:id="named_5.6-s_n1"&gt;
	 *               &lt;fs type="named"&gt;
	 *                 &lt;f name="ne_type"&gt;
	 *                   &lt;symbol value="persName"/&gt;
	 *                 &lt;/f&gt;
	 *                 &lt;!-- ... --&gt;
	 *               &lt;/fs&gt;
	 *               &lt;ptr target="named_5.6-s_n2"/&gt;
	 *               &lt;ptr target="named_5.6-s_n3"/&gt;
	 *             &lt;/seg&gt;
	 *             &lt;seg xml:id="named_5.6-s_n2"&gt;
	 *               &lt;fs type="named"&gt;
	 *                 &lt;f name="ne_type"&gt;
	 *                   &lt;symbol value="persName"/&gt;
	 *                 &lt;/f&gt;
	 *                 &lt;!-- ... --&gt;
	 *               &lt;/fs&gt;
	 *               &lt;ptr target="ann_morphosyntax.xml#morph_5.4-seg"/&gt;
	 *             &lt;/seg&gt;
	 *             &lt;seg xml:id="named_5.6-s_n3"&gt;
	 *               &lt;fs type="named"&gt;
	 *                 &lt;f name="ne_type"&gt;
	 *                   &lt;symbol value="persName"/&gt;
	 *                 &lt;/f&gt;
	 *                 &lt;!-- ... --&gt;
	 *               &lt;/fs&gt;
	 *               &lt;ptr target="ann_morphosyntax.xml#morph_5.5-seg"/&gt;
	 *             &lt;/seg&gt;
	 *           &lt;/s&gt;
	 * </pre>
	 * 
	 * @return list of all named entities in this sentence
	 */
	List<TEINamedEntity> getAllNamedEntities();

	/**
	 * Returns top-level words in this sentence (that is - not contained in
	 * other words). See <code>getTopLevelNamedEntities()</code> for details.
	 * 
	 * @return top-level words in this sentence
	 */
	List<TEIWord> getTopLevelWords();

	/**
	 * Returns list of all syntactic words in this sentence (see
	 * <code>getAllNamedEntities()</code> for details).
	 * 
	 * @return list of all syntactic words in this sentence
	 */
	List<TEIWord> getAllWords();

	/**
	 * Returns top-level syntactic groups in this sentence (that is - not
	 * contained in other groups). See <code>getTopLevelNamedEntities()</code>
	 * for details.
	 * 
	 * @return top-level syntactic groups in this sentence
	 */
	List<TEIGroup> getTopLevelGroups();

	/**
	 * Returns list of all syntactic groups in this sentence (see
	 * <code>getAllNamedEntities()</code> for details).
	 * 
	 * @return list of all syntactic groups in this sentence
	 */
	List<TEIGroup> getAllGroups();

	/**
	 * Returns list of deep parsing trees
	 * 
	 * @return list of tree roots
	 */
	List<TEIDeepParseTree> getDeepParsingRoots();

	/**
	 * Returns list of mentions in sentence
	 * 
	 * @return list of mentions
	 */
	List<TEIMention> getAllMentions();

	/**
	 * Sets parse result. Adds a top-level syntactic words to this sentence
	 * 
	 * @param words
	 *            top-level syntactic words list (possibly containing nested
	 *            words)
	 */
	void setSyntacticWords(List<TEIWord> words);

	/**
	 * Sets parse result. Adds a top-level syntactic groups to this sentence
	 * 
	 * @param groups
	 *            top-level syntactic groups list (possibly containing nested
	 *            groups)
	 */
	void setSyntacticGroups(List<TEIGroup> groups);

	/**
	 * Sets named entity recognition result. Adds a top-level named entities to
	 * this sentence
	 * 
	 * @param entities
	 *            top-level named entities list
	 */
	void setNERResult(List<TEINamedEntity> entities);

	/**
	 * Sets tagging result (that is list of morphs - each one corresponding to
	 * <code>TEISegment</code> at the same index.
	 * 
	 * @param morphs
	 *            morphs to set
	 */
	void setTaggingResult(List<TEIMorph> morphs);

	/**
	 * Sets deep parsing result (that is list of tree roots)
	 * 
	 * @param roots
	 *            - tree roots
	 */
	void setDeepParsingResult(List<TEIDeepParseTree> roots);

	/**
	 * Sets mention recognition result.
	 * 
	 * @param mentions
	 *            mentions list
	 */
	void setMentions(List<TEIMention> mentions);

	/**
	 * Returns <code>TEIMorph</code> with given id (if it belongs to this
	 * sentence).
	 * 
	 * @param morphId
	 *            morph id
	 * @return TEIMorph instance or null if none exists
	 */
	TEIMorph getMorphById(String morphId);

}