Minor clean up. Question marks and exclamation marks (also closing brackets) now printed without leading white space. Also, question marks and exclamation marks treated as end-of-sentence.
Finally the first tuple-Length words were emitted in reverse order - fixed.
This commit is contained in:
parent
d91fdcab16
commit
4cbaa5d45f
|
@ -1,6 +1,7 @@
|
|||
package cc.journeyman.milkwood;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Composes text output based on a rule tree.
|
||||
|
@ -43,7 +44,9 @@ public class Composer {
|
|||
System.err.println("Preamble: " + preamble);
|
||||
}
|
||||
|
||||
result.addAll(preamble);
|
||||
Window copy = preamble.duplicate();
|
||||
Collections.reverse(copy);
|
||||
result.addAll(copy);
|
||||
|
||||
result.addAll(this.compose(preamble, rules, length));
|
||||
|
||||
|
|
|
@ -87,7 +87,9 @@ class Writer extends BufferedWriter {
|
|||
|
||||
this.maybeParagraph(token);
|
||||
|
||||
return (token.endsWith(Milkwood.PERIOD));
|
||||
return (token.endsWith(Milkwood.PERIOD) ||
|
||||
token.equals("?") ||
|
||||
token.endsWith("!"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,6 +114,10 @@ class Writer extends BufferedWriter {
|
|||
case ',':
|
||||
case ':':
|
||||
case ';':
|
||||
case '!':
|
||||
case '?':
|
||||
case ')':
|
||||
case ']':
|
||||
case 's':
|
||||
/*
|
||||
* an 's' on its own is probably evidence of a possessive with
|
||||
|
|
Loading…
Reference in a new issue