Browse Source

adding get words function.

Charles Reid 2 years ago
parent
commit
b16c360103
1 changed files with 19 additions and 0 deletions
  1. 19
    0
      get_words.py

+ 19
- 0
get_words.py View File

@@ -0,0 +1,19 @@
1
+"""
2
+get_words.py
3
+
4
+Utility method to load the SBG words
5
+and retun them as a list of strings.
6
+"""
7
+
8
+def get_words():
9
+    # Load the file.
10
+    with open('sgb-words.txt','r') as f:
11
+        ## This includes \n at the end of each line:
12
+        #words = f.readlines()
13
+    
14
+        # This drops the \n at the end of each line:
15
+        words = f.read().splitlines()
16
+
17
+    return words
18
+
19
+