Class NegativeExampleLoader
java.lang.Object
org.ek9lang.assist.NegativeExampleLoader
Loads negative training examples from directories containing .ek9 files.
Recursively scans a given directory for .ek9 files with JSON headers
(between <?- and -?>) containing error metadata, and code bodies
with @Error directives that are stripped for training output.
Files with plain-text (non-JSON) headers or no error information are skipped.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExtract error codes from @Error directives in the code body.(package private) NegativeExampleloadFromDirectory(Path corpusDir) Recursively scan a directory for .ek9 files and load negative training examples.(package private) StringstripDirectives(String code) Strip all directive lines (@Error, @Resolved, @Complexity, @IR, @BYTECODE) from code.
-
Constructor Details
-
NegativeExampleLoader
public NegativeExampleLoader()
-
-
Method Details
-
loadFromDirectory
Recursively scan a directory for .ek9 files and load negative training examples. Any .ek9 file with a JSON header containing error metadata is included.- Parameters:
corpusDir- the root directory to scan- Returns:
- list of parsed negative examples
- Throws:
IOException
-
loadFile
- Throws:
IOException
-
stripDirectives
-
extractErrorsFromDirectives
-