def getClassification(article, sentences): classification=classify.classify_article(article) if classification == 'person': return personQuest(sentences) elif classification == 'language': return languageQuest(sentences) elif classification == 'city': return cityQuest(sentences) elif classification == 'instrument': return instrumentQuest(sentences)
def getClassification(article, sentences): if len(sentences) == 0: errarr = [] errarr.append("There were no sentences found") return errarr classification = classify.classify_article(article) if classification == "person": return personQuest(sentences) elif classification == "language": return languageQuest(sentences) elif classification == "city": return cityQuest(sentences) elif classification == "instrument": return instrumentQuest(sentences)
for word in sent1.split(): if word in common_transport: count1 += 1 count2 = 0 for word in sent2.split(): if word in common_transport: count2 += 1 if count1 >= 4 and count2 >=4: return sent1+' '+sent2 elif count1 >=4 and count2 <4: return sent1 elif count1 < 4 and count2 >=4: return sent2 return '' classification = classify.classify_article(basename) #print classification # here we attempt to deal with generic known-questions for the different # types of articles def answer_common_questions(qw,cl): qw = map(str.lower,qw) if cl=='person': #deal with birthday / born / etc #common patterns common_birth = ['on','what','day','date','year','when','was','did','he','she','born','birth','birthday','death','died','dead','die','come','into','this','world'] common_birth.extend(sentences[0].split('_')) birth_date_sentence = sentences[1] #match 14 June 1643