Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colon as file separator replaced by semicolon #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/edu/ucla/sspace/mains/OptionDescriptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ private OptionDescriptions() { }
"included or\n" +
"excluded. The behavior, \"include\" or \"exclude\" is specified\n" +
"first, followed by one or more file names, each separated by " +
"colons.\n" +
"semicolons.\n" +
"Multiple behaviors may be specified one after the other using a ','\n"+
"character to separate them. For example, a typical configuration " +
"may\n" +
"look like: " +
"include=top-tokens.txt:test-words.txt,exclude=stop-words.txt\n" +
"include=top-tokens.txt;test-words.txt,exclude=stop-words.txt\n" +
"Note that behaviors are applied in the order they are presented on the " +
"command-line.";

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/edu/ucla/sspace/text/TokenFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
* chain of filters from a text configuration. This is intended to facility
* command-line tools that want to provide easily configurable filters. An
* example configuration might look like:
* <tt>include=top-tokens.txt:test-words.txt,exclude=stop-words.txt</tt>
* <tt>include=top-tokens.txt;test-words.txt,exclude=stop-words.txt</tt>
*
* @see FilteredIterator
*/
Expand Down Expand Up @@ -160,10 +160,10 @@ public TokenFilter combine(TokenFilter parent) {
*
* A configuration lists sets of files that contain tokens to be included or
* excluded. The behavior, {@code include} or {@code exclude} is specified
* first, followed by one or more file names, each separated by colons.
* first, followed by one or more file names, each separated by semicolons.
* Multiple behaviors may be specified one after the other using a {@code ,}
* character to separate them. For example, a typicaly configuration may
* look like: "include=top-tokens.txt,test-words.txt:exclude=stop-words.txt"
* look like: "include=top-tokens.txt;test-words.txt,exclude=stop-words.txt"
* <b>Note</b> behaviors are applied in the order they are presented on the
* command-line.
*
Expand All @@ -186,10 +186,10 @@ public static TokenFilter loadFromSpecification(String configuration) {
*
* A configuration lists sets of files that contain tokens to be included or
* excluded. The behavior, {@code include} or {@code exclude} is specified
* first, followed by one or more file names, each separated by colons.
* first, followed by one or more file names, each separated by semicolons.
* Multiple behaviors may be specified one after the other using a {@code ,}
* character to separate them. For example, a typicaly configuration may
* look like: "include=top-tokens.txt,test-words.txt:exclude=stop-words.txt"
* look like: "include=top-tokens.txt;test-words.txt,exclude=stop-words.txt"
* <b>Note</b> behaviors are applied in the order they are presented on the
* command-line.
*
Expand All @@ -207,7 +207,7 @@ public static TokenFilter loadFromSpecification(String configuration,

TokenFilter toReturn = null;

// multiple filter are separated by a ':'
// multiple filter are separated by a ';'
String[] filters = configuration.split(",");

for (String s : filters) {
Expand All @@ -223,7 +223,7 @@ public static TokenFilter loadFromSpecification(String configuration,
throw new IllegalArgumentException(
"Invalid filter behavior: " + behavior);

String[] files = optionAndFiles[1].split(":");
String[] files = optionAndFiles[1].split(";");

// Load the words in the file(s)
Set<String> words = new HashSet<String>();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/edu/ucla/sspace/text/TokenFilterTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class TokenFilterTests {
@Test public void testMultipleInclude() throws IOException {
File toInclude = createFileWithText("include\nthree\nwords");
File toInclude2 = createFileWithText("foo\nbar\nbaz");
String filterSpec = "include=" + toInclude.getAbsolutePath() + ":"
String filterSpec = "include=" + toInclude.getAbsolutePath() + ";"
+ toInclude2.getAbsolutePath();
TokenFilter filter = TokenFilter.loadFromSpecification(filterSpec);
assertTrue(filter.accept("include"));
Expand Down