Examples of SimpleParser


Examples of it.unimi.di.big.mg4j.query.parser.SimpleParser

        Hash.DEFAULT_INITIAL_SIZE, .5f);
    indexMap.put(index.field, index.index);
    final Reference2DoubleOpenHashMap<Index> index2Weight = new Reference2DoubleOpenHashMap<>();
    index2Weight.put(index.index, 1.);

    final SimpleParser queryParser = new SimpleParser(indexMap.keySet(),
        indexMap.firstKey(), null);

    final Reference2ReferenceMap<Index, Object> index2Parser = new Reference2ReferenceOpenHashMap<>();

        queryEngine = new QueryEngine(queryParser, new DocumentIteratorBuilderVisitor(indexMap,
View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

    Query.loadIndicesFromSpec( basenameWeight, loadSizes, documentCollection, indexMap, index2Weight );
   
    final Object2ObjectOpenHashMap<String,TermProcessor> termProcessors = new Object2ObjectOpenHashMap<String,TermProcessor>( indexMap.size() );
    for( String alias: indexMap.keySet() ) termProcessors.put( alias, indexMap.get( alias ).termProcessor );
   
    final SimpleParser simpleParser = new SimpleParser( indexMap.keySet(), indexMap.firstKey(), termProcessors );

    final Reference2ReferenceMap<Index, Object> index2Parser = new Reference2ReferenceOpenHashMap<Index, Object>();
    /*
    // Fetch parsers for payload-based fields.
    for( Index index: indexMap.values() ) if ( index.hasPayloads ) {
View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

    /* To run a query in a simple way we need a query engine. The engine requires a parser
     * (which in turn requires the set of index names and a default index), a document iterator
     * builder, which needs the index map, a default index, and a limit on prefix query
     * expansion, and finally the index map. */
    QueryEngine engine = new QueryEngine(
      new SimpleParser( indexMap.keySet(), "text", termProcessors ),
      new DocumentIteratorBuilderVisitor( indexMap, text, 1000 ),
      indexMap
     
    );

View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

      public Query expand( Prefix prefix ) {
        return prefix;
      }
    };
   
    Query query = new SimpleParser().parse( "foo AND bar" );
    assertEquals( new And( new Term( "afoo"), new Term( "abar") ), addAqueryTransformer.transform( query ) );

    QueryTransformer expandQueryTransformer = new AbstractTermExpander() {
      /** The visitor used by this expander. */
      @Override
 
View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

public class OrderedAndDocumentIteratorTest extends TestCase {

  public void testSkipBug() throws QueryParserException, QueryBuilderVisitorException, IOException, ConfigurationException, SecurityException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    BitStreamIndex index;
    SimpleParser simpleParser;
    String basename = File.createTempFile( getClass().getSimpleName(), "test" ).getCanonicalPath();
    new IndexBuilder( basename, new StringArrayDocumentCollection( "a a b c d e" ) ).run();
    index = DiskBasedIndex.getInstance( basename + "-text", true, true );
    simpleParser = new SimpleParser( index.termProcessor );

    Query query = simpleParser.parse( "(a|b|d)<(a|b|d)" );
    DocumentIteratorBuilderVisitor documentIteratorBuilderVisitor = new DocumentIteratorBuilderVisitor( null, index, Integer.MAX_VALUE );
    DocumentIterator documentIterator = query.accept( documentIteratorBuilderVisitor );
    documentIterator.nextDocument();
    IntervalIterator intervalIterator = documentIterator.intervalIterator();
    assertEquals( Interval.valueOf( 0, 1 ), intervalIterator.nextInterval() );
View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

  public void setUp() throws ConfigurationException, SecurityException, IOException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    String basename = File.createTempFile( getClass().getSimpleName(), "test" ).getCanonicalPath();
    new IndexBuilder( basename, new StringArrayDocumentCollection( "a", "b", "c" ) ).run();
    index = DiskBasedIndex.getInstance( basename + "-text", true, true );
    simpleParser = new SimpleParser( index.termProcessor );
  }
View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

  @Override
  public void setUp() throws ConfigurationException, SecurityException, IOException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    basename = File.createTempFile( getClass().getSimpleName(), "test" ).getCanonicalPath();
    new IndexBuilder( basename, new StringArrayDocumentCollection( "a", "b", "c" ) ).run();
    index = DiskBasedIndex.getInstance( basename + "-text", true, true );
    simpleParser = new SimpleParser( index.termProcessor );
  }
View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

    indexFTitle = DiskBasedIndex.getInstance( titleFBasename + "-text", true, true );
    indexBodyBis = DiskBasedIndex.getInstance( bodyBasenameBis + "-text", true, true );

    new Paste( basenameFComb, new String[] { bodyFBasename + "-text", titleFBasename + "-text" }, true, true, 1024, null, 1024, CompressionFlags.DEFAULT_STANDARD_INDEX, true, false, -1, -1, -1, 10 ).run();
    immutableExternalPrefixMap = new ImmutableExternalPrefixMap( new FileLinesCollection( basenameFComb + ".terms", "UTF-8" ) );
    simpleParser = new SimpleParser( index0.termProcessor );
  }
View Full Code Here

Examples of it.unimi.dsi.mg4j.query.parser.SimpleParser

  }

  private void assertScoresMultiIndex( String q, Object2ReferenceMap<String,it.unimi.dsi.mg4j.index.Index> indexMap, it.unimi.dsi.mg4j.index.Index defaultIndex, Scorer scorer, double[] expected ) throws QueryParserException, QueryBuilderVisitorException, IOException {
    Object2ReferenceOpenHashMap<String, TermProcessor> termProcessors = new Object2ReferenceOpenHashMap<String,TermProcessor>();
    for( String s: indexMap.keySet() ) termProcessors.put( s, indexMap.get( s ).termProcessor );
    SimpleParser simpleParser = new SimpleParser(
      indexMap.keySet(),
      "t", // TODO: make it a parameter
      termProcessors
    );
       
    it.unimi.dsi.mg4j.query.nodes.Query query = simpleParser.parse( q );
    DocumentIteratorBuilderVisitor documentIteratorBuilderVisitor = new DocumentIteratorBuilderVisitor( indexMap, defaultIndex, Integer.MAX_VALUE );
    DocumentIterator documentIterator = query.accept( documentIteratorBuilderVisitor );
    scorer.wrap( documentIterator );
   
    int i = 0;
View Full Code Here

Examples of org.encog.util.SimpleParser

   * @return The parsed values.
   */
  public static Map<String, String> parseParams(final String line) {
    final Map<String, String> result = new HashMap<String, String>();

    final SimpleParser parser = new SimpleParser(line);

    while (!parser.eol()) {
      final String name = ArchitectureParse.parseName(parser)
          .toUpperCase();

      parser.eatWhiteSpace();
      if (!parser.lookAhead("=", false)) {
        throw new EncogError("Missing equals(=) operator.");
      } else {
        parser.advance();
      }

      final String value = ArchitectureParse.parseValue(parser);

      result.put(name.toUpperCase(), value);

      if (!parser.parseThroughComma()) {
        break;
      }
    }

    return result;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.