示例#1
0
文件: main.py 项目: mssharma5523/IR
'''
This is the main function that will sync with the indexing , query parsing , search and other parts...
Other files should contain functions only and the input to them should be passed from this
'''

import os
from whoosh import scoring
from search import search
from query import query_OR, query_AND, query_phrasal
from suggestCorrections import suggestCorrections
from printResult import printResult

if __name__ == "__main__":
    #ix = open_dir('Indexes')
    query = raw_input("Please Enter the query to search for:")
    input_query = query_AND(query, './Indexes/stopWordsWithoutStemming')
    suggestCorrections(input_query, query,
                       './Indexes/stopWordsWithoutStemming')

    print "BM25 Results"
    result = search(input_query, query, './Indexes/stopWordsWithoutStemming',
                    scoring.BM25F())
    printResult(result, query)

    print "Phrasal Query Results"
    result = search(query_phrasal(query,
                                  './Indexes/stopWordsWithoutStemming'), query,
                    './Indexes/stopWordsWithoutStemming', scoring.BM25F())
    printResult(result, query)

    print "TF_IDF Results"
示例#2
0
文件: main.py 项目: mssharma5523/IR
'''
This is the main function that will sync with the indexing , query parsing , search and other parts...
Other files should contain functions only and the input to them should be passed from this
'''

import os
from search import search_BM25, searchPhrasal
from query import query_OR, query_AND
from util_functions import getRelevantText

if __name__ == "__main__":
    #ix = open_dir('Indexes')
    query = raw_input("Please Enter the query to search for:")
    input_query = query_AND(query)
    print "BM25 Results"
    result = search_BM25(input_query)
    for x in result:
        print 'Title : ' + x['Title']
        print 'Filename : ' + x['FileName']
        print 'Short description : ' + x['Content'][0:20] + '...'
        relevant_text = getRelevantText(x['Content'], query.lower())
        print 'Relevant text : ' + relevant_text
    print "Phrasal Query Results"
    result = searchPhrasal(query)
示例#3
0
文件: main.py 项目: mssharma5523/IR
'''
This is the main function that will sync with the indexing , query parsing , search and other parts...
Other files should contain functions only and the input to them should be passed from this
'''

import os
from whoosh import scoring
from search import search
from query import query_OR,query_AND, query_phrasal
from suggestCorrections import suggestCorrections
from printResult import printResult

if __name__ == "__main__":
	#ix = open_dir('Indexes')
	query = raw_input("Please Enter the query to search for:")
	input_query = query_AND(query,'./Indexes/stopWordsWithoutStemming')
	suggestCorrections(input_query,query,'./Indexes/stopWordsWithoutStemming')

	print "BM25 Results"
	result = search(input_query,query,'./Indexes/stopWordsWithoutStemming',scoring.BM25F())
	printResult(result,query)

	print "Phrasal Query Results"
	result = search(query_phrasal(query,'./Indexes/stopWordsWithoutStemming'),query,'./Indexes/stopWordsWithoutStemming',scoring.BM25F())
	printResult(result,query)

	print "TF_IDF Results"
	result = search(input_query,query,'./Indexes/stopWordsWithoutStemming',scoring.TF_IDF())
	printResult(result,query)

	print "TF Results"
示例#4
0
文件: main.py 项目: mssharma5523/IR
'''
This is the main function that will sync with the indexing , query parsing , search and other parts...
Other files should contain functions only and the input to them should be passed from this
'''

import os
from search import search_BM25, searchPhrasal
from query import query_OR,query_AND
from util_functions import getRelevantText

if __name__ == "__main__":
	#ix = open_dir('Indexes')
	query = raw_input("Please Enter the query to search for:")
	input_query = query_AND(query)
	print "BM25 Results"
	result = search_BM25(input_query)
	for x in result:
		print 'Title : ' + x['Title']
		print 'Filename : ' + x['FileName']
		print 'Short description : ' + x['Content'][0:20] + '...'
		relevant_text = getRelevantText(x['Content'],query.lower())
		print 'Relevant text : ' + relevant_text
	print "Phrasal Query Results"
	result = searchPhrasal(query)