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 2017/01/30 09:50:33 UTC
opennlp git commit: OPENNLP-944: Add correction param and const back
to GIS reader/writer
Repository: opennlp
Updated Branches:
refs/heads/master 62e624280 -> cc1164194
OPENNLP-944: Add correction param and const back to GIS reader/writer
The two parameters need still to be written and read to maintain
backward compatibility with older models and 1.7.0 and 1.7.1.
Project: http://git-wip-us.apache.org/repos/asf/opennlp/repo
Commit: http://git-wip-us.apache.org/repos/asf/opennlp/commit/cc116419
Tree: http://git-wip-us.apache.org/repos/asf/opennlp/tree/cc116419
Diff: http://git-wip-us.apache.org/repos/asf/opennlp/diff/cc116419
Branch: refs/heads/master
Commit: cc116419421b8f9b53dd95c5410277c316391dae
Parents: 62e6242
Author: J�rn Kottmann <jo...@apache.org>
Authored: Mon Jan 30 10:42:23 2017 +0100
Committer: J�rn Kottmann <jo...@apache.org>
Committed: Mon Jan 30 10:42:23 2017 +0100
----------------------------------------------------------------------
.../main/java/opennlp/tools/ml/maxent/io/GISModelReader.java | 8 +++++++-
.../main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java | 6 ++++++
2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/opennlp/blob/cc116419/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
index 0050548..514e4fe 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
@@ -65,6 +65,13 @@ public class GISModelReader extends AbstractModelReader {
* GISModelReader (usually via its the constructor).
*/
public AbstractModel constructModel() throws IOException {
+
+ // read correction constant (not used anymore)
+ readInt();
+
+ // read correction params (not used anymore)
+ readDouble();
+
String[] outcomeLabels = getOutcomes();
int[][] outcomePatterns = getOutcomePatterns();
String[] predLabels = getPredicates();
@@ -78,5 +85,4 @@ public class GISModelReader extends AbstractModelReader {
System.out.println("Error: attempting to load a " + modelType
+ " model as a GIS model." + " You should expect problems.");
}
-
}
http://git-wip-us.apache.org/repos/asf/opennlp/blob/cc116419/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
index 34541d3..e11dcba 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
@@ -68,6 +68,12 @@ public abstract class GISModelWriter extends AbstractModelWriter {
// the type of model (GIS)
writeUTF("GIS");
+ // the value of the correction constant (not used anymore)
+ writeInt(1);
+
+ // the value of the correction params (not used anymore)
+ writeDouble(1);
+
// the mapping from outcomes to their integer indexes
writeInt(OUTCOME_LABELS.length);