Examples of TermVector


Examples of io.rkz.cacmsearch.TermVector

*/
public class TermVectorTestCase extends TestCase
{
    public void testCoordinates()
    {
        TermVector c1 = new TermVector();
        c1.put("foo", 3.0);
        c1.put("car", 2.0);
        c1.put("wee", 1.5);

        assertEquals(c1.get("foo"), 3.0);
        assertEquals(c1.get("bar"), 0.0);
    }
View Full Code Here

Examples of io.rkz.cacmsearch.TermVector

        assertEquals(c1.get("bar"), 0.0);
    }

    public void testScalarProduct()
    {
        TermVector c1 = new TermVector();
        c1.put("foo", 3.0);
        c1.put("car", 2.0);
        c1.put("wee", 1.5);

        TermVector c2 = new TermVector();
        c2.put("bar", 4.0);
        c2.put("wee", 2.0);
        c2.put("zak", 1.1);

        assertEquals(TermVector.scalarProduct(c1, c2), 3.0);
    }
View Full Code Here

Examples of io.rkz.cacmsearch.TermVector

        assertEquals(TermVector.scalarProduct(c1, c2), 3.0);
    }

    public void testNormalize()
    {
        TermVector c1 = new TermVector();
        c1.put("foo", 3.0);
        c1.put("car", 2.0);
        c1.put("wee", 1.5);

        TermVector n1 = c1.normalize();
        assertEquals(Math.floor(n1.getNorm()*1000), 1000.0);
        assertEquals(n1.get("bar"), 0.0);
    }
View Full Code Here

Examples of io.rkz.cacmsearch.TermVector

        assertEquals(n1.get("bar"), 0.0);
    }

    public void testCos()
    {
        TermVector c1 = new TermVector();
        c1.put("x", 1.0);

        TermVector c2 = new TermVector();
        c2.put("y", 2.0);
        c2.put("z", 1.0);

        TermVector c3 = new TermVector();
        c3.put("x", 1.0);
        c3.put("y", 1.0);

        assertEquals(TermVector.cos(c1, c2), 0.0);
        assertEquals(Math.floor(TermVector.cos(c1, c3)*1000), Math.floor(Math.sqrt(2)/2*1000));
    }
View Full Code Here

Examples of org.apache.lucene.document.Field.TermVector

        if (storeField) {
          storeFieldStore = Store.YES;
        } else {
          storeFieldStore = Store.NO;
        }
        TermVector storeTermVector;
        if (storeVectors) {
          storeTermVector = TermVector.WITH_POSITIONS_OFFSETS;
        } else {
          storeTermVector = TermVector.NO;
        }
View Full Code Here

Examples of org.apache.lucene.document.Field.TermVector

      name = f.getName();
      }
     
      Index idx = INDEX_VAL_MAP.get(textAnnotation.index());
      Store store = STORE_VAL_MAP.get(textAnnotation.store());
      TermVector tv = TV_VAL_MAP.get(textAnnotation.termVector());
   
      if (idx==null || store==null || tv==null){
      throw new RuntimeException("Invalid indexing parameter specification");
      }
      IndexSpec indexingSpec = new IndexSpec();
View Full Code Here

Examples of org.apache.lucene.document.Field.TermVector

                    String idxString = column.optString("index", null);
                    String storeString = column.optString("store", null);
                    String tvString = column.optString("termvector", null);
                    Index idx = idxString == null ? Index.ANALYZED : DefaultSenseiInterpreter.INDEX_VAL_MAP.get(idxString.toUpperCase());
                    Store store = storeString == null ? Store.NO : DefaultSenseiInterpreter.STORE_VAL_MAP.get(storeString.toUpperCase());
                    TermVector tv = tvString == null ? TermVector.NO : DefaultSenseiInterpreter.TV_VAL_MAP.get(tvString.toUpperCase());

                    if (idx == null || store == null || tv == null) {
                        throw new ConfigurationException("Invalid indexing parameter specification");
                    }
View Full Code Here

Examples of org.apache.lucene.document.Field.TermVector

                    String idxString = column.getAttribute("index");
                    String storeString = column.getAttribute("store");
                    String tvString = column.getAttribute("termvector");
                    Index idx = idxString == null ? Index.ANALYZED : DefaultSenseiInterpreter.INDEX_VAL_MAP.get(idxString.toUpperCase());
                    Store store = storeString == null ? Store.NO : DefaultSenseiInterpreter.STORE_VAL_MAP.get(storeString.toUpperCase());
                    TermVector tv = tvString == null ? TermVector.NO : DefaultSenseiInterpreter.TV_VAL_MAP.get(tvString.toUpperCase());

                    if (idx == null || store == null || tv == null) {
                        throw new ConfigurationException("Invalid indexing parameter specification");
                    }
View Full Code Here

Examples of org.apache.lucene.document.Field.TermVector

      Document doc = new Document();
      for (int k = 0; k < fieldNames.length; k++) {
        Field f;
        Store s;
        Index ix;
        TermVector tv = TermVector.NO;
        String val = null;
        if (fieldNames[k].equals("id")) {
          s = Store.YES;
          ix = Index.NOT_ANALYZED;
          val = String.valueOf(i);
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.