001 // This file is part of AceWiki. 002 // Copyright 2008-2012, AceWiki developers. 003 // 004 // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU 005 // Lesser General Public License as published by the Free Software Foundation, either version 3 of 006 // the License, or (at your option) any later version. 007 // 008 // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 010 // Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If 013 // not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.acewiki.core; 016 017 import java.util.List; 018 019 import ch.uzh.ifi.attempto.base.PredictiveParser; 020 import ch.uzh.ifi.attempto.base.TextContainer; 021 import ch.uzh.ifi.attempto.base.TextOperator; 022 023 /** 024 * This interface represents the language-specific parts of the AceWiki engine. 025 * 026 * @author Tobias Kuhn 027 */ 028 public interface LanguageHandler { 029 030 /** 031 * This is the first method to be called and provides the ontology object. 032 * 033 * @param ontology The ontology object. 034 */ 035 public void init(Ontology ontology); 036 037 /** 038 * Returns the text operator. 039 * 040 * @return The text operator. 041 */ 042 public TextOperator getTextOperator(); 043 044 /** 045 * Returns the language of this language handler. Null can be returned for monolingual engines. 046 * 047 * @return The name of the language or null. 048 */ 049 public String getLanguage(); 050 051 /** 052 * Extracts the sentences from a text container and/or a parser state. 053 * 054 * @param tc The text container. 055 * @param parser The parser object with the parsed text. 056 * @return A list of sentences. 057 */ 058 public List<Sentence> extractSentences(TextContainer tc, PredictiveParser parser); 059 060 /** 061 * Returns the predictive parser to be used within the predictive editor. 062 * 063 * @return The predictive parser. 064 */ 065 public PredictiveParser getPredictiveParser(); 066 067 /** 068 * Returns the controller object for the predictive editor. 069 * 070 * @return The editor controller. 071 */ 072 public EditorController getEditorController(); 073 074 /** 075 * Returns a lexicon changer object for the given lexical type. 076 * 077 * @param type The lexical type. 078 * @return A lexicon changer object. 079 */ 080 public LexiconChanger getLexiconChanger(String type); 081 082 /** 083 * Returns a suggestion to change a newly created sentence, or null (no suggestion). 084 * 085 * @param sentence The newly created sentence. 086 * @return A suggestion to change the sentence or null. 087 */ 088 public SentenceSuggestion getSuggestion(Sentence sentence); 089 090 }