weallwegot / omscs_chatbot

Issues Repository for Georgia Tech OMSCS Chat bot
MIT License
1 stars 0 forks source link

elongate short reviews. #18

Open weallwegot opened 6 years ago

weallwegot commented 6 years ago

From @weAllWeGot on December 15, 2016 20:37

instead of throwing out short reviews, they should be concatenated with the sentence before and after them..

reviewLength = len(TextBlob(sentencesofreview).sentences)
for sentenceIndex in xrange(reviewLength):
    currsentence = review(sentenceIndex)
    sentenceLength = len(currsentence)
    if(sentenceLength<20) and (sentenceIndex < reviewLength) and (sentenceIndex > 0):
        currsentence = review(sentenceIndex-1) + review(sentenceIndex) + review(sentenceIndex+1)
    elif(sentenceLength<20) and (sentenceIndex < reviewLength) and (sentenceIndex == 0):
        currsentence = review(sentenceIndex) + review(sentenceIndex+1)
    elif(sentenceLength<20) and (sentenceIndex == reviewLength) and (sentenceIndex > 0):
        currsentence = review(sentenceIndex-1) + review(sentenceIndex

_Copied from original issue: weAllWeGot/kbai_chatbot3#30