Package edu.stanford.nlp.parser.lexparser

Examples of edu.stanford.nlp.parser.lexparser.RerankingParserQuery


        count++; // index from 1
        ParserQuery pq = parser.parserQuery();
        if (!(pq instanceof RerankingParserQuery)) {
          throw new IllegalArgumentException("Expected a RerankingParserQuery");
        }
        RerankingParserQuery rpq = (RerankingParserQuery) pq;
        if (!rpq.parse(sentence)) {
          throw new RuntimeException("Unparsable sentence: " + sentence);
        }
        RerankerQuery reranker = rpq.rerankerQuery();
        if (!(reranker instanceof DVModelReranker.Query)) {
          throw new IllegalArgumentException("Expected a DVModelReranker");
        }
        DeepTree deepTree = ((DVModelReranker.Query) reranker).getDeepTrees().get(0);
        IdentityHashMap<Tree, SimpleMatrix> vectors = deepTree.getVectors();
View Full Code Here


        throw new AssertionError("Could not parse: " + tokens);
      }
      if (!(parserQuery instanceof RerankingParserQuery)) {
        throw new IllegalArgumentException("Expected a LexicalizedParser with a Reranker attached");
      }
      RerankingParserQuery rpq = (RerankingParserQuery) parserQuery;
      if (!(rpq.rerankerQuery() instanceof DVModelReranker.Query)) {
        throw new IllegalArgumentException("Expected a LexicalizedParser with a DVModel attached");
      }
      DeepTree tree = ((DVModelReranker.Query) rpq.rerankerQuery()).getDeepTrees().get(0);

      SimpleMatrix rootVector = null;
      for (Map.Entry<Tree, SimpleMatrix> entry : tree.getVectors().entrySet()) {
        if (entry.getKey().label().value().equals("ROOT")) {
          rootVector = entry.getValue();
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.parser.lexparser.RerankingParserQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.