You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2019/01/11 12:47:08 UTC

[opennlp-sandbox] branch relex updated (b5f228f -> 874d933)

This is an automated email from the ASF dual-hosted git repository.

joern pushed a change to branch relex
in repository https://gitbox.apache.org/repos/asf/opennlp-sandbox.git.


 discard b5f228f  Add first draft of relex
     new 874d933  Add first draft of relex

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b5f228f)
            \
             N -- N -- N   refs/heads/relex (874d933)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/opennlp/relex/EntityMention.java    | 17 +++++++++++++++++
 .../main/java/org/apache/opennlp/relex/Relation.java    | 17 +++++++++++++++++
 .../org/apache/opennlp/relex/RelationExtractor.java     | 17 +++++++++++++++++
 3 files changed, 51 insertions(+)


[opennlp-sandbox] 01/01: Add first draft of relex

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joern pushed a commit to branch relex
in repository https://gitbox.apache.org/repos/asf/opennlp-sandbox.git

commit 874d93383adbfca65842af27beeea54c85cc86b4
Author: Jörn Kottmann <jo...@apache.org>
AuthorDate: Wed Jul 4 12:24:30 2018 +0200

    Add first draft of relex
---
 .../org/apache/opennlp/relex/EntityMention.java    | 41 ++++++++++++++++++++++
 .../java/org/apache/opennlp/relex/Relation.java    | 31 ++++++++++++++++
 .../apache/opennlp/relex/RelationExtractor.java    | 29 +++++++++++++++
 tf-ner-poc/src/main/python/relex/relex.py          | 35 ++++++++++++++++++
 4 files changed, 136 insertions(+)

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()