Changeset 7fb0101 in git
- Timestamp:
- Aug 5, 2019, 11:00:30 PM (4 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- bb8cdbbda3604b0b59579d1fa969c8d5ca30f07b
- Parents:
- 2f9e3f171a90f561e7a3c81734eb72998dc8fe82
- git-author:
- Murray Heymann <heymann.murray@gmail.com>2019-08-05 23:00:30+02:00
- git-committer:
- Murray Heymann <heymann.murray@gmail.com>2019-08-05 23:00:37+02:00
- Location:
- machine_learning
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
machine_learning/.coveragerc
r2f9e3f r7fb0101 1 1 [run] 2 2 branch = True 3 omit = tests/*, *__init__.py,predictor_runner.py3 omit = *tests/*, *__init__.py, *predictor_runner.py 4 4 5 5 -
machine_learning/ml_python/common/constants.py
r2f9e3f r7fb0101 7 7 EXTRACT_SCRIPT = "extract.lib" 8 8 KEYWORDS_FILE = "keywords.txt" 9 VECTORS_NPY = " vectors.npy"10 HELPFILE_NPY = " helpfilelist.npy"9 VECTORS_NPY = ".vectors.npy" 10 HELPFILE_NPY = ".helpfilelist.npy" 11 11 12 12 HELP_FILE_URL = "ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/src/4-1-2/doc.tbz2" -
machine_learning/ml_python/common/lookuptable.py
r2f9e3f r7fb0101 55 55 # read from the file created by singular 56 56 dictionary = read_dictionary() 57 print(dictionary)58 57 59 58 # sort alphabetically 60 59 dictionary = np.sort(np.unique(dictionary)) 61 print(dictionary)62 60 63 61 # write back to the same file … … 66 64 file.write(word + "\n") 67 65 66 return dictionary 68 67 69 68 … … 97 96 98 97 return (vectors, file_list) 98 99 def init_table_on_system(): 100 """ 101 check whether the various files exist, and create if necessary. 102 """ 103 # check for and download help files if necessary 104 tbz2_path = os.path.join(HELP_FILE_PATH, "helpfiles.tbz2") 105 if not os.path.isdir(HELP_FILE_PATH) or not os.path.isfile(tbz2_path): 106 fetch_tbz2_data() 107 108 # Use Singular to extract the keywords and save in a file. 109 if not os.path.isfile(KEYWORDS_FILE): 110 dictionary = extract_keywords() 111 else: 112 dictionary = None 113 114 115 if not os.path.isfile(VECTORS_NPY) or not os.path.isfile(HELPFILE_NPY): 116 vectors, file_list = create_table(dictionary=dictionary, 117 attempt_cached=False) -
machine_learning/ml_python/tests/common/test_keyword_vectors.py
r2f9e3f r7fb0101 73 73 print("Testing create_vector_dictionary function:") 74 74 75 read_dictionary()75 dictionary = read_dictionary() 76 76 77 77 print("Create Vector Dictionary with None as dictionary:") … … 82 82 create_vector_dictionary, 83 83 np.array([])) 84 print()84 vec_dic = create_vector_dictionary(dictionary) 85 85 86 86 def test_vector_distance(self): -
machine_learning/ml_python/tests/common/test_lookuptable.py
r2f9e3f r7fb0101 6 6 from common.lookuptable import * 7 7 from common.keyword_vector import count_occurances 8 from common.constants import KEYWORDS_FILE 8 from common.constants import KEYWORDS_FILE, VECTORS_NPY, HELP_FILE_PATH 9 9 10 10 class TestLookuptableMethods(unittest.TestCase): … … 33 33 self.assertTrue((test_vec == vectors[1]).all()) 34 34 35 def test_init_table_on_system(self): 36 tbz2_path = os.path.join(HELP_FILE_PATH, "helpfiles.tbz2") 37 os.remove(tbz2_path) 38 os.remove(KEYWORDS_FILE) 39 os.remove(VECTORS_NPY) 40 41 init_table_on_system() 42 43 self.assertTrue(os.path.isfile(tbz2_path)) 44 self.assertTrue(os.path.isfile(KEYWORDS_FILE)) 45 self.assertTrue(os.path.isfile(VECTORS_NPY)) 46 47 init_table_on_system() 48 49 35 50 if __name__ == '__main__': 36 51 #cProfile.run("unittest.main()")
Note: See TracChangeset
for help on using the changeset viewer.