Skip to content

Commit bc386eb

Browse files
committed
fixed date
1 parent d2ad33d commit bc386eb

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

src/main/java/lineup/Demo.java

+35-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public Demo(StatAlign<Translation> aligner) {
4040
stat = aligner;
4141
splitter = new GermanEnglishSplitter(stat.getWordParser());
4242

43-
commands.addAll(List(new Exit(), new Help(), new Corpus(), new Show(), new Break(), new Details()));
43+
commands.addAll(List(new Exit(), new Help(), new Corpus(),
44+
new Show(), new Break(), new Details(), new Align()));
4445

4546
try {
4647
out = new PrintStream(System.out, true, "UTF8");
@@ -93,7 +94,7 @@ public void run(String[] args) {
9394

9495
public void showCommands() {
9596
out.println("+-----------------------------------------------------------------------------+");
96-
out.println("| line-up ==== Commands ===== 09.08.2013 |");
97+
out.println("| line-up ==== Commands ===== 23.08.2013 |");
9798
out.println("+-----------------------------------------------------------------------------+");
9899
out.println("| |");
99100
out.println("| help - all this |");
@@ -412,4 +413,36 @@ public void perform(String input) {
412413
showCommands();
413414
}
414415
}
416+
417+
class Align implements Command {
418+
public boolean respondTo(String input) {
419+
return input.startsWith("align");
420+
}
421+
422+
public void perform(String input) {
423+
if (input.equals("align")) { // reset
424+
int index = random.nextInt(stat.getCorpus().size());
425+
System.out.println(index);
426+
System.out.println();
427+
NtoNTranslation translation = stat.getCorpus().get(index);
428+
List<PossibleTranslations> pts = ptsCache = stat.associate(translation);
429+
Tuple<Sentences, Sentences> sent = Sentences.wire(
430+
translation, pts, getMaxTranslationDistance(), stat.getWordParser());
431+
432+
System.out.println(mkString(translation.getSourceSentences(), " "));
433+
System.out.println();
434+
System.out.println(mkString(translation.getTargetSentences(), " "));
435+
System.out.println();
436+
437+
for (Word word : sent._1.getWords()) {
438+
System.out.print(word.getIndex() + "-" + word.getValue() + " ");
439+
}
440+
System.out.println(); System.out.println();
441+
for (Word word : sent._2.getWords()) {
442+
System.out.print(word.getIndex() + "-" + word.getValue() + " ");
443+
}
444+
System.out.println();
445+
}
446+
}
447+
}
415448
}

0 commit comments

Comments
 (0)