-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tift: Fix issue with end of tweet, truncated hashtags. Update to a new
non-capturing Hashtag regex. Additionally, remove a lot of object creation and switch these to arrays. Closes #1.
- Loading branch information
Showing
11 changed files
with
269 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* | ||
*/ | ||
package edu.jhu.hlt.tift; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* | ||
*/ | ||
class HashTagTagger { | ||
public static final Pattern HASHTAG_PATTERN = Pattern.compile("\\B#\\w*[a-zA-Z]+\\w*", | ||
Pattern.UNICODE_CHARACTER_CLASS); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,47 @@ | ||
/* | ||
* Copyright 2012-2014 Johns Hopkins University HLTCOE. All rights reserved. | ||
* This software is released under the 2-clause BSD license. | ||
* Copyright 2012-2016 Johns Hopkins University HLTCOE. All rights reserved. | ||
* See LICENSE in the project root directory. | ||
*/ | ||
|
||
package edu.jhu.hlt.tift; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* 2-tuple that contains a token and a tag. | ||
* 2-tuple that contains a token and an {@link Optional} tag. | ||
*/ | ||
public class TokenTagTuple { | ||
|
||
private final String token; | ||
private final String tag; | ||
|
||
/** | ||
* | ||
*/ | ||
public TokenTagTuple(String token, String tag) { | ||
this.token = token; | ||
this.tag = tag; | ||
} | ||
|
||
/** | ||
* @return the token | ||
*/ | ||
public String getToken() { | ||
return token; | ||
} | ||
|
||
/** | ||
* @return the tag | ||
*/ | ||
public String getTag() { | ||
return tag; | ||
} | ||
private final String token; | ||
private final Optional<String> tag; | ||
|
||
/** | ||
* | ||
*/ | ||
public TokenTagTuple(String token) { | ||
this(token, Optional.empty()); | ||
} | ||
|
||
public TokenTagTuple(String token, Optional<String> tag) { | ||
this.token = token; | ||
this.tag = tag; | ||
} | ||
|
||
public TokenTagTuple(String token, String tag) { | ||
this.token = token; | ||
this.tag = Optional.ofNullable(tag); | ||
} | ||
|
||
/** | ||
* @return the token | ||
*/ | ||
public String getToken() { | ||
return token; | ||
} | ||
|
||
/** | ||
* @return the tag | ||
*/ | ||
public Optional<String> getTag() { | ||
return tag; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.