You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/09/14 13:30:58 UTC
[1/4] incubator-joshua git commit: Moved regression test
decoder/do-not-crash to unit test and refactored code to reuse utility test
functions.
Repository: incubator-joshua
Updated Branches:
refs/heads/master e199d8514 -> dc55f07a9
Moved regression test decoder/do-not-crash to unit test and refactored code to reuse utility test functions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/74d80065
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/74d80065
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/74d80065
Branch: refs/heads/master
Commit: 74d800657377a05ded552cb5b2b26c46a5b6bc52
Parents: e199d85
Author: Michael A. Hedderich <mi...@users.noreply.github.com>
Authored: Wed Sep 14 14:32:35 2016 +0200
Committer: Michael A. Hedderich <mi...@users.noreply.github.com>
Committed: Wed Sep 14 14:32:35 2016 +0200
----------------------------------------------------------------------
.../joshua/decoder/cky/BnEnDecodingTest.java | 121 +++++++++++++++
.../joshua/decoder/cky/CKYDecodingTest.java | 151 -------------------
.../joshua/decoder/cky/DoNotCrashTest.java | 63 ++++++++
.../org/apache/joshua/decoder/cky/TestUtil.java | 87 +++++++++++
src/test/resources/decoder/dont-crash/test.sh | 29 ----
5 files changed, 271 insertions(+), 180 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/74d80065/src/test/java/org/apache/joshua/decoder/cky/BnEnDecodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/BnEnDecodingTest.java b/src/test/java/org/apache/joshua/decoder/cky/BnEnDecodingTest.java
new file mode 100644
index 0000000..d11d58f
--- /dev/null
+++ b/src/test/java/org/apache/joshua/decoder/cky/BnEnDecodingTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.joshua.decoder.cky;
+
+import static org.apache.joshua.decoder.cky.TestUtil.decodeList;
+import static org.apache.joshua.decoder.cky.TestUtil.loadStringsFromFile;
+import static org.testng.Assert.assertEquals;
+
+import java.util.List;
+
+import org.apache.joshua.decoder.Decoder;
+import org.apache.joshua.decoder.JoshuaConfiguration;
+import org.apache.joshua.util.io.KenLmTestUtil;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+public class BnEnDecodingTest {
+
+ private JoshuaConfiguration joshuaConfig;
+ private Decoder decoder;
+
+ @AfterMethod
+ public void tearDown() throws Exception {
+ if(decoder != null) {
+ decoder.cleanUp();
+ decoder = null;
+ }
+ }
+
+ @Test
+ public void givenBnEnInput_whenPhraseDecoding_thenScoreAndTranslationCorrect() throws Exception {
+ // Given
+ List<String> inputStrings = loadStringsFromFile("src/test/resources/bn-en/hiero/input.bn");
+
+ // When
+ configureDecoder("src/test/resources/bn-en/hiero/joshua.config");
+ List<String> decodedStrings = decodeList(inputStrings, decoder, joshuaConfig);
+
+ // Then
+ List<String> goldStrings = loadStringsFromFile("src/test/resources/bn-en/hiero/output.gold");
+ assertEquals(decodedStrings, goldStrings);
+ }
+
+ @Test
+ public void givenBnEnInput_whenPhraseDecodingWithBerkeleyLM_thenScoreAndTranslationCorrect() throws Exception {
+ // Given
+ List<String> inputStrings = loadStringsFromFile("src/test/resources/bn-en/hiero/input.bn");
+
+ // When
+ configureDecoder("src/test/resources/bn-en/hiero/joshua-berkeleylm.config");
+ List<String> decodedStrings = decodeList(inputStrings, decoder, joshuaConfig);
+
+ // Then
+ List<String> goldStrings = loadStringsFromFile("src/test/resources/bn-en/hiero/output-berkeleylm.gold");
+ assertEquals(decodedStrings, goldStrings);
+ }
+
+ @Test
+ public void givenBnEnInput_whenPhraseDecodingWithClassLM_thenScoreAndTranslationCorrect() throws Exception {
+ // Given
+ List<String> inputStrings = loadStringsFromFile("src/test/resources/bn-en/hiero/input.bn");
+
+ // When
+ configureDecoder("src/test/resources/bn-en/hiero/joshua-classlm.config");
+ List<String> decodedStrings = decodeList(inputStrings, decoder, joshuaConfig);
+
+ // Then
+ List<String> goldStrings = loadStringsFromFile("src/test/resources/bn-en/hiero/output-classlm.gold");
+ assertEquals(decodedStrings, goldStrings);
+ }
+
+ @Test
+ public void givenBnEnInput_whenPhraseDecodingWithPackedGrammar_thenScoreAndTranslationCorrect() throws Exception {
+ // Given
+ List<String> inputStrings = loadStringsFromFile("src/test/resources/bn-en/packed/input.bn");
+
+ // When
+ configureDecoder("src/test/resources/bn-en/packed/joshua.config");
+ List<String> decodedStrings = decodeList(inputStrings, decoder, joshuaConfig);
+
+ // Then
+ List<String> goldStrings = loadStringsFromFile("src/test/resources/bn-en/packed/output.gold");
+ assertEquals(decodedStrings, goldStrings);
+ }
+
+ @Test
+ public void givenBnEnInput_whenPhraseDecodingWithSAMT_thenScoreAndTranslationCorrect() throws Exception {
+ // Given
+ List<String> inputStrings = loadStringsFromFile("src/test/resources/bn-en/samt/input.bn");
+
+ // When
+ configureDecoder("src/test/resources/bn-en/samt/joshua.config");
+ List<String> decodedStrings = decodeList(inputStrings, decoder, joshuaConfig);
+
+ // Then
+ List<String> goldStrings = loadStringsFromFile("src/test/resources/bn-en/samt/output.gold");
+ assertEquals(decodedStrings, goldStrings);
+ }
+
+ public void configureDecoder(String pathToConfig) throws Exception {
+ joshuaConfig = new JoshuaConfiguration();
+ joshuaConfig.readConfigFile(pathToConfig);
+ KenLmTestUtil.Guard(() -> decoder = new Decoder(joshuaConfig, ""));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/74d80065/src/test/java/org/apache/joshua/decoder/cky/CKYDecodingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/CKYDecodingTest.java b/src/test/java/org/apache/joshua/decoder/cky/CKYDecodingTest.java
deleted file mode 100644
index c34ee41..0000000
--- a/src/test/java/org/apache/joshua/decoder/cky/CKYDecodingTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.joshua.decoder.cky;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.apache.joshua.decoder.Decoder;
-import org.apache.joshua.decoder.JoshuaConfiguration;
-import org.apache.joshua.decoder.segment_file.Sentence;
-import org.apache.joshua.util.io.KenLmTestUtil;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-public class CKYDecodingTest {
-
- private final static String N_BEST_SEPARATOR = "\n";
-
- private JoshuaConfiguration joshuaConfig;
- private Decoder decoder;
-
- @AfterMethod
- public void tearDown() throws Exception {
- if(decoder != null) {
- decoder.cleanUp();
- decoder = null;
- }
- }
-
- @Test
- public void givenBnEnInput_whenPhraseDecoding_thenScoreAndTranslationCorrect() throws Exception {
- // Given
- List<String> inputStrings = loadSentencesFromFile("src/test/resources/bn-en/hiero/input.bn");
-
- // When
- configureDecoder("src/test/resources/bn-en/hiero/joshua.config");
- List<String> decodedStrings = decodeList(inputStrings);
-
- // Then
- List<String> goldStrings = loadSentencesFromFile("src/test/resources/bn-en/hiero/output.gold");
- assertEquals(decodedStrings, goldStrings);
- }
-
- @Test
- public void givenBnEnInput_whenPhraseDecodingWithBerkeleyLM_thenScoreAndTranslationCorrect() throws Exception {
- // Given
- List<String> inputStrings = loadSentencesFromFile("src/test/resources/bn-en/hiero/input.bn");
-
- // When
- configureDecoder("src/test/resources/bn-en/hiero/joshua-berkeleylm.config");
- List<String> decodedStrings = decodeList(inputStrings);
-
- // Then
- List<String> goldStrings = loadSentencesFromFile("src/test/resources/bn-en/hiero/output-berkeleylm.gold");
- assertEquals(decodedStrings, goldStrings);
- }
-
- @Test
- public void givenBnEnInput_whenPhraseDecodingWithClassLM_thenScoreAndTranslationCorrect() throws Exception {
- // Given
- List<String> inputStrings = loadSentencesFromFile("src/test/resources/bn-en/hiero/input.bn");
-
- // When
- configureDecoder("src/test/resources/bn-en/hiero/joshua-classlm.config");
- List<String> decodedStrings = decodeList(inputStrings);
-
- // Then
- List<String> goldStrings = loadSentencesFromFile("src/test/resources/bn-en/hiero/output-classlm.gold");
- assertEquals(decodedStrings, goldStrings);
- }
-
- @Test
- public void givenBnEnInput_whenPhraseDecodingWithPackedGrammar_thenScoreAndTranslationCorrect() throws Exception {
- // Given
- List<String> inputStrings = loadSentencesFromFile("src/test/resources/bn-en/packed/input.bn");
-
- // When
- configureDecoder("src/test/resources/bn-en/packed/joshua.config");
- List<String> decodedStrings = decodeList(inputStrings);
-
- // Then
- List<String> goldStrings = loadSentencesFromFile("src/test/resources/bn-en/packed/output.gold");
- assertEquals(decodedStrings, goldStrings);
- }
-
- @Test
- public void givenBnEnInput_whenPhraseDecodingWithSAMT_thenScoreAndTranslationCorrect() throws Exception {
- // Given
- List<String> inputStrings = loadSentencesFromFile("src/test/resources/bn-en/samt/input.bn");
-
- // When
- configureDecoder("src/test/resources/bn-en/samt/joshua.config");
- List<String> decodedStrings = decodeList(inputStrings);
-
- // Then
- List<String> goldStrings = loadSentencesFromFile("src/test/resources/bn-en/samt/output.gold");
- assertEquals(decodedStrings, goldStrings);
- }
-
- private static List<String> loadSentencesFromFile(String pathToFile) throws IOException {
- List<String> inputLines = Files.lines(Paths.get(pathToFile)).collect(Collectors.toList());
- return inputLines;
- }
-
- private void configureDecoder(String pathToConfig) throws Exception {
- joshuaConfig = new JoshuaConfiguration();
- joshuaConfig.readConfigFile(pathToConfig);
- KenLmTestUtil.Guard(() -> decoder = new Decoder(joshuaConfig, ""));
- }
-
- /**
- * @param inputStrings A list of strings that should be decoded
- * @return A list of decoded strings. If the decoder produces
- * an n-best list, then each translation of the n-best list
- * has its own entry in the returned list.
- */
- private List<String> decodeList(List<String> inputStrings) {
- final List<String> decodedStrings = new ArrayList<>();
-
- for (String inputString : inputStrings) {
- final Sentence sentence = new Sentence(inputString, 0, joshuaConfig);
- final String[] nBestList = decoder.decode(sentence).toString().split(N_BEST_SEPARATOR);
- decodedStrings.addAll(Arrays.asList(nBestList));
- }
-
- return decodedStrings;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/74d80065/src/test/java/org/apache/joshua/decoder/cky/DoNotCrashTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/DoNotCrashTest.java b/src/test/java/org/apache/joshua/decoder/cky/DoNotCrashTest.java
new file mode 100644
index 0000000..88e264f
--- /dev/null
+++ b/src/test/java/org/apache/joshua/decoder/cky/DoNotCrashTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.joshua.decoder.cky;
+
+import static org.apache.joshua.decoder.cky.TestUtil.decodeList;
+import static org.apache.joshua.decoder.cky.TestUtil.loadStringsFromFile;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.joshua.decoder.Decoder;
+import org.apache.joshua.decoder.JoshuaConfiguration;
+import org.apache.joshua.util.io.KenLmTestUtil;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class DoNotCrashTest {
+
+ private JoshuaConfiguration joshuaConfig = null;
+ private Decoder decoder = null;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ joshuaConfig = new JoshuaConfiguration();
+ KenLmTestUtil.Guard(() -> decoder = new Decoder(joshuaConfig, ""));
+ }
+
+ @AfterMethod
+ public void tearDown() throws Exception {
+ decoder.cleanUp();
+ decoder = null;
+ }
+
+ @Test
+ public void givenProblematicInput_whenDecoding_thenNoCrash() throws IOException {
+ // Given
+ List<String> inputStrings = loadStringsFromFile("src/test/resources/decoder/dont-crash/input");
+
+ // When
+ decodeList(inputStrings, decoder, joshuaConfig);
+
+ // Then
+ // Did not crash
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/74d80065/src/test/java/org/apache/joshua/decoder/cky/TestUtil.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/TestUtil.java b/src/test/java/org/apache/joshua/decoder/cky/TestUtil.java
new file mode 100644
index 0000000..35800c6
--- /dev/null
+++ b/src/test/java/org/apache/joshua/decoder/cky/TestUtil.java
@@ -0,0 +1,87 @@
+/*
+ * 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.joshua.decoder.cky;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.joshua.decoder.Decoder;
+import org.apache.joshua.decoder.JoshuaConfiguration;
+import org.apache.joshua.decoder.segment_file.Sentence;
+
+public class TestUtil {
+
+ public static final String N_BEST_SEPARATOR = "\n";
+
+ /**
+ * Loads a text file and returns a list containing one string per line
+ * in the file.
+ * @param pathToFile
+ * @return
+ * @throws IOException
+ */
+ public static List<String> loadStringsFromFile(String pathToFile) throws IOException {
+ List<String> inputLines = Files.lines(Paths.get(pathToFile)).collect(Collectors.toList());
+ return inputLines;
+ }
+
+ /**
+ *
+ * @param inputStrings
+ * A list of strings that should be decoded,
+ * @param decoder
+ * An initialized decoder,
+ * @param joshuaConfig
+ * The JoshuaConfiguration corresponding to the decoder.
+ * @return A list of decoded strings. If the decoder produces a n-best list
+ * (separated by N_BEST_SEPARATOR), then each translation of the
+ * n-best list has its own entry in the returned list.
+ */
+ public static List<String> decodeList(List<String> inputStrings, Decoder decoder,
+ JoshuaConfiguration joshuaConfig) {
+ final List<String> decodedStrings = new ArrayList<>();
+
+ for (String inputString : inputStrings) {
+ final Sentence sentence = new Sentence(inputString, 0, joshuaConfig);
+ final String[] nBestList = decoder.decode(sentence).toString().split(N_BEST_SEPARATOR);
+ decodedStrings.addAll(Arrays.asList(nBestList));
+ }
+
+ return decodedStrings;
+ }
+
+ /**
+ * Translates the given input string and returns the translation
+ * converted into a string.
+ * @param input
+ * @param decoder
+ * @param joshuaConfig
+ * @return
+ */
+ public static String translate(String input, Decoder decoder, JoshuaConfiguration joshuaConfig) {
+ final Sentence sentence = new Sentence(input, 0, joshuaConfig);
+ return decoder.decode(sentence).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/74d80065/src/test/resources/decoder/dont-crash/test.sh
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/dont-crash/test.sh b/src/test/resources/decoder/dont-crash/test.sh
deleted file mode 100755
index 182ae82..0000000
--- a/src/test/resources/decoder/dont-crash/test.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-set -u
-
-cat input | $JOSHUA/bin/joshua-decoder -output-format %s > output 2> log
-
-diff -u output input > diff
-
-if [ $? -eq 0 ]; then
- rm -f log output diff
- exit 0
-else
- exit 1
-fi
[2/4] incubator-joshua git commit: Moved regression test
decoder/empty-test to unit test.
Posted by mj...@apache.org.
Moved regression test decoder/empty-test to unit test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/0871742c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/0871742c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/0871742c
Branch: refs/heads/master
Commit: 0871742c7b6512260053969af75c1c2a91ae323a
Parents: 74d8006
Author: Michael A. Hedderich <mi...@users.noreply.github.com>
Authored: Wed Sep 14 14:58:56 2016 +0200
Committer: Michael A. Hedderich <mi...@users.noreply.github.com>
Committed: Wed Sep 14 14:58:56 2016 +0200
----------------------------------------------------------------------
.../joshua/decoder/cky/NoGrammarTest.java | 43 ++++++++++++++++++++
.../resources/decoder/empty-test/.gitignore | 3 --
src/test/resources/decoder/empty-test/input | 1 -
.../resources/decoder/empty-test/output.gold | 1 -
src/test/resources/decoder/empty-test/test.sh | 29 -------------
5 files changed, 43 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/0871742c/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java b/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java
new file mode 100644
index 0000000..847ac86
--- /dev/null
+++ b/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java
@@ -0,0 +1,43 @@
+package org.apache.joshua.decoder.cky;
+
+import static org.apache.joshua.decoder.cky.TestUtil.translate;
+import static org.testng.Assert.assertEquals;
+
+import org.apache.joshua.decoder.Decoder;
+import org.apache.joshua.decoder.JoshuaConfiguration;
+import org.apache.joshua.util.io.KenLmTestUtil;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class NoGrammarTest {
+
+ private static final String INPUT = "those who hurt others hurt themselves";
+ private static final String GOLD = "0 ||| those_OOV who_OOV hurt_OOV others_OOV hurt_OOV themselves_OOV ||| tm_glue_0=6.000 ||| 0.000";
+
+ private JoshuaConfiguration joshuaConfig = null;
+ private Decoder decoder = null;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ joshuaConfig = new JoshuaConfiguration();
+ joshuaConfig.mark_oovs = true;
+ KenLmTestUtil.Guard(() -> decoder = new Decoder(joshuaConfig, ""));
+ }
+
+ @AfterMethod
+ public void tearDown() throws Exception {
+ decoder.cleanUp();
+ decoder = null;
+ }
+
+ @Test
+ public void givenInput_whenDecodingWithoutGrammar_thenOutputAllOOV() {
+ String output = translate(INPUT, decoder, joshuaConfig);
+ assertEquals(output.trim(), GOLD);
+ }
+
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/0871742c/src/test/resources/decoder/empty-test/.gitignore
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/empty-test/.gitignore b/src/test/resources/decoder/empty-test/.gitignore
deleted file mode 100644
index cf5f806..0000000
--- a/src/test/resources/decoder/empty-test/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-diff
-output
-log
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/0871742c/src/test/resources/decoder/empty-test/input
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/empty-test/input b/src/test/resources/decoder/empty-test/input
deleted file mode 100644
index ed95e87..0000000
--- a/src/test/resources/decoder/empty-test/input
+++ /dev/null
@@ -1 +0,0 @@
-those who hurt others hurt themselves
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/0871742c/src/test/resources/decoder/empty-test/output.gold
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/empty-test/output.gold b/src/test/resources/decoder/empty-test/output.gold
deleted file mode 100644
index c914a56..0000000
--- a/src/test/resources/decoder/empty-test/output.gold
+++ /dev/null
@@ -1 +0,0 @@
-0 ||| those_OOV who_OOV hurt_OOV others_OOV hurt_OOV themselves_OOV ||| tm_glue_0=6.000 ||| 0.000
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/0871742c/src/test/resources/decoder/empty-test/test.sh
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/empty-test/test.sh b/src/test/resources/decoder/empty-test/test.sh
deleted file mode 100755
index 452fbc3..0000000
--- a/src/test/resources/decoder/empty-test/test.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-set -u
-
-cat input | $JOSHUA/bin/joshua-decoder -mark-oovs true > output 2> log
-
-diff -u output output.gold > diff
-
-if [ $? -eq 0 ]; then
- rm -f log output diff
- exit 0
-else
- exit 1
-fi
[3/4] incubator-joshua git commit: Moved regression test
decoder/constrained to unit test. Cleaned up the corresponding directory.
Posted by mj...@apache.org.
Moved regression test decoder/constrained to unit test. Cleaned up the corresponding directory.
Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/99c791d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/99c791d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/99c791d1
Branch: refs/heads/master
Commit: 99c791d1d54702061aafeb7678e88ae40521b419
Parents: 0871742
Author: Michael A. Hedderich <mi...@users.noreply.github.com>
Authored: Wed Sep 14 15:12:46 2016 +0200
Committer: Michael A. Hedderich <mi...@users.noreply.github.com>
Committed: Wed Sep 14 15:12:46 2016 +0200
----------------------------------------------------------------------
.../joshua/decoder/cky/ConstrainedTest.java | 65 ++++++++++++++++++++
.../resources/decoder/constrained/gold.scores | 27 --------
.../resources/decoder/constrained/joshua.config | 8 +--
.../resources/decoder/constrained/output.bleu | 0
.../resources/decoder/constrained/output.gold | 60 +++++++++---------
src/test/resources/decoder/constrained/test.sh | 30 ---------
src/test/resources/decoder/constrained/weights | 22 -------
7 files changed, 99 insertions(+), 113 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/99c791d1/src/test/java/org/apache/joshua/decoder/cky/ConstrainedTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/ConstrainedTest.java b/src/test/java/org/apache/joshua/decoder/cky/ConstrainedTest.java
new file mode 100644
index 0000000..53bab7a
--- /dev/null
+++ b/src/test/java/org/apache/joshua/decoder/cky/ConstrainedTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.joshua.decoder.cky;
+
+import static org.apache.joshua.decoder.cky.TestUtil.decodeList;
+import static org.apache.joshua.decoder.cky.TestUtil.loadStringsFromFile;
+import static org.testng.Assert.assertEquals;
+
+import java.util.List;
+
+import org.apache.joshua.decoder.Decoder;
+import org.apache.joshua.decoder.JoshuaConfiguration;
+import org.apache.joshua.util.io.KenLmTestUtil;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+public class ConstrainedTest {
+
+ private JoshuaConfiguration joshuaConfig;
+ private Decoder decoder;
+
+ @AfterMethod
+ public void tearDown() throws Exception {
+ if(decoder != null) {
+ decoder.cleanUp();
+ decoder = null;
+ }
+ }
+
+ @Test
+ public void givenInput_whenConstrainedDecoding_thenScoreAndTranslationCorrect() throws Exception {
+ // Given
+ List<String> inputStrings = loadStringsFromFile("src/test/resources/decoder/constrained/input.bn");
+
+ // When
+ configureDecoder("src/test/resources/decoder/constrained/joshua.config");
+ List<String> decodedStrings = decodeList(inputStrings, decoder, joshuaConfig);
+
+ // Then
+ List<String> goldStrings = loadStringsFromFile("src/test/resources/decoder/constrained/output.gold");
+ assertEquals(decodedStrings, goldStrings);
+ }
+
+ public void configureDecoder(String pathToConfig) throws Exception {
+ joshuaConfig = new JoshuaConfiguration();
+ joshuaConfig.readConfigFile(pathToConfig);
+ KenLmTestUtil.Guard(() -> decoder = new Decoder(joshuaConfig, ""));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/99c791d1/src/test/resources/decoder/constrained/gold.scores
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/constrained/gold.scores b/src/test/resources/decoder/constrained/gold.scores
deleted file mode 100644
index 4b90eb1..0000000
--- a/src/test/resources/decoder/constrained/gold.scores
+++ /dev/null
@@ -1,27 +0,0 @@
- mathematics so science language . ||| -10.471
- mathematics is science language . ||| -10.543
- mathematics that science language . ||| -11.587
- science mathematics that language . ||| -12.065
- mathematics so that the science language . ||| -12.259
- mathematics hence science language . ||| -12.352
- mathematics that is science language . ||| -12.590
- mathematics , science language . ||| -12.619
- mathematics that is why science language . ||| -12.751
- mathematics in science language . ||| -12.755
- mathematics is science language . ||| -10.543
- rabindranath born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -226.523
- rabindranath 's birth in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -227.201
- rabindranath was born in kolkata a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -227.217
- rabindranath was born in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -227.417
- rabindranath born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -227.707
- rabindranath was born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -228.000
- rabindranath was born in kolkata in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -228.133
- rabindranath was born in kolkata one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -228.160
- rabindranath born in kolkata a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -228.266
- rabindranath 's birth in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -228.386
- rabindranath was born in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -226.302
- rabindranath born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -226.523
- rabindranath born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -227.707
- rabindranath born in in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -232.123
- rabindranath was born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -227.643
- rabindranath born in kolkata was one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family ||| -229.108
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/99c791d1/src/test/resources/decoder/constrained/joshua.config
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/constrained/joshua.config b/src/test/resources/decoder/constrained/joshua.config
index f12804c..635f02b 100644
--- a/src/test/resources/decoder/constrained/joshua.config
+++ b/src/test/resources/decoder/constrained/joshua.config
@@ -1,7 +1,7 @@
-lm = kenlm 5 false false 100 lm.gz
+lm = kenlm 5 false false 100 src/test/resources/decoder/constrained/lm.gz
-tm = thrax pt 12 grammar.gz
-tm = thrax glue -1 glue-grammar
+tm = thrax pt 12 src/test/resources/decoder/constrained/grammar.gz
+tm = thrax glue -1 src/test/resources/decoder/constrained/glue-grammar
mark_oovs = false
@@ -11,7 +11,7 @@ goalSymbol = GOAL
#pruning config
pop-limit = 100
-output-format = %i %c %s
+output-format = %c %s
#nbest config
use_unique_nbest = true
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/99c791d1/src/test/resources/decoder/constrained/output.bleu
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/constrained/output.bleu b/src/test/resources/decoder/constrained/output.bleu
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/99c791d1/src/test/resources/decoder/constrained/output.gold
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/constrained/output.gold b/src/test/resources/decoder/constrained/output.gold
index b64847e..a48d5cb 100644
--- a/src/test/resources/decoder/constrained/output.gold
+++ b/src/test/resources/decoder/constrained/output.gold
@@ -1,30 +1,30 @@
-0 -10.471 mathematics so science language .
-0 -10.543 mathematics is science language .
-0 -11.587 mathematics that science language .
-0 -12.065 science mathematics that language .
-0 -12.259 mathematics so that the science language .
-0 -12.352 mathematics hence science language .
-0 -12.590 mathematics that is science language .
-0 -12.619 mathematics , science language .
-0 -12.751 mathematics that is why science language .
-0 -12.755 mathematics in science language .
-1 -10.543 mathematics is science language .
-2 -226.302 rabindranath was born in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -226.523 rabindranath born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -226.884 rabindranath was born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -227.201 rabindranath 's birth in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -227.217 rabindranath was born in kolkata a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -227.707 rabindranath born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -227.982 rabindranath was born in the a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -228.069 rabindranath was born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -228.133 rabindranath was born in kolkata in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-2 -228.160 rabindranath was born in kolkata one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-3 -226.302 rabindranath was born in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-4 -226.523 rabindranath born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-4 -230.920 rabindranath born in in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-5 -227.707 rabindranath born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-5 -232.123 rabindranath born in in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-6 -226.884 rabindranath was born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-6 -231.320 rabindranath was born kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-6 -232.836 rabindranath was born in in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
-7 -229.108 rabindranath born in kolkata was one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-10.471 mathematics so science language .
+-10.543 mathematics is science language .
+-11.587 mathematics that science language .
+-12.065 science mathematics that language .
+-12.259 mathematics so that the science language .
+-12.352 mathematics hence science language .
+-12.590 mathematics that is science language .
+-12.619 mathematics , science language .
+-12.751 mathematics that is why science language .
+-12.755 mathematics in science language .
+-10.543 mathematics is science language .
+-226.302 rabindranath was born in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-226.523 rabindranath born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-226.884 rabindranath was born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-227.201 rabindranath 's birth in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-227.217 rabindranath was born in kolkata a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-227.707 rabindranath born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-227.982 rabindranath was born in the a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-228.069 rabindranath was born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-228.133 rabindranath was born in kolkata in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-228.160 rabindranath was born in kolkata one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-226.302 rabindranath was born in a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-226.523 rabindranath born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-230.920 rabindranath born in in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-227.707 rabindranath born in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-232.123 rabindranath born in in kolkata is one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-226.884 rabindranath was born in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-231.320 rabindranath was born kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-232.836 rabindranath was born in in kolkata is a \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
+-229.108 rabindranath born in kolkata was one \u09aa\u09bf\u09b0\u09be\u09b2\u09c0 \u09ac\u09cd\u09b0\u09be\u09b9\u09cd\u09ae\u09a3 in the family
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/99c791d1/src/test/resources/decoder/constrained/test.sh
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/constrained/test.sh b/src/test/resources/decoder/constrained/test.sh
deleted file mode 100755
index b21e2ff..0000000
--- a/src/test/resources/decoder/constrained/test.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-set -u
-
-cat input.bn | $JOSHUA/bin/joshua-decoder -m 1g -threads 1 -c joshua.config > output 2> log
-
-# Compare
-diff -u output output.gold > diff
-
-if [ $? -eq 0 ]; then
- rm -f diff log output output.scores
- exit 0
-else
- exit 1
-fi
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/99c791d1/src/test/resources/decoder/constrained/weights
----------------------------------------------------------------------
diff --git a/src/test/resources/decoder/constrained/weights b/src/test/resources/decoder/constrained/weights
deleted file mode 100644
index c4e32e7..0000000
--- a/src/test/resources/decoder/constrained/weights
+++ /dev/null
@@ -1,22 +0,0 @@
-lm_0 1.2373676802179452
-
-tm_pt_0 -2.4497429277910214
-tm_pt_1 0.7224581556224123
-tm_pt_2 -0.31689069155153504
-tm_pt_3 0.33861043967238036
-tm_pt_4 0.03553113401320236
-tm_pt_5 0.19138972284064748
-tm_pt_6 0.3417994095521415
-tm_pt_7 -0.9936312455671283
-tm_pt_8 0.9070737587091975
-tm_pt_9 0.8202511858619419
-tm_pt_10 0.2593091306160006
-tm_pt_11 0.25597137004462134
-tm_pt_12 0.3538894647790496
-tm_pt_13 -0.36212061186692646
-tm_pt_14 -0.32923261148678096
-tm_pt_15 0.5524863522177359
-tm_pt_16 0.23451595442127693
-tm_glue_0 1
-WordPenalty -3.6942747832593694
-OOVPenalty -100.0
[4/4] incubator-joshua git commit: Added missing license in Unit test
Posted by mj...@apache.org.
Added missing license in Unit test
Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/dc55f07a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/dc55f07a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/dc55f07a
Branch: refs/heads/master
Commit: dc55f07a9440fe32afc5658fed3ac6acecb22cd1
Parents: 99c791d
Author: Michael A. Hedderich <mi...@users.noreply.github.com>
Authored: Wed Sep 14 15:15:50 2016 +0200
Committer: Michael A. Hedderich <mi...@users.noreply.github.com>
Committed: Wed Sep 14 15:15:50 2016 +0200
----------------------------------------------------------------------
.../apache/joshua/decoder/cky/NoGrammarTest.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/dc55f07a/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java b/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java
index 847ac86..b7da3aa 100644
--- a/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java
+++ b/src/test/java/org/apache/joshua/decoder/cky/NoGrammarTest.java
@@ -1,3 +1,21 @@
+/*
+ * 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.joshua.decoder.cky;
import static org.apache.joshua.decoder.cky.TestUtil.translate;