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.chartparser; 016 017 import java.util.Collection; 018 019 import ch.uzh.ifi.attempto.base.AbstractOption; 020 021 /** 022 * This interface represents a dynamic lexicon that can be used by the chart parser. 023 * 024 * @author Tobias Kuhn 025 */ 026 public interface DynamicLexicon { 027 028 /** 029 * This method should return the lexical rules for the given abstract option. Lexical rules 030 * that do not comply with this abstract option are filtered out afterwards. This method is 031 * used for the prediction of possible next tokens. The returned collection does not need to be 032 * complete. For open word classes (e.g. string and numbers) just a subset of all possible 033 * lexicon entries can be returned. 034 * 035 * @param option The abstract option. 036 * @return The lexical rules for the given abstract option. 037 */ 038 public Collection<LexicalRule> getLexRules(AbstractOption option); 039 040 /** 041 * This method should return the lexical rules with the given word (terminal category). Lexical 042 * rules with a different word are filtered out afterwards. 043 * 044 * @param word The word. 045 * @return The lexical rules with the given word as their terminal category. 046 */ 047 public Collection<LexicalRule> getLexRules(String word); 048 049 }