Package com.yahoo.prelude.semantics
Class RuleImporter
java.lang.Object
com.yahoo.prelude.semantics.RuleImporter
Imports rule bases from various sources.
- Author:
- bratseth
-
Constructor Summary
ConstructorsConstructorDescriptionRuleImporter(boolean ignoreAutomatas, boolean ignoreIncludes, com.yahoo.language.Linguistics linguistics) RuleImporter(boolean ignoreAutomatas, com.yahoo.language.Linguistics linguistics) RuleImporter(com.yahoo.language.Linguistics linguistics) Create a rule importer which will read from fileRuleImporter(SemanticRulesConfig config, boolean ignoreAutomatas, boolean ignoreIncludes, com.yahoo.language.Linguistics linguistics) RuleImporter(SemanticRulesConfig config, boolean ignoreAutomatas, com.yahoo.language.Linguistics linguistics) RuleImporter(SemanticRulesConfig config, com.yahoo.language.Linguistics linguistics) Create a rule importer which will read from a config object -
Method Summary
Modifier and TypeMethodDescriptionimportConfig(SemanticRulesConfig.Rulebase ruleBaseConfig) importFile(String fileName) Imports semantic rules from a fileimportFile(String fileName, String automataFile) Imports semantic rules from a fileimportFromReader(Reader reader, String sourceName, String automataFile, RuleBase ruleBase) Imports rules from a readerimportString(String string, String automataFile) importString(String string, String automataFile, String sourceName, RuleBase ruleBase) voidRead and include a rule base in anotherprivateImportConfig(SemanticRulesConfig.Rulebase ruleBaseConfig) Imports an uninitialized rule baseprivateImportFile(String fileName, String automataFile) privateImportFromReader(Reader reader, String inputSourceName, String automataFile, RuleBase ruleBase) Returns an uninitialized rule basevoidsetAutomata(RuleBase base, String automata)
-
Constructor Details
-
RuleImporter
public RuleImporter(com.yahoo.language.Linguistics linguistics) Create a rule importer which will read from file -
RuleImporter
Create a rule importer which will read from a config object -
RuleImporter
public RuleImporter(boolean ignoreAutomatas, com.yahoo.language.Linguistics linguistics) -
RuleImporter
public RuleImporter(boolean ignoreAutomatas, boolean ignoreIncludes, com.yahoo.language.Linguistics linguistics) -
RuleImporter
public RuleImporter(SemanticRulesConfig config, boolean ignoreAutomatas, com.yahoo.language.Linguistics linguistics) -
RuleImporter
public RuleImporter(SemanticRulesConfig config, boolean ignoreAutomatas, boolean ignoreIncludes, com.yahoo.language.Linguistics linguistics)
-
-
Method Details
-
importFile
Imports semantic rules from a file- Parameters:
fileName- the rule file to use- Throws:
IOException- if the file can not be read for some reasonParseException- if the file does not contain a valid semantic rule set
-
importFile
Imports semantic rules from a file- Parameters:
fileName- the rule file to useautomataFile- the automata file to use, or null to not use any- Throws:
IOException- if the file can not be read for some reasonParseException- if the file does not contain a valid semantic rule set
-
privateImportFile
public RuleBase privateImportFile(String fileName, String automataFile) throws IOException, ParseException - Throws:
IOExceptionParseException
-
include
Read and include a rule base in another- Throws:
IOExceptionParseException
-
setAutomata
-
importString
- Throws:
ParseException
-
importString
public RuleBase importString(String string, String automataFile, String sourceName, RuleBase ruleBase) throws ParseException - Throws:
ParseException
-
importConfig
- Throws:
ParseException
-
privateImportConfig
public RuleBase privateImportConfig(SemanticRulesConfig.Rulebase ruleBaseConfig) throws ParseException Imports an uninitialized rule base- Throws:
ParseException
-
importFromReader
public RuleBase importFromReader(Reader reader, String sourceName, String automataFile, RuleBase ruleBase) throws ParseException Imports rules from a reader- Parameters:
reader- the reader containing rules on the proper syntaxsourceName- a string describing the source of the rules used for error messagesruleBase- an existing rule base to import the rules into, or null to create a new one- Returns:
- the rule base containing the rules added from the reader
- Throws:
ParseException- if the reader contains illegal rule syntax
-
privateImportFromReader
public RuleBase privateImportFromReader(Reader reader, String inputSourceName, String automataFile, RuleBase ruleBase) throws ParseException Returns an uninitialized rule base- Throws:
ParseException
-