34 |
|
|
35 |
*) |
*) |
36 |
|
|
37 |
class corpus(inputVector, outputVector, env) = |
#use "Pattern.ml" |
|
object |
|
|
val mutable _inputs = inputVector |
|
|
val mutable _outputs = outputVector |
|
|
val mutable _env : environment ref = env |
|
|
|
|
|
initializer match (inputVector, outputVector) with |
|
|
a, b when Array.length a != 0 && Array.length b != 0 -> () |
|
|
| _, _ -> !_env#toChannel "The input and output pattern are empty.\n" |
|
|
|
|
|
method getInputs = _inputs |
|
|
|
|
|
method getOutputs = _outputs |
|
38 |
|
|
39 |
method getInput index = _inputs.(index) |
class corpus = |
40 |
|
object |
41 |
method getOutput index = _outputs.(index) |
val mutable _patterns = [] |
|
|
|
|
method getPatternNumber = Array.length _inputs |
|
42 |
|
|
43 |
method getInputSize = Array.length _inputs.(0) |
method getPatterns = _patterns |
44 |
end;; |
method getPattern index = List.nth _patterns index |
45 |
|
method getPatternNumber = List.length _patterns |
46 |
|
end |