Github user myui commented on a diff in the pull request:
https://github.com/apache/incubator-hivemall/pull/93#discussion_r125178624
--- Diff: core/src/main/java/hivemall/smile/tools/MatrixEventStream.java ---
@@ -0,0 +1,79 @@
+package hivemall.smile.tools;
+
+import java.util.Iterator;
+import java.util.List;
+
+import hivemall.math.matrix.Matrix;
+import hivemall.smile.data.Attribute;
+import hivemall.smile.data.Attribute.AttributeType;
+import opennlp.model.AbstractEventStream;
+import opennlp.model.Event;
+
+public class MatrixEventStream extends AbstractEventStream {
+ Matrix ds;
+ int[] y;
+ Attribute[] attrs;
+ int rowNum;
+ Event next;
+
+ public MatrixEventStream (Matrix ds, int[] y, Attribute[] attrs) {
+ this.ds = ds;
+ this.y = y;
+ this.attrs = attrs;
+ rowNum = 0;
+
+ if (rowNum < ds.numRows()){
+ next = createEvent(ds.getRow(rowNum), y[rowNum]);
+ };
+ }
+
+ /**
+ * Returns the next Event object held in this EventStream. Each call
to nextEvent advances the EventStream.
+ *
+ * @return the Event object which is next in this EventStream
+ */
+ public Event next () {
+ while (next == null && (rowNum < ds.numRows()))
--- End diff --
`{}` is needed to [Google coding
style](https://google.github.io/styleguide/javaguide.html#s4.1.2-blocks-k-r-style)
that Hivemall follows.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---