Sa-m commited on
Commit
4357809
1 Parent(s): 703ac6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -114,7 +114,7 @@ def concordance(text_Party,strng):
114
  s=result.getvalue().splitlines()
115
  return result.getvalue()
116
 
117
- def get_all_phases_containing_tar_wrd(target_word, tar_passage, left_margin = 10, right_margin = 10):
118
  """
119
  Function to get all the phases that contain the target word in a text/passage tar_passage.
120
  Workaround to save the output given by nltk Concordance function
@@ -138,6 +138,7 @@ def get_all_phases_containing_tar_wrd(target_word, tar_passage, left_margin = 10
138
 
139
  ## join the sentences for each of the target phrase and return it
140
  result = [''.join([x.replace("Y","")+' ' for x in con_sub]) for con_sub in concordance_txt][:-1]
 
141
  res='. '.join(result)
142
  return res
143
 
@@ -385,8 +386,7 @@ def analysis(Manifesto,Search):
385
  img5=DispersionPlot(text_Party)
386
  #concordance(text_Party,Search)
387
  searchRes=get_all_phases_containing_tar_wrd(text_Party,Search)
388
- searChRes=clean(searchRes)
389
- searChRes=searchRes.replace(Search,"\u0332".join(Search))
390
  return searChRes,fdist_Party,img1,img2,img3,img4,img5
391
 
392
 
114
  s=result.getvalue().splitlines()
115
  return result.getvalue()
116
 
117
+ def get_all_phases_containing_tar_wrd(target_word, tar_passage, left_margin = 10, right_margin = 10,numLins=10):
118
  """
119
  Function to get all the phases that contain the target word in a text/passage tar_passage.
120
  Workaround to save the output given by nltk Concordance function
138
 
139
  ## join the sentences for each of the target phrase and return it
140
  result = [''.join([x.replace("Y","")+' ' for x in con_sub]) for con_sub in concordance_txt][:-1]
141
+ result=result[:numLins+1]
142
  res='. '.join(result)
143
  return res
144
 
386
  img5=DispersionPlot(text_Party)
387
  #concordance(text_Party,Search)
388
  searchRes=get_all_phases_containing_tar_wrd(text_Party,Search)
389
+ #searChRes=searchRes.replace(Search,"\u0332".join(Search))
 
390
  return searChRes,fdist_Party,img1,img2,img3,img4,img5
391
 
392