Git Product home page Git Product logo

Comments (11)

AngledLuffa avatar AngledLuffa commented on June 13, 2024

Honestly I don't have the slightest idea. It looks like legal Java to me, but no one ever hired me to be a Java compiler.

What happens if you comment out a line such as 91, if(tree.yield().size() > maxLen) continue;

Maybe Eclipse is incorrectly thinking the loop always shortcuts there?

Or a different variable name? No idea if something weird happened where that variable name was used elsewhere and that is confusing Eclipse

from corenlp.

scasadei avatar scasadei commented on June 13, 2024

Maybe Eclipse is incorrectly thinking the loop always shortcuts there?
Interesting hypothesis...I have commented the first few lines, which made the first error disappear (the other errors are still there).
On the other hand, changing the variable name from tree to tree2 didn't change anything

treeD_Screenshot 2023-11-22 at 8 47 19 PM treeC_Screenshot 2023-11-22 at 8 42 09 PM

from corenlp.

scasadei avatar scasadei commented on June 13, 2024

And a similar problem occurs here:
file_Screenshot 2023-11-22 at 8 54 27 PM

from corenlp.

AngledLuffa avatar AngledLuffa commented on June 13, 2024

What if you took the variable out of the loop and only did the operations once? Would it compile then? (Obviously the functionality would be broken)

from corenlp.

scasadei avatar scasadei commented on June 13, 2024

If I use it exactly once, it goes away...
treeF_Screenshot 2023-11-22 at 10 02 27 PM

from corenlp.

scasadei avatar scasadei commented on June 13, 2024

However, here is a way to make it fail even at the first usage:
treeG_Screenshot 2023-11-22 at 10 01 18 PM

from corenlp.

AngledLuffa avatar AngledLuffa commented on June 13, 2024

Hmm, I had actually meant to remove the loop and test compiling with nothing there, but this might still be useful to know.

If memory serves, yield is actually now a keyword in future versions of Java. (Anything after 8 is "future" from our point of view.) Perhaps there is some effect going on here. Each of the examples you've pasted so far has that in the error.

In the case of the one where the line has yield().size(), would you try replacing that with taggedYield().size()? If that clears up some of the errors, I'll put a little effort into generalizing it, especially if you can help point out where the compiler is spazzing.

Incidentally, handling this error is kinda reinforcing my belief that pasting images is a lot less useful than pasting text - I wanted to copy/paste the line I wanted to change, but couldn't

from corenlp.

scasadei avatar scasadei commented on June 13, 2024

Good point, I will include text from now on.
Tried to remove the whole loop, all the errors disappear.

Here is the text where the four errors occur (lines 95,98,101,104)

91 for (Tree tree : tb) {
92 if(tree.yield().size() > maxLen) continue;
93 ++numTrees;
94 if (printTrees) {
95 pw.println(tree.toString());

  } else if (flattenTrees) {
    pw.println(SentenceUtils.listToString(tree.yield()));
    
  } else if (printPOS) {
    pw.println(SentenceUtils.listToString(tree.preTerminalYield()));
  
  } else if (printTnT) {
    List<CoreLabel> yield = tree.taggedLabeledYield();
    for (CoreLabel label : yield) {
      pw.printf("%s\t%s%n", label.word(), label.tag());
    }
    pw.println();
  }      
}

And the same error occurs in the class AnCoraPOSStats, at line 51 (below),
there is yield in this instance. The two instances have in common that the variable
is declared with the colon syntax inside of for (....)

48 Tree t;
49 for (File file : fileList) {
50 Reader in =
51 new BufferedReader(new InputStreamReader(new FileInputStream(file), ANCORA_ENCODING));
TreeReader tr = trf.newTreeReader(in);

  // Tree reading will implicitly perform tree normalization for us
  while ((t = tr.readTree()) != null) {
    // Update tagger with this tree
    List<CoreLabel> yield = t.taggedLabeledYield();
    for (CoreLabel leafLabel : yield) {
      if (leafLabel.tag().equals(SpanishTreeNormalizer.MW_TAG))
        continue;

      unigramTagger.incrementCount(leafLabel.word(), leafLabel.tag());
    }
  }
}

}

from corenlp.

AngledLuffa avatar AngledLuffa commented on June 13, 2024

What happens if you try this one

92 if(tree.yield().size() > maxLen) continue;

with getLeaves() instead of yield()? That one would be an easy fix if it's the yield keyword causing the problem, since the effect should be exactly the same.

from corenlp.

AngledLuffa avatar AngledLuffa commented on June 13, 2024

Would you try compiling the dev branch? I removed two usages of the keyword yield from in those functions. If that improves the compilation, I can do the same in any other places you find a compile error.

from corenlp.

scasadei avatar scasadei commented on June 13, 2024

The dev branch does not trigger the error, thanks for finding a solution!
There is still one error that pops up in file OSXAdapter:
private static com.apple.eawt.Application app can not be resolved,
I will open a new issue for it

from corenlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.