Renamed TargetBigram to TargetBigramTest

Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/89725be5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/89725be5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/89725be5

Branch: refs/heads/7_confsystem
Commit: 89725be589e5901549d0e1c560b31ca296d41851
Parents: 1c423a2
Author: Hieber, Felix <fhie...@amazon.de>
Authored: Mon Sep 19 10:48:16 2016 +0200
Committer: Hieber, Felix <fhie...@amazon.de>
Committed: Mon Sep 19 10:48:16 2016 +0200

----------------------------------------------------------------------
 .../apache/joshua/decoder/cky/TargetBigram.java | 80 --------------------
 .../joshua/decoder/cky/TargetBigramTest.java    | 80 ++++++++++++++++++++
 2 files changed, 80 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/89725be5/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigram.java
----------------------------------------------------------------------
diff --git 
a/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigram.java 
b/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigram.java
deleted file mode 100644
index 6bba8c6..0000000
--- a/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigram.java
+++ /dev/null
@@ -1,80 +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 com.typesafe.config.ConfigFactory.parseString;
-import static org.apache.joshua.decoder.cky.TestUtil.translate;
-import static org.testng.Assert.assertEquals;
-
-import org.apache.joshua.decoder.Decoder;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import com.typesafe.config.Config;
-
-public class TargetBigram {
-
-  private static final String INPUT = "this is a test";
-  private static final String GOLD_TOPN2 = "this is a test ||| 
glue_0=-4.000000 TargetBigram_this_is=1.000000 TargetBigram_is_UNK=1.000000 
TargetBigram_UNK_UNK=1.000000 TargetBigram_UNK_</s>=1.000000 
TargetBigram_<s>_this=1.000000 ||| 0.000";
-  private static final String GOLD_TOPN3_THRESHOLD20 = "this is a test ||| 
glue_0=-4.000000 TargetBigram_a_UNK=1.000000 TargetBigram_UNK_a=1.000000 
TargetBigram_UNK_UNK=1.000000 TargetBigram_UNK_</s>=1.000000 
TargetBigram_<s>_UNK=1.000000 ||| 0.000";
-  private static final String GOLD_THRESHOLD10 = "this is a test ||| 
glue_0=-4.000000 TargetBigram_is_a=1.000000 TargetBigram_a_UNK=1.000000 
TargetBigram_UNK_is=1.000000 TargetBigram_UNK_</s>=1.000000 
TargetBigram_<s>_UNK=1.000000 ||| 0.000";
-
-  private static final String VOCAB_PATH = 
"src/test/resources/decoder/target-bigram/vocab";
-  private static final String CONF_TOPN2 = "output_format = %s ||| %f ||| %c 
\n feature_functions = [ { class = TargetBigram, vocab = "
-      + VOCAB_PATH + ", top-n = 2 } ]";
-  private static final String CONF_TOPN3_THRESHOLD20 = "output_format = %s ||| 
%f ||| %c \n feature_functions = [ { class = TargetBigram, vocab = "
-      + VOCAB_PATH + ", top-n = 3, threshold = 20 } ]";
-  private static final String CONF_THRESHOLD10 = "output_format = %s ||| %f 
||| %c \n feature_functions = [ { class = TargetBigram, vocab = "
-      + VOCAB_PATH + ", threshold = 10 } ]";
-
-  private Decoder decoder;
-
-  @Test
-  public void 
givenInput_whenDecodingWithTargetBigramAndTopN2_thenOutputCorrect() {
-    setUp(CONF_TOPN2);
-    String output = translate(INPUT, decoder).trim();
-    assertEquals(output, GOLD_TOPN2);
-  }
-
-  @Test
-  public void 
givenInput_whenDecodingWithTargetBigramAndTopN3Threshold20_thenOutputCorrect() {
-    setUp(CONF_TOPN3_THRESHOLD20);
-    String output = translate(INPUT, decoder).trim();
-    assertEquals(output, GOLD_TOPN3_THRESHOLD20);
-  }
-
-  @Test
-  public void 
givenInput_whenDecodingWithTargetBigramThreshold10_thenOutputCorrect2() {
-    setUp(CONF_THRESHOLD10);
-    String output = translate(INPUT, decoder).trim();
-    assertEquals(output, GOLD_THRESHOLD10);
-  }
-
-  public void setUp(String configuration) {
-    Config config = 
parseString(configuration).withFallback(Decoder.getDefaultFlags());
-    decoder = new Decoder(config);
-  }
-
-  @AfterMethod
-  public void tearDown() throws Exception {
-    decoder.cleanUp();
-    decoder = null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/89725be5/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigramTest.java
----------------------------------------------------------------------
diff --git 
a/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigramTest.java 
b/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigramTest.java
new file mode 100644
index 0000000..fdfbb11
--- /dev/null
+++ 
b/joshua-core/src/test/java/org/apache/joshua/decoder/cky/TargetBigramTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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 com.typesafe.config.ConfigFactory.parseString;
+import static org.apache.joshua.decoder.cky.TestUtil.translate;
+import static org.testng.Assert.assertEquals;
+
+import org.apache.joshua.decoder.Decoder;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+import com.typesafe.config.Config;
+
+public class TargetBigramTest {
+
+  private static final String INPUT = "this is a test";
+  private static final String GOLD_TOPN2 = "this is a test ||| 
glue_0=-4.000000 TargetBigram_this_is=1.000000 TargetBigram_is_UNK=1.000000 
TargetBigram_UNK_UNK=1.000000 TargetBigram_UNK_</s>=1.000000 
TargetBigram_<s>_this=1.000000 ||| 0.000";
+  private static final String GOLD_TOPN3_THRESHOLD20 = "this is a test ||| 
glue_0=-4.000000 TargetBigram_a_UNK=1.000000 TargetBigram_UNK_a=1.000000 
TargetBigram_UNK_UNK=1.000000 TargetBigram_UNK_</s>=1.000000 
TargetBigram_<s>_UNK=1.000000 ||| 0.000";
+  private static final String GOLD_THRESHOLD10 = "this is a test ||| 
glue_0=-4.000000 TargetBigram_is_a=1.000000 TargetBigram_a_UNK=1.000000 
TargetBigram_UNK_is=1.000000 TargetBigram_UNK_</s>=1.000000 
TargetBigram_<s>_UNK=1.000000 ||| 0.000";
+
+  private static final String VOCAB_PATH = 
"src/test/resources/decoder/target-bigram/vocab";
+  private static final String CONF_TOPN2 = "output_format = %s ||| %f ||| %c 
\n feature_functions = [ { class = TargetBigram, vocab = "
+      + VOCAB_PATH + ", top-n = 2 } ]";
+  private static final String CONF_TOPN3_THRESHOLD20 = "output_format = %s ||| 
%f ||| %c \n feature_functions = [ { class = TargetBigram, vocab = "
+      + VOCAB_PATH + ", top-n = 3, threshold = 20 } ]";
+  private static final String CONF_THRESHOLD10 = "output_format = %s ||| %f 
||| %c \n feature_functions = [ { class = TargetBigram, vocab = "
+      + VOCAB_PATH + ", threshold = 10 } ]";
+
+  private Decoder decoder;
+
+  @Test
+  public void 
givenInput_whenDecodingWithTargetBigramAndTopN2_thenOutputCorrect() {
+    setUp(CONF_TOPN2);
+    String output = translate(INPUT, decoder).trim();
+    assertEquals(output, GOLD_TOPN2);
+  }
+
+  @Test
+  public void 
givenInput_whenDecodingWithTargetBigramAndTopN3Threshold20_thenOutputCorrect() {
+    setUp(CONF_TOPN3_THRESHOLD20);
+    String output = translate(INPUT, decoder).trim();
+    assertEquals(output, GOLD_TOPN3_THRESHOLD20);
+  }
+
+  @Test
+  public void 
givenInput_whenDecodingWithTargetBigramThreshold10_thenOutputCorrect2() {
+    setUp(CONF_THRESHOLD10);
+    String output = translate(INPUT, decoder).trim();
+    assertEquals(output, GOLD_THRESHOLD10);
+  }
+
+  public void setUp(String configuration) {
+    Config config = 
parseString(configuration).withFallback(Decoder.getDefaultFlags());
+    decoder = new Decoder(config);
+  }
+
+  @AfterMethod
+  public void tearDown() throws Exception {
+    decoder.cleanUp();
+    decoder = null;
+  }
+
+}

Reply via email to