Ejemplo n.º 1
0
class DictionaryClassifier:
    def __init__(self):
        self.dictionary_search = DictionarySearch()

    def classify(self, term):
        cnt = self.dictionary_search.search_dictionary(term)
        matches = dict()
        for i in range(len(categories)):
            matches[categories[i]] = cnt[i]
        return ClassificationResult(term, matches)

    def shutdown(self):
        return 1
Ejemplo n.º 2
0
 def __init__(self):
     self.dictionary_search = DictionarySearch()
import StackExchangeAPI
import DictionarySearch
import RandomDuckTalk

print(RandomDuckTalk.duckTalk())

print("What's your problem? (input comma separated keywords)")
search = input()
print("\n")

print("The top Ducktionary result is:")
print("\n")
print(DictionarySearch.runDictionarySearch(search))
print("\n")

print("Here are some other resources...")
print("\n")
response = StackExchangeAPI.getResults(search)

if len(response['items']) < 3:
    length = len(response['items'])
else:
    length = 3

for i in range(length):
    print((response["items"][i]['title']))
    print((response["items"][i]["link"]))
    print("\n")