[
https://issues.apache.org/jira/browse/OPENNLP-1486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17714977#comment-17714977
]
ASF GitHub Bot commented on OPENNLP-1486:
-----------------------------------------
rzo1 commented on code in PR #102:
URL: https://github.com/apache/opennlp-sandbox/pull/102#discussion_r1173691440
##########
opennlp-coref/src/main/java/opennlp/tools/coref/resolver/DefaultNonReferentialResolver.java:
##########
@@ -127,7 +131,9 @@ public void train() throws IOException {
if (ResolverMode.TRAIN == mode) {
System.err.println(this + " referential");
if (debugOn) {
- try (FileWriter writer = new FileWriter(modelName + ".events")) {
+ Path p = Path.of(modelName + ".events");
+ try (Writer writer = Files.newBufferedWriter(p, StandardCharsets.UTF_8,
Review Comment:
~~The previous `FileWriter` didn't override the file. Guess, we need to
remove the `TRUNCATE_EXISTING` here.~~
I thought, that FileWriter throws an IOException if the file already exist,
but this isn't the case...
For reference:
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/FileWriter.html#%3Cinit%3E(java.io.File)
> Switch to BufferedWriter in various sandbox components
> ------------------------------------------------------
>
> Key: OPENNLP-1486
> URL: https://issues.apache.org/jira/browse/OPENNLP-1486
> Project: OpenNLP
> Issue Type: Improvement
> Components: Coref
> Affects Versions: 2.1.1
> Reporter: Martin Wiesner
> Assignee: Martin Wiesner
> Priority: Minor
> Fix For: 2.2.0
>
>
> As reported in [PR #29|https://github.com/apache/opennlp-sandbox/pull/29],
> several classes don't used buffered IO when writing data/files to disk. This
> should be improved. The original PR became incompatible over time and the
> original contributor did not show activity for a longer time. Therefore, this
> issue shall catch his idea and improve the state from the current state of
> the sandbox code base.
> PR #29 addressed the following components:
> - modelbuilder-addon
> - opennlp-coref
> The above list is potentially not complete and can or should be extended.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)