-
Notifications
You must be signed in to change notification settings - Fork 490
OPENNLP-975: Add format support for CoNLL-U format #111
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
Conversation
6dd2a1a to
28d53b7
Compare
| try { | ||
| return new ConlluLemmaSampleStream(new ConlluStream(inFactory), tagset); | ||
| } | ||
| catch (IOException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cosmetic: move the catch line to prevous line following }
| catch (IOException e) { | ||
| // That will throw an exception | ||
| CmdLineUtil.handleCreateObjectStreamError(e); | ||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be moved out of catch{} as the final return from the method
| } catch (IOException e) { | ||
| // That will throw an exception | ||
| CmdLineUtil.handleCreateObjectStreamError(e); | ||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this outside catch {} as final return
| String line; | ||
| while ((line = reader.readLine()) != null) { | ||
| // comment line, skip it | ||
| if (line.trim().startsWith("#")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invert the if condition and hence avoid continue;
Change to if (!line.trim().startsWith("#")) { wordLines.add(new ...) }
|
|
||
| ConlluTagset tagset; | ||
|
|
||
| if ("u".equals(params.getTagset())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be replaced by a switch stmt? and avoid f-then-else
| tagset = ConlluTagset.X; | ||
| } | ||
| else { | ||
| // unkown type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could go in as default condition in a switch stmt
| * @param tagset the type of tag to retrieve, either universial (u) or language specific (x) | ||
| */ | ||
| public String getPosTag(ConlluTagset tagset) { | ||
| if (ConlluTagset.U.equals(tagset)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use switch stmt instead ?
|
Yeah, using switch makes it much nicer because I don't have to call equals by hand. |
No description provided.