コード例 #1
0
ファイル: UserInput.py プロジェクト: StanleyCheong/NLP
    def result(self,userInput):
        userInput = str(userInput)        
        googleRes = Search()
        cleanPage = Clean()
        summ = Summary()
        query = QueryExpansion()
        idf = self.loadSet("trainedSetV1")  

        area = query.expand(userInput) 
        results = googleRes.googleAPICall(userInput)  
        # Only return 20 results
        length = len(results)
        if len(results) > 20:
            length = 20
        for res in results[0:length]:
            document  = cleanPage.cleanHTML(res)
            print res
            start = time.clock()
            print (summ.simpleSummary(document,userInput,idf,area,1))
            elapsed = (time.clock() - start)    
            print (elapsed)
            print   
コード例 #2
0
ファイル: UserInput.py プロジェクト: ycc1107/NLP
    def result(self,userInput):
        result = []
        userInput = str(userInput)        
        googleRes = Search()
        cleanPage = Clean()
        summ = Summary()
        query = QueryClassifier()
        queryExpand = QueryExpansionProcess()
        expandedQuery = queryExpand.expand(userInput)
        idf = self.loadSet("trainedSetV1")  

        area = query.expand(userInput) 
        results = googleRes.googleAPICall(userInput)  
        # Only return 20 results
        length = len(results)
        if len(results) > 20:
            length = 20
        
        for res in results[0:length]:
            document,title = cleanPage.cleanHTML(res)
            result.append(title)
            result.append(res)
            result.append(summ.simpleSummary(document,userInput,idf,area,expandedQuery))
        return (result)