org.apache.ctakes.utils.wiki
Class WikiIndex
java.lang.Object
org.apache.ctakes.utils.wiki.WikiIndex
public class WikiIndex
- extends Object
A wrapper for a wikipedia lucene index.
- Author:
- dmitriy dligach
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultMaxHits
public static int defaultMaxHits
defaultIndexPath
public static String defaultIndexPath
defaultSearchField
public static String defaultSearchField
WikiIndex
public WikiIndex(int maxHits,
String indexPath,
String searchField,
boolean approximate)
WikiIndex
public WikiIndex(int maxHits,
String indexPath,
String searchField)
WikiIndex
public WikiIndex()
initialize
public void initialize()
throws org.apache.lucene.index.CorruptIndexException,
IOException
- Throws:
org.apache.lucene.index.CorruptIndexException
IOException
search
public ArrayList<SearchResult> search(String queryText)
throws org.apache.lucene.queryparser.classic.ParseException,
IOException
- Search the index. Return a list of article titles and their scores.
- Throws:
org.apache.lucene.queryparser.classic.ParseException
IOException
getCosineSimilarity
public double getCosineSimilarity(String queryText1,
String queryText2)
throws org.apache.lucene.queryparser.classic.ParseException,
IOException
- Send two queries to the index.
For each query, form a tfidf vector that represents N top matching documents.
Return cosine similarity between the two tfidf vectors.
- Throws:
org.apache.lucene.queryparser.classic.ParseException
IOException
getTermFreqVectors
public ArrayList<org.apache.lucene.index.Terms> getTermFreqVectors(String queryString)
throws org.apache.lucene.queryparser.classic.ParseException,
IOException
- Throws:
org.apache.lucene.queryparser.classic.ParseException
IOException
close
public void close()
throws IOException
- Throws:
IOException
Copyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.