Skip to content

Commit

Permalink
answer fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Sedra committed Apr 12, 2013
1 parent 888f605 commit 83f4be4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/sourceContentSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ def ngramWeight(question, sentence):


#get all bigram overlaps, rolls around end of sentence
if len(uniQ > 1):
if len(uniQ) > 1 and len(uniS) > 1:
bigramQ = {uniQ[i-1]+uniQ[i] for i,word in enumerate(uniQ)}
bigramS = {uniS[i-1]+uniS[i] for i,word in enumerate(uniS)}
bigram = bigramQ.intersection(bigramS)
else:
bigram = 0
bigram = {}

if len(uniQ > 2):
if len(uniQ) > 2 and len(uniS) > 1:
trigramQ = {uniQ[i-2]+uniQ[i-1]+uniQ[i] for i,word in enumerate(uniQ)}
trigramS = {uniS[i-2]+uniS[i-1]+uniS[i] for i,word in enumerate(uniS)}
trigram = trigramQ.intersection(trigramS)
else:
trigram = 0
trigram = {}


lam1 = 0.2
Expand Down

0 comments on commit 83f4be4

Please sign in to comment.