Add first draft of relex
diff --git a/tf-ner-poc/src/main/java/org/apache/opennlp/relex/EntityMention.java b/tf-ner-poc/src/main/java/org/apache/opennlp/relex/EntityMention.java
new file mode 100644
index 0000000..d773866
--- /dev/null
+++ b/tf-ner-poc/src/main/java/org/apache/opennlp/relex/EntityMention.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.opennlp.relex;
+
+import java.util.Objects;
+
+import opennlp.tools.parser.Parse;
+
+public class EntityMention {
+
+ private final Parse parse;
+ private final int entityId;
+
+ public EntityMention(Parse parse, int entityId) {
+ this.parse = Objects.requireNonNull(parse);
+ this.entityId = entityId;
+ }
+
+ public Parse getParse() {
+ return parse;
+ }
+
+ public int getEntityId() {
+ return entityId;
+ }
+}
diff --git a/tf-ner-poc/src/main/java/org/apache/opennlp/relex/Relation.java b/tf-ner-poc/src/main/java/org/apache/opennlp/relex/Relation.java
new file mode 100644
index 0000000..c9b1f55
--- /dev/null
+++ b/tf-ner-poc/src/main/java/org/apache/opennlp/relex/Relation.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.opennlp.relex;
+
+public class Relation {
+
+ private final int subject;
+ private final String predicate;
+ private final int object;
+
+ public Relation(int subject, String predicate, int object) {
+ this.subject = subject;
+ this.predicate = predicate;
+ this.object = object;
+ }
+}
diff --git a/tf-ner-poc/src/main/java/org/apache/opennlp/relex/RelationExtractor.java b/tf-ner-poc/src/main/java/org/apache/opennlp/relex/RelationExtractor.java
new file mode 100644
index 0000000..4a55576
--- /dev/null
+++ b/tf-ner-poc/src/main/java/org/apache/opennlp/relex/RelationExtractor.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.opennlp.relex;
+
+public class RelationExtractor {
+
+ // TODO: This type of interface would limit the extractor to look
+ // only at sentences that contains entities.
+ // This is borrowed from the old coref component.
+
+ public Relation[] extract(EntityMention[] mentions) {
+ return null;
+ }
+}
diff --git a/tf-ner-poc/src/main/python/relex/relex.py b/tf-ner-poc/src/main/python/relex/relex.py
new file mode 100644
index 0000000..62ca965
--- /dev/null
+++ b/tf-ner-poc/src/main/python/relex/relex.py
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import tensorflow as tf
+
+
+# load_date
+# which format ??? we could write some java tool to extract data from brat corpus
+# and export it into a format that can be used easier to train the tool
+
+
+def main():
+ pass
+
+def create_graph():
+ pass
+
+if __name__ == "__main__":
+ main()