Package com.articulate.sigma
Class KIFAST
java.lang.Object
com.articulate.sigma.KIFAST
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intA numeric constant denoting normal parse mode, in which syntax constraints are enforced.errors generated during parsingA HashMap of String keys representing the formula, and Formula values.A HashMap of ArrayLists of Formulas.A hashMap to store term frequencies for each term in knowledge baseThe set of all terms in the knowledge base.warnings generated during parsing -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidTest method for this class.This method has the side effect of setting the contents of formulaMap and formulas as it parses the file.Get a formula at a time and send to parseBody()Read a KIF file.
-
Field Details
-
count
public static int countA numeric constant denoting normal parse mode, in which syntax constraints are enforced. -
terms
The set of all terms in the knowledge base. This is a set of Strings. -
termFrequency
A hashMap to store term frequencies for each term in knowledge base -
formulas
A HashMap of ArrayLists of Formulas. Each String key points to a list of String formulas that correspond to that key. For example, "arg-1-Foo" would be one of several keys for "(instance Foo Bar)". see #createKey(String, boolean, boolean, int, int) for key format. -
formulaMap
A HashMap of String keys representing the formula, and Formula values. For example, "(instance Foo Bar)" is a String key that might point to a Formula that is that string, along with information about at what line number and in what file it appears. -
filename
-
warningSet
warnings generated during parsing -
errorSet
errors generated during parsing
-
-
Constructor Details
-
KIFAST
public KIFAST()
-
-
Method Details
-
readFile
Read a KIF file.- Parameters:
fname- - the full pathname of the file.- Throws:
Exception
-
parseBody
- Returns:
- a Set of warnings that may indicate syntax errors, but not fatal parse errors.
-
parseNew
Get a formula at a time and send to parseBody()- Returns:
- a Set of warnings that may indicate syntax errors, but not fatal parse errors.
-
parse
This method has the side effect of setting the contents of formulaMap and formulas as it parses the file. It throws a ParseException with file line numbers if fatal errors are encountered during parsing. Keys in variable "formulas" include the string representation of the formula.- Returns:
- a Set of warnings that may indicate syntax errors, but not fatal parse errors.
-
main
Test method for this class. TODO: Currently throws a stack overflow. 2/4/25 tdn- Throws:
IOException
-