Package edu.ucla.sspace.text

Examples of edu.ucla.sspace.text.Document


        long processStart = System.currentTimeMillis();
        int count = 0;

        while (docIter.hasNext()) {
            long startTime = System.currentTimeMillis();
            Document doc = docIter.next();
            int docNumber = ++count;
            int terms = 0;
            sspace.processDocument(doc.reader());
            long endTime = System.currentTimeMillis();
            verbose("processed document #%d in %.3f seconds",
                    docNumber, ((endTime - startTime) / 1000d));
        }
View Full Code Here


                public void run() {
                    // repeatedly try to process documents while some still
                    // remain
                    while (docIter.hasNext()) {
                        long startTime = System.currentTimeMillis();
                        Document doc = docIter.next();
                        int docNumber = count.incrementAndGet();
                        int terms = 0;
                        try {
                            sspace.processDocument(doc.reader());
                        } catch (Throwable t) {
                            t.printStackTrace();
                        }
                        long endTime = System.currentTimeMillis();
                        verbose("parsed document #%d in %.3f seconds",
View Full Code Here

        /**
         * {@inheritDoc}
         */
        public synchronized Document next() {
            Document doc = new StringDocument(currentDoc);
            currentDoc = advance();
            return doc;
        }
View Full Code Here

        /**
         * {@inheritDoc}
         */
        public Document next() {
            Document doc = new StringDocument(next);
            next = advance();
            return doc;
        }
View Full Code Here

        /**
         * {@inheritDoc}
         */
        public Document next() {
            Document doc = new StringDocument(next);
            next = advance();
            return doc;
        }
View Full Code Here

                              Arrays.asList(expectedRelations)));
    }

    @Test public void testSingleExtraction() throws Exception {
        DependencyExtractor extractor = new CoNLLDependencyExtractor();
        Document doc = new StringDocument(toTabs(SINGLE_PARSE));
        DependencyTreeNode[] nodes = extractor.readNextTree(doc.reader());

        assertEquals(12, nodes.length);

        // Check the basics of the node.
        assertEquals("review", nodes[8].word());
View Full Code Here

                    Arrays.asList(expectedRelations)));
    }

    @Test public void testDoubleExtraction() throws Exception {
        DependencyExtractor extractor = new CoNLLDependencyExtractor();
        Document doc = new StringDocument("\n\n" +
                                          toTabs(SINGLE_PARSE) +
                                          "\n" +
                                          toTabs(SECOND_PARSE));
        BufferedReader reader = doc.reader();
        DependencyTreeNode[] relations = extractor.readNextTree(reader);
        assertTrue(relations != null);
        assertEquals(12, relations.length);

        testFirstRoot(relations, 2);
View Full Code Here

        testSecondRoot(relations, 1);
    }
   
    @Test public void testRootNode() throws Exception {
        DependencyExtractor extractor = new CoNLLDependencyExtractor();
        Document doc = new StringDocument(toTabs(SINGLE_PARSE));
        DependencyTreeNode[] relations = extractor.readNextTree(doc.reader());

        assertEquals(12, relations.length);

        testFirstRoot(relations, 2);
    }
View Full Code Here

        testFirstRoot(relations, 2);
    }

    @Test public void testConcatonatedTrees() throws Exception {
        DependencyExtractor extractor = new CoNLLDependencyExtractor();
        Document doc = new StringDocument(toTabs(CONCATONATED_PARSE));
        DependencyTreeNode[] relations = extractor.readNextTree(doc.reader());
       
        assertEquals(16, relations.length);
        testFirstRoot(relations, 2);
        testSecondRoot(relations, 13);
    }
View Full Code Here

        testSecondRoot(relations, 13);
    }

    @Test public void testConcatonatedTreesZeroOffset() throws Exception {
        DependencyExtractor extractor = new CoNLLDependencyExtractor();
        Document doc = new StringDocument(toTabs(DOUBLE_ZERO_OFFSET_PARSE));
        DependencyTreeNode[] relations = extractor.readNextTree(doc.reader());
       
        assertEquals(16, relations.length);
        testFirstRoot(relations, 2);
        testSecondRoot(relations, 13);
    }
View Full Code Here

TOP

Related Classes of edu.ucla.sspace.text.Document

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.