コード例 #1
0
ファイル: main.py プロジェクト: tengssimen/IR_Assignment_3
def main():

  #task 1
  pars, stemmed_pars = task_1.main()

  #for p in pars:
    #print(p)

  #for p in stemmed_pars:
    #print(p)

  res = task_2.main(stemmed_pars)

  #for i in res:
    #print(i)

  #task 2
  bags, dictionary = task_2.main(stemmed_pars)

  #for i in bags:
    #print(i)

  #task_3
  tfidf_model, tfidf_corpus, matrix_sim, lsi_matrix, lsi_model = task_3.main(bags, dictionary)

  #task_4
  task_4.main(dictionary, tfidf_model, tfidf_corpus, matrix_sim, lsi_matrix, lsi_model, pars)
コード例 #2
0
ファイル: test_task_4.py プロジェクト: anfilat/oa
 def test_2(self):
     user_input = [
         '1',
         '1',
     ]
     with patch('builtins.input', side_effect=user_input):
         self.assertEqual(task_4.main(), 1)
コード例 #3
0
ファイル: test_task_4.py プロジェクト: anfilat/oa
 def test_8(self):
     user_input = [
         '50',
         '1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1',
         '1 0 0 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0 1 1 0 1 1 1 1 0',
         '1 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 0 1 1 1',
         '1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 0',
         '1 0 1 1 0 1 1 1 0 0 1 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1',
         '1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 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0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1',
         '1 0 1 1 1 1 1 1 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 0',
         '1 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 0 1 1 1 1',
         '1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0',
         '1 1 0 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1',
     ]
     with patch('builtins.input', side_effect=user_input):
         self.assertEqual(task_4.main(), 26)